SyntaxError: Unexpected token else

So, uh. I do not get why I am getting this error. If / Else has always worked until now. on('chat:message', function(msg)  {     if (msg.type != 'api') return;     var parts = msg.content.split(' ');     var command = parts.shift().substring(1);     if (command == 'test')      {         var selectedId = parts[0];         var selectedToken = getObj('graphic', selectedId);         //Get the Name of tokens         var whoName = selectedToken.get('name');         var who = getObj('character', selectedToken.get('represents'));            if (!who)             {                 who = selectedToken.get('name');             }         if (getAttrByName(whoTarg.id, 'main_foc'.checked) = 'true');             {                 sendChat("Focus is checked");             }         else             {                 sendChat("Focus is not checked");             }     } });
1506243114
Jakob
Pro
Sheet Author
API Scripter
There's an extra semicolon on line 17. In general, it's a good idea to put your code into an external syntax validator ... the first web-based one google gives me is  http://esprima.org/demo/validate.html . It will give a more useful error message (+ line number) than Roll20.
Thanks that helps.
1506283612
Scott C.
Pro
API Scripter
I also like the google closure compiler: https://closure-compiler.appspot.com/home
1506362634
Brian
Pro
Sheet Author
API Scripter
Jakob said: There's an extra semicolon on line 17. In general, it's a good idea to put your code into an external syntax validator ... the first web-based one google gives me is  http://esprima.org/demo/validate.html . It will give a more useful error message (+ line number) than Roll20. To be fair, lines 1-21 are all syntactically valid, and the site you linked to gives the same error as Roll20. =) @Michael P: also, I would point out that the first parameter to sendChat is the name of the "person" sending the message, not the message itself. Line 17 also has a problem of using assignment (getAttrByName(...) = 'true') instead of equality (== or ===). In that line, you're also attempting to get the "checked" property of the string 'main_foc', which will be undefined.