JS: Function Object

By Xah Lee. Date: . Last updated: .

Function is the value of the property key "Function" of the global object.

console.log( window["Function"] === Function ); // true

Function is a function.

[see JS: Data Types]

// type of Function
console.log ( typeof Function === "function" ); // true
console.log ( Object.prototype.toString.call(Function) === "[object Function]" ) // true

The parent of Function is Function.prototype. [see JS: Prototype and Inheritance]

// parent of Function
console.log ( Object.getPrototypeOf ( Function ) === Function.prototype ); // true

The purpose of Function is:

  1. To define a function from strings. (Useful when you need to generate function definition at run time).
  2. Holds the property key "prototype". The value of Function.prototype is the parent object of all function objects.

Function Constructor

JS: Function Constructor

Properties


Function.prototype

JS: Function.prototype

Function.length

This is a data property with a value of 1. This property has the attributes { writable: false, "enumerable": false, configurable: true }.

[see JS: Property Attributes]

ECMAScript 2015 §Fundamental Objects#sec-function.length

Reference

ECMAScript 2015 §Fundamental Objects#sec-function-objects

Function Topic

  1. JS: Define Function
  2. JS: Arrow Function
  3. JS: Function Parameters
  4. JS: var/function Order
  5. JS: var Name Scope
  6. JS: Function Declaration vs Function Expression
  7. JS: Closure
  8. JS: Functional Programing
  9. JS: Function Call, Apply, Bind
  10. JS: Function Argument Default Value
  11. JS: Function Rest Parameters
  12. JS: Function Argument Destructure

  1. JS: Function Object
  2. JS: Function.prototype
Liket it? Put $1 at patreon.

Or, Buy JavaScript in Depth