Need help with array


Ok what I after is how to “+” 1 for duplicate elements in array …let’s say I just push the value in array like this…

someArr = [one,two,three,four];

so next time I want to push the same name elements eg; “one”…so how to make so that the code can check for any existing file name then it found the duplicate name it will plus “1” to make it different…so the final value in array will be like this…

someArr = [one,two,three,four,one1];

so next time the code will stil check for duplicate name…maybe I wil have the value in array liek this…

someArr = [one,two,three,four,one1,one2,two1,three1];

it is because later on i want to remove some value from this array…so far what I have is it not checking for duplicate…so when I’m delete soem value in array it will delete all the same name…eventhough I want to delete one elements only…here;s what I have so far

//define empty array
var myArray =  [];

//push value into array
addbtn.onPress = function(){
    input_txt.text = "";
    output_txt.text = myArray;
//delete value in array

delbtn.onPress = function(){
    for(var i = 0;i<myArray.length;i++){
        if(input_txt2.text == myArray*){
            myArray = myArray.remove(myArray*);
            output_txt2.text = myArray;

Array.prototype.remove = function(obj) {
  var a = [];
  for (var i=0; i<this.length; i++) {
    if (this* != obj) {
  return a;

u can try it here…

the fla’s

I’m really need help with it…any help would be appreciate…


thanks for the reply guys…Macaroni Ted and Stringy…

nice code there…it works like a charm now…

thanks again…:beer: