I'm a begginer at Javascript and programming in general, my english is not good(sorry if there's any grammar error) but this is my problem:
When I create a class in JS and I create a function to set an attribute of its objects, the browser does not recognise the function. example:
var myObject = new MyClass();
myObject.setAttribute();
function MyClass() {
this.attribute;
}
MyClass.prototype.setAttribute = function() {
this.attribute = true;
};
When I try to run this code chrome throws an error saying "Uncaught TypeError: Object # has no method 'setAtributte' " and the specified line is 2. I don't get it.
I repeat: i'm a begginer so this may look like a silly error to you, but it's quite a big problem for me. thanks.