js中怎么判斷一個字符串是一個字符串?dāng)?shù)組中的元素?
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var a = fruits.indexOf("Apple"); // 2//以上輸出結(jié)果意味著 "Apple" 元素位于數(shù)組中的第 3 個位置。
var fruits=["Banana","Orange","Apple","Mango","Banana","Orange","Apple"];
var a = fruits.indexOf("Apple",4); //6
//以上輸出結(jié)果意味在數(shù)組的第四個位置開始檢索: