Skip to content Skip to sidebar Skip to footer

How To Initialize A Class Object In Javascript

I have a Javascript class say 'myjavascript.js'. I have the following class: var myClass= function () { this.property2 = ''; this.property3 = ''; this.prope

Solution 1:

this.say() is the error. You are calling the function, not defining it.

 this.say = function () {
            alert('Say Hello');
        }

Post a Comment for "How To Initialize A Class Object In Javascript"