JavaScript Function toString() method

The JavaScript Function toString() method returns a string. Here, string represents the source code of the function.

Syntax

Return Value

It returns a string.

JavaScript Function toString() method Example

Example 1

Let's see an example to display a function in the form of string.

Test it Now

Output:

"function add(a,b) { return a + b; }" "string"

Example 2

Let's see an example to display the addition of numbers in the form of string.

Test it Now

Output:

30 string

Example 3

Let's see an example to display the ceil value of the given numbers in the form of string.

Test it Now

Output:

16 string





Latest Courses