javascript - Using constructors inside jQuery ready / Chrome developer tools -
i have simple little script
$(document).ready(function () { person = function (firstname, lastname) { this.firstname = firstname; this.lastname = lastname; } var person = new person('john', 'doe'); console.log(person.firstname); });
this prints screen should. can't, though, explore attributes of person
variable. if have javascript inside of jquery ready function , type person
console uncaughtreferenceerror. if remove jquery , use straight javascript, works , can see methods , properties of object. why this?
Comments
Post a Comment