What makes the availability of both primitive and object-wrapped values in JavaScript useful?

Posted by Delan Azabani on Stack Overflow See other posts from Stack Overflow or by Delan Azabani
Published on 2010-05-02T10:32:24Z Indexed on 2010/05/02 10:37 UTC
Read the original article Hit count: 284

Filed under:
|
|
|
|

I wrote a blog post a while ago detailing how the availability of both primitive and object-wrapped value types in JavaScript (for things such as Number, String and Boolean) causes trouble, including but not limited to type-casting to a boolean (e.g. object-wrapped NaN, "" and false actually type-cast to true).

My question is, with all this confusion and problems, is there any benefit to JavaScript having both types of values for the built-in classes?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about primitive