0
林使庫存和進出口加堆棧,但香港專業教育學院擊中一個問題查找對象指數多維數組
下面是我想對比一下什麼工作
我只是想找到對象的索引我穿過
myarray的[0] = [項目:對象,StackAmmount:INT]
var myArray:Array = new Array();
myArray[0] = ["name1",1];
myArray[1] = ["name2",1];
myArray[2] = ["name3",1];
trace("Name" , myArray[0][0]);
//traces "name1"
trace("Stack" , myArray[0][1]);
//traces "1"
trace("Index of Object" , myArray.indexOf("name2"));
//traces -1
// Not Working (NOT FOUND)
//How can I find the index of "item1" or "item2" in the above example
var myOtherArray:Array = new Array();
myOtherArray[0] = "name1";
myOtherArray[1] = "name2";
myOtherArray[2] = "name3";
trace("Name" , myOtherArray[0]);
//traces "name1"
trace("Index of Object" , myOtherArray.indexOf("name2"));
//traces 1
//Working
也許有處理堆棧的更好的辦法?
粘貼斌鏈接:http://pastebin.com/CQZWFmST