Friday, October 24, 2025
HomeLanguagesJavascriptJavaScript uneval() Function

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(function func() { return 'Geeksforneveropen'; });
let func1 = eval(obj);
console.log(func1());


Output:

neveropen

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.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS