Does string inherits from Object in Javascript?

Posted by Morgan Cheng on Stack Overflow See other posts from Stack Overflow or by Morgan Cheng
Published on 2010-05-11T13:32:01Z Indexed on 2010/05/11 13:34 UTC
Read the original article Hit count: 179

Is Object the base class of all objects in Javascript, just like other language such as Java & C#?

I tried below code in Firefox with Firebug installed.

var t = new Object();
var s1 = new String('str');
var s2 = 'str';
console.log(typeof t);
console.log(typeof s1);
console.log(typeof s2);

The console output is

object
object
string

So, s1 and s2 are of diffeent type?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about inheritance