JavaScript uneval() Function

The uneval() is an inbuilt function in Javascript that is used to create a string representation of the source code of an Object.
Syntax:
uneval(object)
Note: This function has been DEPRECATED and is no longer recommended.
Parameters: It accepts an object which may be a JavaScript expression or statement.
Return Value: It returns a string that represents the source code of the given Object.
JavaScript examples to show the working of this function:
Example 1: If the number is passed to the function uneval() then the function will return a string with the value of the object passed.
javascript
| let obj = 2; console.log(eval(obj)); | 
Output:
2
Example 2: If the char is passed to the function uneval() then the function will return a string with the value of the object passed.
javascript
| let obj = '2'; console.log(uneval(obj)); | 
Output:
"2"
Example 3: If the number is passed to the function uneval() then the function will return a string with the value of the object passed.
javascript
| let obj = uneval(functionfunc() { return'Geeksforzambiatek'; }); let func1 = eval(obj); console.log(func1()); | 
Output:
zambiatek
Difference between eval() and uneval() functions: The uneval() function returns the source of a given object whereas the eval() function evaluates that source code in a different memory area.
Note: Above codes will run only in the Firefox web browser.
 
				 
					


