I have the following piece of code:
var blah = function(x, y){
var e = {
ox: x,
oy: y,
etc.
}
return e;
开发者_如何学C};
However, I am getting an error "x is undefined". I thought that x and y should be available in inner scopes. Any help/explanation would be greatly appreciated!
Works fine for me. Did you use new
and did you pass 2 params?
var blah = function(x, y){
var e = {
ox: x,
oy: y
}
return e;
};
z = new blah(1,2);
z.ox // 1
z.oy // 2
精彩评论