SyntaxError: missing ; Problem record of before statement

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

When writing a JavaScript demo today, I defined a variable. The specific code is as follows:

window.onload = function(){
var panel = document.getElementById(‘panel’);
var right = document.createElement(‘div’);
var bottom = document.createElement(‘div’);
var rg-bom = document.createElement(‘div’);
right.className = ‘right’;
bottom.className = ‘bottom’;
rg-bom.className = ‘rg-bom’;
panel.appendChild(right);
panel.appendChild(bottom);
panel.appendChild(rb-bom);
};

When running, it can’t pass, and prompt in firebug: syntax error: missing; Baidu has no clue about this mistake. It’s all loose. After checking several errors, I didn’t find them. I feel that my code is very correct. After finding the positioning line and changing the RG BOM variable to RG, there is no such error. The original problem is here

It seems that when you define variables in JavaScript, you can’t define them with – lines. Then I changed – lines to ﹣ lines, That’s RG_ BOM, the result is also compiled and passed, which shows that there is a problem with the definition of variables

At this time, I thought of a knowledge point, that is, the problem of identifier in JavaScript, that is, only numbers, letters, $, and underscores, so it is. It seems that my foundation is still too weak. Take this to record the error. In fact, this error is usually caused by a basic grammar problem. If you check it carefully, OK
will happen

Similar Posts: