Originally reported here: Why is my jsfiddle Javascript class not defined?
However, upon my implementation, I'm seeing similar behavior but none of the answers appear to apply.
foo();
baz = new bar();
baz.getMessage();
function foo() {
$('#foo').html("I am foo.");
}
function bar() {
this.message = "I am bar.";
}
bar.prototype = {
getMessage: function() {
$('#bar').html(this.message);
}
};
Fiddle located at: http://ift.tt/1MjYBfM
Firebug reporting: "TypeError: baz.getMessage is not a function."
Aucun commentaire:
Enregistrer un commentaire