Question: i am used in Angular and Nativescript. I would like to try Typescript only template for nativescript (tns create myApp --template tsc)... but i need to have a shared Service as i would in Angular... can this be done in Vanilla typescript Nativescript ?

Thanks in advance

Answer: 
How about `String.indexOf()`?

```
if (tag_count != 11 && -1 === tag_array.indexOf(tag)) {
  tag_array += tag + ", ";
  tag_count = ++;
  $(".tags").append("<div style=\"margin: 5px;\" class=\"tag\"><p>" + tag + "</p><a href=\"#\">x</a></div>");
} else {
  ..
}

```
```
for(i = 0; i< MyArray.length(); i++){
    for(j = 0; j< MyArray.length(); j++){
        if (i != j){
            if(new String(MyArray[i]).valueOf() == new String(MyArray[j]).valueOf()){
                return i;
            }
        }
    }
}

```

If you know they are strings, then there's no need to check for type.(`MyArray[i]) == MyArray[j])`)