function that matches the selected string from an array. A good utility function to have.
hello everyone, i wrote small function loops through array (in case, lets call fullarray), , matches chosen string copies array called "yesarray", , copies unmatched elements of 'fullarray' third array called "noarray". pretty original array used reference. function works expected, however, wonder if have taken long way write it? please share thoughts on it. lot. var fullarray:array = ["one","two","three","four","five","six","seven","eight"]; var yesarray:array = []; var noarray:array = []; var ans:string = "three"; checkanswer(ans); function checkanswer(s:string):void { var ele:int = (fullarray.indexof(s)); var isfound:boolean = (fullarray.indexof(s))? true : false; if(isfound) { if(yesarray.length > 0) { for(var i:int=0; i<yesarray.length;i++) { yesarray.splice(yesarray[i]);