1 Example(s) of JavaScript uneval function


Description :

This function is not supported by all the browser and its behavior may change in future. uneval() function creates a string representation of the source code of an Object. In uneval, we can pass java-script code as well but try to avoid this as much as possible.


JavaScript uneval function Example - 1
<!DOCTYPE html>
<html>
<head>
<title>Welcome to LearnKode - A code learning platform</title>
</head>
<body>
<button onclick="unevaluateCode()">Unevaluate code</button>
<p id="sample"></p>
<script>
function unevaluateCode() {
    var x = 20;
    var y = "30";
    var a = uneval(x) + "<br>";
    var b = uneval(y) + "<br>";
   
    var result = a + b;
    document.getElementById("sample").innerHTML = result;
}
</script>
</body>
</html>

Output