Please Help me understand this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please Help me understand this code

I am learning JavaScript as a beginner. I tried a lot to understand how actually the the result comes 7?? https://code.sololearn.com/WwENJ0HVvgi6/?ref=app

1st Jun 2020, 3:23 AM
Ajmain Adil Sourov
Ajmain Adil Sourov - avatar
5 Answers
+ 10
The search syntax secahe for index and sololearn start with the 7 index so it sayd 7
1st Jun 2020, 10:58 AM
Coder
Coder - avatar
+ 5
SOUPTIK NATH Both returns same value but you cannot take Regular Expression as an input for search in indexOf function.
1st Jun 2020, 5:34 AM
A͢J
A͢J - avatar
+ 1
Tom Joney (TheCoder) What is the difference between string search and index of?
1st Jun 2020, 5:00 AM
Souptik Nath
Souptik Nath - avatar
0
Thanks mate. I got my answer. It's search () method which search "sololearn" string number. 'Sololearn' was on 7th string. That's why the result is 7.
1st Jun 2020, 5:09 AM
Ajmain Adil Sourov
Ajmain Adil Sourov - avatar
0
can anyone help me with that, please? I want to get the Id text just if the condition is true but it's viewed in all the conditions https://code.sololearn.com/W7HsGLECMR0Z/#
3rd Jun 2020, 12:47 AM
Feres Daghrour
Feres Daghrour - avatar