Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the JavaScript function as a value

Shulou Source: shulou.com Published: 2022-06-01 10:31:05 10月16日 Update

This article mainly introduces the JavaScript function as a value to use the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, with a certain reference value, I believe you will have a harvest after reading this JavaScript function as a value of the article, let's take a look at it.

The JavaScript function is used as a value:

Case study

Function myFunction (a _ r _ b) {

Return aquib

}

Var x=myFunction (4pr 3)

The JavaScript function can be used as an expression:

Case study

Function myFunction (a _ r _ b) {

Return aquib

}

Var x=myFunction (4p3) * 2

A function is an object

Determining the function type using the typeof operator in JavaScript returns "function".

But the JavaScript function is more accurately described as an object.

JavaScript functions have properties and methods.

The arguments.length property returns the number of parameters received by the function call:

Case study

Function myFunction (a _ r _ b) {

Return arguments.length

}

The toString () method returns the function as a string:

Case study

Function myFunction (a _ r _ b) {

Return aquib

}

Var txt=myFunction.toString ()

This is the end of the article on "how the JavaScript function is used as a value". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to use the JavaScript function as a value". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Function instance knowledge content object property method article number value parameter character string operator easy to operate article easy to understand more see type Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Xiaomi Docker macOS vpn