js的对象

在C++ 或C#中,当我们谈到对象,指的是类或者结构体的实例。对象根据他们实例化的模板(就是所谓的类),会拥有不同的属性和方法。但在JavaScript 里对象不是这个概念。在 JavaScript 中,对象就是一个键/值对的集合--你可以把JavaScript的对象想象成一个键为字符串类型的字典。

functions are first-class objects in js,which means that they are objects,and that they are no diffrent from any other value.

a function can have properties and methods ,because it is an object.

global object

by default this refers to the global object.

parseInt and parseFloat functions are actually methods of the global object.

global object have a property that refers to itself:window.

下面申明数组的区别: var a = new array(1); var b = [1];