var nodeWordsString = document.getElementById(\"nodeWordsTextArea\").value.trim();
var nodeWordsStringArray=nodeWordsString.split(\" \");
var strLength = nodeWor
This is javascript, but you're using int in your loop declaration? Try replacing those with var instead.
In my case, the error was caused by using let in the loop. Old browsers like Firefox 38 doesn't support let.
Replacing let by var solved the issue.
Change int i and int j to var i and var j.