JavaScript Function - toString()
JavaScript Function toString() method
Last Updated : 17 Mar 2025
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.
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.
Output:
Example 3
Let's see an example to display the ceil value of the given numbers in the form of string.
Output:
Related Posts
Subscribe to Tpoint Tech
We request you to subscribe our newsletter for upcoming updates.