Reputation: 23
var Test = {
Hoi : {
test: function(e) {
console.log(e);
}
},
c: function(e) {
console.log(e);
}
};
Test.c("hey 1");
Test.Hoi.c("hey 2");
I've doing some classes exercising, but I can't manage to put subclasses into a main class.
Upvotes: 0
Views: 345
Reputation: 18022
Test.Hoi.c
doesn't exist; Test.Hoi.test
does
use:
Test.Hoi.test("hey 2");
each dot basically digs a step deeper into the structure of the object.
Upvotes: 3
Reputation: 7004
You must create the c
method.
...
Hoi : {
test: function(e) {
console.log(e);
},
c: function(e) {
console.log(e)
}
}
...
Test.Hoi.c("hey 2");
Upvotes: 0