嘿,我现在正在尝试使用 TwilioQuest 学习 JavaScript,但我遇到了似乎无法解决的问题。我正在尝试更正错误“SyntaxError: Unexpected Identifier”。当我尝试运行这段代码时,我得到了。Function getLaserSetting(magicWord) { if (magicWord === 'please') { return 'OFF'; } else { Return 'ON'; }}const currentSetting = get LaserSetting('please');console.log('The current laser setting is' + currentSetting);原始代码是:function getLaserSetting(magicWord) { if (magicWord === 'the magic word here') { return 'what should this be?'; } else { return 'ON'; }}const currentSetting = getLaserSetting('right now!');console.log('The current laser setting is: ' + currentSetting);
1 回答

隔江千里
TA贡献1906条经验 获得超10个赞
Function
必须从小写字母Return
开始,必须从小写字母开始,变量名get LaserSetting
不能有空格。
所以,Function -> function,Return -> return,get LaserSetting -> getLaserSetting。
添加回答
举报
0/150
提交
取消