0

I need help for this javascript question.. Plzzz

Find the output of the following JavaScript code snippets. i. var str = "Please locate 'locate' occurs!"; var pos = str.lastIndexOf("locate"); ii. var str = "Please locate 'locate' occurs!"; var pos = str.search("locate"); iii. var str = "Apple, Banana"; var res = str.substr(-4); iv. var fruits = ["Banana", "Orange", "Apple"]; document.getElementById("demo").innerHTML = fruits.join(",");

16th Nov 2021, 9:57 AM
ferdous Riaz
ferdous Riaz - avatar
4 Respostas
+ 1
Do yourself in javascript playground
16th Nov 2021, 10:08 AM
Sâñtôsh
Sâñtôsh - avatar
+ 1
So what's the problem?
16th Nov 2021, 10:23 AM
Solo
Solo - avatar
+ 1
Show what exactly you tried, since all the examples given work. You wrote in html: <div id="demo"></div>?
16th Nov 2021, 10:34 AM
Solo
Solo - avatar
0
Says, Find the output.. I tried them in the editor but showed no output whatsoever & Error.. I am new at this but i dont know what's wrong..
16th Nov 2021, 10:26 AM
ferdous Riaz
ferdous Riaz - avatar