JavaScript: 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 JavaScript: 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 JavaScript: 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 "length".
  3. Holds the property key "prototype". The value of Function.prototype is the parent object of all array objects.

Function Constructor

JavaScript: Function Constructor

Properties


Function.prototype

JavaScript: 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 JavaScript: Property Attributes

ECMAScript 2015 §Fundamental Objects#sec-function.length

Reference

ECMAScript 2015 §Fundamental Objects#sec-function-objects

Function Topic

  1. JavaScript: Define Function
  2. JavaScript: Function Parameters
  3. JavaScript: Variable/Function Declaration Order, Name Hoisting
  4. JavaScript Variable Scope: Function Level vs Block Level
  5. JavaScript: Function Declaration vs Function Expression
  6. JavaScript: Closure
  7. JavaScript: Functional Programing
  8. JavaScript: Function Call, Apply, Bind
  9. JavaScript: Function Argument Default Value
  10. JavaScript: Function Rest Parameters
  11. JavaScript: Arrow Function

  1. JavaScript: Function Object
  2. JavaScript: Function.prototype
Like what you read? Buy JavaScript in Depth
or, buy a new keyboard, see Keyboard Reviews.