var x = "window.Something";
alert(window.x)
when i try this code in jsfiddle http://jsfiddle.net/XJEGU/, it alerts undefined. While when i run this code in my browser, it works fine, can anybody tell what jsfiddle does with this code for such behavior.
JSFiddle wraps code in a function. This means that
x
is scoped locally to that function.If you are trying to embed a variable to the window. You can use this http://jsfiddle.net/XJEGU/3/