JS: Function Object

By Xah Lee. Date: . Last updated: .

Function is the value of the property key "Function" of the global object. [JS: the Global Object]

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

Type

Function is a function.

[see JS: Value Types]

// type of Function
console.log ( typeof Function === "function" ); // true

Parent

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

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

Purpose

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.length

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

[see JS: Property Attributes, writable, enumerable, configurable]

ECMAScript 2015 §Fundamental Objects#sec-function.length

Reference

ECMAScript 2015 §Fundamental Objects#sec-function-objects

Function Topic

  1. JS: Define Function
  2. JS: Functional Programing
  3. JS: Arrow Function
  4. JS: Function Parameters
  5. JS: f Declaration vs Expression
  6. JS: Closure
  7. JS: Function Call, Apply, Bind
  8. JS: Function Argument Default Value
  9. JS: Function Rest Parameters
  10. JS: Function Argument Destructure
  11. JS: Function Object
  12. JS: Function.prototype
Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS Basics
  4. JS in Depth
  5. JS Reference
  6. DOM
  7. SVG
  8. JS Misc