Skip to content Skip to sidebar Skip to footer

Missing ; After For-loop Initializer

var nodeWordsString = document.getElementById('nodeWordsTextArea').value.trim(); var nodeWordsStringArray=nodeWordsString.split(' '); var strLength = nodeWordsStringArray.l

Solution 1:

This is , but you're using int in your loop declaration? Try replacing those with var instead.

Solution 2:

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.

Solution 3:

Change int i and int j to var i and var j.

Solution 4:

If you are here in 2016, maybe you are trying to use a let declaration outside strict mode in a browser that does not yet support it. Replace it with var or add 'use strict;' to the top of your function.

Solution 5:

var strLength = nodeWordsStringArray.length;
for(int i = 0; i < nodeWordsStringArray.length; i++)

You can use for (int i = 0; i < strLength; i++) it is more efficient. As for your actual error try moving your brackets to the end of your for line. for(..;..;..) {

P.S. as mentioned there is no int.

Post a Comment for "Missing ; After For-loop Initializer"