In the following code snippet how can we refer the global variable x
values as product
in the eval function
<script type="text/javascript">
var x = 'product';
window.onload = function() {
function somefunction() {
var x = 'boat';
alert(eval('x'));
}
somefunction();
};