我在下面有這段代碼。我不知道爲什麼inArray()不輸出0.任何想法?jQuery:關於inArray的問題()
var client = new Array();
function removeClient(id){
alert(id); //prints 17
alert(client); //prints 17
alert(typeof(id)); //this prints "number"
alert(typeof(client)); //this prints "object"
alert($.inArray(id, client)); //this prints "-1", why?
}
問候
哈維
你如何填充數組? – 2011-03-18 13:35:06
它的工作原理:http://jsfiddle.net/simevidas/PFU9x/ – 2011-03-18 13:39:00
或在這裏:http://jsfiddle.net/fkling/ub6xX/ – 2011-03-18 13:41:06