0
<html> <script> var string = "I love Sololearn!"; var search = string.search("Sololearn"); alert(search); </script> </html>
Please help me out with the output of this code and explain to me how it works
3 odpowiedzi
+ 2
it's just searching the sololearn in the string which is situated at 8 position so after 7 the search is match so alert is displayed 7 as output
+ 3
output will be 7, it returns the position (index) of the first letter of that word (sololearn)
+ 1
Thanks a lot for the answers,
I now understood it