SharePointPunk
Programmer
Hey guys I am new to debugging JavaScript in firebug and am trying to do something pretty basic and getting frustrated.
here is my code that I am loading in firebug
//Code Starts
function Person(first,last,age){
this.firstname = first;
this.lastname = last;
this.age = age;
var bankBalance = 7500;
this.getBalance = function(){
return bankBalance;
};
}
var Patrick = new Person('Patrick','Smith',30);
var myBalance = Patrick.getBalance();
//Code Ends
In Firebug I am typing
console.log(myBalance);
It returns undefined, why is that?
here is my code that I am loading in firebug
//Code Starts
function Person(first,last,age){
this.firstname = first;
this.lastname = last;
this.age = age;
var bankBalance = 7500;
this.getBalance = function(){
return bankBalance;
};
}
var Patrick = new Person('Patrick','Smith',30);
var myBalance = Patrick.getBalance();
//Code Ends
In Firebug I am typing
console.log(myBalance);
It returns undefined, why is that?