unction HelloFunc() {
this.greeting =" hello";
}
HelloFunc.prototype.call = function(func) {
func ? func(this.greeting) : this.func(this.greeting);
}
var userFunc = function(greeting) {
console.log(greeting);
}
var objHello = new HelloFunc();
objHello.func = userFunc;
objHello.call();
function saySomething(obj, methodName, name) {
return(function(greeting) {
return obj[methodName](greeting, name);
});
}
function newObj(obj, name) {
obj.func = saySomething(this,"who",name);
return obj;
}
newObj.prototype.who = function(greeting, name) {
console.log(greeting + "" + (name||"everyone"));
}
var obj1 = new newObj(objHello,"zzoon");
obj1.call();
이걸 입문자가 어케해;
댓글 안달리는거보니까 프갤 허수들 기본서 수준에서 끙끙대는 모습 눈에 훤하농
게다가 너무 옛날 코드, 누가 요즘 저렇게 코딩하냐 언어 레벨 올라간지가 언젠데...
저거 바닐라 아님?