I have a for loop within some Javascript code and can't seem to figure out why it is not executing. I have some console.log statements where I am trying to see whether the variables are capturing what I need them to. However, when I run the code, I do not see any output from my console.log commands. Is there something I am missing here? Please see the Javascript code below:
var strArry = [];
for(var i=0; i<obj[0].srcLanguageSentence.text; i++)
{
// create variables representing substrings of the Source language Sentence
var s1 = text.substring((obj[i].srcLanguageSentence.roles[i].beginOffset - obj[i].srcLanguageSentence.roles[i].beginOffset),(obj[i].srcLanguageSentence.roles[i].beginOffset - 1));
var s2 = text.substring(obj[i].srcLanguageSentence.roles[i].beginOffset,obj[i].srcLanguageSentence.roles[i].endOffset);
var s3 = text.substring(obj[i].srcLanguageSentence.roles[i].endOffset,obj[i].srcLanguageSentence.text.length);
strArry.push(s1)
strArry.push(s2)
if(i == obj[0].srcLanguageSentence.roles.length)
{
strArry.push(s3);
}
text = s3;
console.log("s1: " + s1);
console.log("s2: " + s2);
console.log("s3: " + s3);
console.log(s1+s2+s3);
}