提问人:Hello 提问时间:8/15/2022 最后编辑:Hello 更新时间:8/15/2022 访问量:36
将“this”传递给原型函数嵌套函数
Passing 'this' to prototype function nested function
问:
传递“this.dayNames”并在嵌套函数 (createCalendar()) 中使用它的最佳样式是什么?
function DateNames()
{
this.dayNames = ["Su", "M", "T", "W", "Th", "F", "S"];
}
DateNames.prototype.render = function(date)
{
console.log(date);
createCalendar()
function createCalendar()
{
console.log(this.dayNames);
}
}
答: 暂无答案
评论
this
createCalendar