function Person(_name, _id, _salary){
this.Name = _name;
this.Id = _id;
this.Salary = _salary;
}
Person.prototype.f_IncreaseSalary = function( _percentage ){
this.Salary *= _percentage;
}
var per = new Person("cem",10,15000);
1)我可以访问,per.f_IncreaseSalary(0.2)
但如果我从 JSON 字符串创建这个对象,我如何访问 f_IncreaseSalary 函数?
var sPer = {"Person" : {"Name":"Cem", "Id":10, "Salary":15000} };
sPer.f_IncreaseSalary(0.2); // it won't!
2)如何创建具有 Person 类功能的 sPer 对象?
3)我怎么能理解sPer
有f_IncreaseSalary
功能?