JavaScript Built-in Functions

JavaScript Built-in Functions:-

Functions that are provided by JavaScript itself as part of the scripting language, are known as built-in functions. JavaScript provides a rich set of the library that has a lot of built-in functions. Some examples of the built-in functions are : alert(), prompt(), parseInt(), eval() etc.

JavaScript Function as Objects:-

Yes, you read it right. Functions in JavaScript also are treated as objects and can be assigned to variables. Once we assign a variable with a function, we can then use the variable name to call the function.

Let’s take an example for this.

let x = function someFunction(y) {
document.write("Function called with value: " + y);
}

// we can call the function using the variable now
x(10);

Function called with value: 10