I'm getting an odd code syntax warning in Visual Studio, for a bit of JavaScript:
If(1==1) {
alert("!");
}
The warning is on the opening curly brace:
TS1005 (JS) ';' expected.
I tried adding a semicolon after the closing curly brace, but that didn't make a difference:
I've also determined that when this if
block is included anywhere in the script—with or without the trailing semicolon—the entire script fails to execute in the browser (Chrome, latest version).
According to W3Schools, the syntax is correct.
This seems very strange. What's going wrong here?