Could someone explain me how this code works line to line? Thanks. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Could someone explain me how this code works line to line? Thanks.

How many elements will be pushed to the array res? var str='I love JS!', j=0, res=[]; while ((j=str.indexOf(",j+1))>0){ res.push(j+1); }

27th Apr 2018, 11:59 AM
Rastislav Romanec
Rastislav Romanec - avatar
1 Answer
+ 1
The answer in the js challenge is two,your question is wrong,since its been a long while i challenged, i need the correct question to explain this
27th Apr 2018, 12:19 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar