title: How to print the object like string in console.log in Javascript?
body: <p>I want to print in the console the result from the function <code>printNewObject()</code>.  How I can print with console.log in Javascript the result from the object? In the output I get the result <code>Set {"1", "3", "4"}</code>, but I want to look like a string, like <code>134</code>. </p>
  
  <p><strong>Here is the code:</strong> </p>
  
  <pre><code>window.onload = function(){
  
    inputBox = document.getElementById("myText");
    btn = document.getElementById('sub');
  
    inputBox2 = document.getElementById("myText2");
    btn2 = document.getElementById('sub2');
  
    btn.addEventListener("click",function(event){
      event.preventDefault();
  
      toObject(inputBox.value);
    });
  
    btn2.addEventListener("click",function(event){
      event.preventDefault();
      printNewObject(inputBox.value, inputBox2.value);
    });
  
    function toObject(arr) {
  
      var rv = {};
  
      for (var i = 0; i &lt; arr.length; ++i)
        rv[i] = arr[i];
  
      return rv;
    }
  
    function printNewObject(rv, number) {
  
      var mySet = new Set(rv);
  
      for (var i = 0; i &lt;= rv.length; i++) {
  
        if (rv[i] == number) {
          mySet.delete(rv[i]);
        }
      }
      console.log(mySet);
    }
  }
  </code></pre>