This is the line which works perfectly fine.
'some words'.split(/,*/);
But when I do a block comment as show below, I get a syntax error.
/* 'some words'.split(/,*/); */
Couldn't find about this behaviour anywhere. Not sure if this is a know bug in the language.
The
*/in your regex gets parsed as the end of the comment, which is causing the syntax error.Can you use a single-line comment instead?