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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -