+ 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 Antwort
+ 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
᠌᠌Code X
᠌᠌Code X - avatar