Tuesday, April 10, 2012

Why eval is not working in this snippet?

I would like to know whats wrong with following JavaScript code -



<html>
<script type="text/javascript">

var p = eval('new { "Color":"Red"}');

alert(p.Color);
</script>
</html>


It is giving me JavaScript error as -



Message: Object doesn't support this action
Line: 4
Char: 1
Code: 0
URI: file:///C:/Users/276822/Desktop/b.html




No comments:

Post a Comment