i was reading in a book and here the code is
function Person(name) {
this.name = name;
}
Person.prototype.legs = 2;
var newperson = new Person("Joe"), prop;
for (prop in newperson) {
if (newperson.hasOwnProperty(prop)) {
console.log(prop + ":" + newperson[prop]);
}
}
I just want to know what is **prop* in this
var newperson = new Person("Joe"), prop;
It is not a argument for sure so what does prop mean here. is it an optional value? thanks
, prop;is just the definition of the variableprop