Skip to main content
added 275 characters in body
Source Link
Ewan
  • 79.9k
  • 5
  • 83
  • 179

From ECMA spec 1

ECMAScript does not contain proper classes such as those in C++, Smalltalk, or Java, but rather, supports constructors which create objects by executing code that allocates storage for the objects and initializes all or part of them by assigning initial values to their properties. All functions including constructors are objects, but not all objects are constructors.

I don't see how it could be any more clear!!! </sarcasm>

Further down we see:

Prototype A prototype is an object used to implement structure, state, and behavior inheritance in ECMAScript. When a constructor creates an object, that object implicitly references the constructor’s associated prototype for the purpose of resolving property references. The constructor’s associated prototype can be referenced by the program expression constructor.prototype, and properties added to an object’s prototype are shared, through inheritance, by all objects sharing the prototype.

So we can see that a prototype is an object, but not nesecerallynecessarily a function object.

Also, we have this interesting titbit

http://www.ecma-international.org/ecma-262/8.0/index.html#sec-object-objects

The Object constructor is the %Object% intrinsic object and the initial value of the Object property of the global object.

and

The Function constructor is the %Function% intrinsic object and the initial value of the Function property of the global object.

From ECMA spec 1

ECMAScript does not contain proper classes such as those in C++, Smalltalk, or Java, but rather, supports constructors which create objects by executing code that allocates storage for the objects and initializes all or part of them by assigning initial values to their properties. All functions including constructors are objects, but not all objects are constructors.

I don't see how it could be any more clear!!! </sarcasm>

Further down we see:

Prototype A prototype is an object used to implement structure, state, and behavior inheritance in ECMAScript. When a constructor creates an object, that object implicitly references the constructor’s associated prototype for the purpose of resolving property references. The constructor’s associated prototype can be referenced by the program expression constructor.prototype, and properties added to an object’s prototype are shared, through inheritance, by all objects sharing the prototype.

So we can see that a prototype is an object, but not nesecerally a function object.

From ECMA spec 1

ECMAScript does not contain proper classes such as those in C++, Smalltalk, or Java, but rather, supports constructors which create objects by executing code that allocates storage for the objects and initializes all or part of them by assigning initial values to their properties. All functions including constructors are objects, but not all objects are constructors.

I don't see how it could be any more clear!!! </sarcasm>

Further down we see:

Prototype A prototype is an object used to implement structure, state, and behavior inheritance in ECMAScript. When a constructor creates an object, that object implicitly references the constructor’s associated prototype for the purpose of resolving property references. The constructor’s associated prototype can be referenced by the program expression constructor.prototype, and properties added to an object’s prototype are shared, through inheritance, by all objects sharing the prototype.

So we can see that a prototype is an object, but not necessarily a function object.

Also, we have this interesting titbit

http://www.ecma-international.org/ecma-262/8.0/index.html#sec-object-objects

The Object constructor is the %Object% intrinsic object and the initial value of the Object property of the global object.

and

The Function constructor is the %Function% intrinsic object and the initial value of the Function property of the global object.

added 619 characters in body
Source Link
Ewan
  • 79.9k
  • 5
  • 83
  • 179

From ECMA spec 1

ECMAScript does not contain proper classes such as those in C++, Smalltalk, or Java, but rather, supports constructors which create objects by executing code that allocates storage for the objects and initializes all or part of them by assigning initial values to their properties. All functions including constructors are objects, but not all objects are constructors.

I don't see how it could be any more clear!!! </sarcasm>

Further down we see:

Prototype A prototype is an object used to implement structure, state, and behavior inheritance in ECMAScript. When a constructor creates an object, that object implicitly references the constructor’s associated prototype for the purpose of resolving property references. The constructor’s associated prototype can be referenced by the program expression constructor.prototype, and properties added to an object’s prototype are shared, through inheritance, by all objects sharing the prototype.

So we can see that a prototype is an object, but not nesecerally a function object.

From ECMA spec 1

ECMAScript does not contain proper classes such as those in C++, Smalltalk, or Java, but rather, supports constructors which create objects by executing code that allocates storage for the objects and initializes all or part of them by assigning initial values to their properties. All functions including constructors are objects, but not all objects are constructors.

I don't see how it could be any more clear!!! </sarcasm>

From ECMA spec 1

ECMAScript does not contain proper classes such as those in C++, Smalltalk, or Java, but rather, supports constructors which create objects by executing code that allocates storage for the objects and initializes all or part of them by assigning initial values to their properties. All functions including constructors are objects, but not all objects are constructors.

I don't see how it could be any more clear!!! </sarcasm>

Further down we see:

Prototype A prototype is an object used to implement structure, state, and behavior inheritance in ECMAScript. When a constructor creates an object, that object implicitly references the constructor’s associated prototype for the purpose of resolving property references. The constructor’s associated prototype can be referenced by the program expression constructor.prototype, and properties added to an object’s prototype are shared, through inheritance, by all objects sharing the prototype.

So we can see that a prototype is an object, but not nesecerally a function object.

Source Link
Ewan
  • 79.9k
  • 5
  • 83
  • 179

From ECMA spec 1

ECMAScript does not contain proper classes such as those in C++, Smalltalk, or Java, but rather, supports constructors which create objects by executing code that allocates storage for the objects and initializes all or part of them by assigning initial values to their properties. All functions including constructors are objects, but not all objects are constructors.

I don't see how it could be any more clear!!! </sarcasm>