Took 3 minutes 37 seconds to code JavaScript indexOf() method. Here is the code snippet.
Code:
arr = ['1', '2', '3'];
function indexOf(arr, element) {
for (var i = 0; i < arr.length; i++) {
if (element === arr[i]) {
return i;
}
}
return -1;
}
document.write(indexOf(arr, '3'));
Result:
2
The King Casino Resort - Hertzaman
ReplyDeleteFind the ventureberg.com/ perfect place to herzamanindir.com/ stay, 토토사이트 play, apr casino and unwind at Harrah's jancasino.com Resort Southern California. Get your points now!