title: Output of string in function gives an object
body: <p>I tring to print to string but it's for some reason gives an object..</p>
  <p>I want to get (example 20220515) as string and then slice it, to get two first digits.</p>
  <pre><code>// Button
  const birthDate = document.querySelector('#dateSubmit');
  
  // Date input
  birthDate.onclick = function() {
      let in1 = document.querySelector('#birthday');
      let birthDate = (in1.value).replaceAll(&quot;-&quot;, &quot;&quot;);
      let dateNow = 20220515;
      let old = dateNow - parseInt(birthDate); // 320411
      let result = toString(old);
  
      console.log(result);  // [object Undefined] ?
  
      console.log(typeof result);  // string 
  }
  </code></pre>