var array = [2, 5, 9]; var index = array.indexOf(2); // index is 0 index = array.indexOf(7); // index is -1
返回 :Javascript 1.6 数组新增方法介绍之 indexOf()