JSFiddle - React, Tailwind, and code Playground
JavaScript
function testIndexOfString() {
var string = "This is a test string";
alert("Index of the string is " + string.indexOf("a"));
}
function testIndexOfArray() {
var arr = [1, 2, 4, 2, "abc", "def"];
alert("Index of the array is " + arr.indexOf("abc"));
}
testIndexOfString();
testIndexOfArray();