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 {
  ..
}

```
You haven't got an Arrray there, just a string where you concatenate a new value on.

However you could still use `.includes()` [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes)

A better option would be to use an array and see if the value your attempting to add exists in it.

So change:

`var tag_array = ""` to `var tag_array = [];`

and

`tag_array = tag_array+tag+", ";` to `tag_array.push(tag)`;

Then you can do `tag_array.includes(tag)` to see if the tag exists in the array. However i would suggest doing that check before you insert the value into the array or it will always be true. [docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes)

If later you need a comma separated string of tags you can do 

`tag_array.join(', ');`