【求助】关于对象取值问题
javascript吧
全部回复
仅看楼主
level 1
obj = {
'year' : 2021,
'month' : 5,
'firstTime' : new Date(this['year'],this['month'])
}
obj = {
'year' : 2021,
'month' : 5,
'firstTime' : new Date(2021,5)
}
这两个的firstTime输出结果不一样,不是日期不一样,而是第第一个的firsttime输出结果为invalid date
求助贴吧内的大佬,希望贴吧内的大佬能够详细的解答一下,现在这里谢过了
2021年05月15日 15点05分 1
level 1
这个this指向有问题,根本不是指向obj
2021年05月15日 16点05分 2
level 1
读到的值是undefined
2021年05月15日 16点05分 3
level 4
楼上说的对,另外,
+3
2021年05月15日 17点05分 4
level 1
代码不全,而且this不应该这么用吧
2021年05月16日 17点05分 5
1