oop - Javascript: Access function within deep object on parse -
i have object
var object1 = { object2: { function1: function(a, b, c, d, e) { //do stuff parameters console.log('values ' + + ' ' + b + ' ' + c + ' ' + d); }, function2: object1.object2.function1(2, 3, 4, 5) } }
why line function2: object1.object2.function1(2, 3, 4, 5)
line throws uncaught typeerror: cannot read property 'object2' of undefined
, how can make work?
update: answer marked.
thank you
because scope in function2
defined not contain definition of object1. when try access object1.object2 throws error because object1 not defined
Comments
Post a Comment