FL
Size: a a a
FL
KN
.name "класса" будет кривойKN
I
var User = (function() {
function User () {
this.name = 'Vasya';
}
User.prototype.getName = function() {
return this.name;
};
return User;
})();FL
var User = function(){
var BaseUser = function() {
this.name = 'Vasya';
}
BaseUser.prototype.getName = function() {
return this.name;
}
return new BaseUser();
} ()FL
S
FL
FL
KN
var u = new User();что будет?
console.log(u.constructor.name);
FL
var u = new User();что будет?
console.log(u.constructor.name);
KN
FL
KN
FL
u.constructor.name, а user.constructor.nameKN
FL
var User = function(){
var BaseUser = function() {
this.name = 'Vasya';
}
BaseUser.prototype.getName = function() {
return this.name;
}
return new BaseUser();
}
var u = new User();
console.log(u.constructor.name);KN