title: Is there a function like prototype.toArray in vanilla JavaScript?
body: <p>I want to change the value, that is returned form a JavaScript object with the following code:</p>
  
  <pre><code>F.prototype.valueOf = function(){return "foo";}
  F.prototype.toString = Id.valueOf();
  </code></pre>
  
  <p>"F" being the JavaScript class and "foo" the string i am returning.
  This works fine when calling an alert like so:</p>
  
  <pre><code>alert(F());    //alerts foo
  </code></pre>
  
  <p>But is there any way, that the value of an object can be an array? Maybe something like</p>
  
  <pre><code>F.prototype.valueOf = function(){return ["foo", "bar"];}
  F.prototype.toArray = Id.valueOf();
  </code></pre>
  
  <p>?</p>