Re:ESnext – Tomorrow’s JavaScript syntax today
by bpicolo on Sunday October 12, 2014 @11:56AM
(#8445621)
Because you're console.logging it
Re:ESnext – Tomorrow’s JavaScript syntax today
by DecoPerson on Sunday October 12, 2014 @01:41PM
(#8445958)
"Every object has a toString() method that is automatically called when the object is to be represented as a text value or when an object is referred to in a manner in which a string is expected."
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Why calling new Person(..,..) returns toString()?
The example calls:
console.log( 'Full name is:', new Person('Michael', 'Bluth2') );
new Person should create an instance of Person, but why it calls toString()?.