سلام من این کد رو وقتی اجرا میکنم tesfuncداخل prototype مقدار نامشخص undefinde میده در حالی که تابعهای داخل ابجکتها f()رو نشون میدن اشکل کد چیه؟
function testfunc() {
console.log('hi')
}
function test (){
console.log('by...')
}
let animal = {
eats: true,
walk() {
console.log('walking ......');
},
text(){
alert('agine...')
}
};
let rabbit = {
jumb: true
}
rabbit.__proto__ = animal;
console.log(rabbit);
rabbit.walk();
function cat() {
this.eats = false;
}
cat.prototype = animal;
cat.prototype.testfunc= testfunc()
cat.prototype.test= test()
let cat1 = new cat();
console.log(cat1)