The code below is almost identical to some of the code from Douglas Crockford's book: “Good Details,” pp. 29-30. The only difference is that it adds the get_status property as follows:
Quo.prototype.get_status=function() {
this.status=string;
}
My question is why its code is working fine, but my small change below leads to an error that says myQuo does not have a get_status method?
<script>
var Quo=function(string) {
this.status=string;
}
Quo.get_status=function() {
return this.status;
}
var myQuo=new Quo("confused");
alert(myQuo.get_status());
</script>
source
share