2011/1/15 Vishal Singh <[email protected]>:
> I’m taking a guess here, trying to justify this and would appreciate
> feedback in my thinking. Since new has to set up the prototype chain, it
> would necessarily have to return an object since primitives do not have
> properties and methods. Does this sound right?
It depends on the view of what is considered a property or method.
>>> console.log(typeof "string".replace)
function
>>> console.log((1.23456).toFixed(2))
1.23
>>> console.log("what is my".length)
10
It looks to me that primitives has methods and properties.
--
Poetro
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]