Basic Object Structure and Calling for JavaScript -


this question has answer here:

i'm trying simple. is, create object function can call somewhere else. must missing something. code i'm trying right is:

function object1() {     function function1() {         alert("hello");     } }   object1.function1(); 

you can this:

class1 = function () {     this.function1 = function() {         alert("hello");     } }  var object1 = new class1() object1.function1();