如何修复此“未捕获的SyntaxError:意外的标识符”

时间:2015-10-13 01:12:57

标签: javascript

var canvasInfo;
var story;
var optionA;
var optionB;
var optionC;

function Init()
{

canvasInfo = GameEngine.GetCanvasInfo();

story = Your family has just moved, and you can not remember the way home from school. Reaching an intersection, you turn;
optionA = Left;
optionB = Right;
optionC = Straight;

}

我的chrome'Inspect Element'正在挑选一个'意外的标识符'。请帮忙!

1 个答案:

答案 0 :(得分:2)

“意外的标识符”表示代码中存在语法错误。定义字符串时需要引号。

story = "Your family has just moved, and you can not remember the way home from school. Reaching an intersection, you turn";
optionA = "Left";
optionB = "Right";
optionC = "Straight";