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: 
The following code will do the job!

```js
var tag_count = 0;
   var tag_array = [];
   $("#tag_name").click(function(){
      var tag = ""+$("#tag_name").val();
       if(!tag == ""){
        if(tag_array.indexOf(tag) < 0){
         tag_array.push(tag);
         tag_count = tag_count+1;
         console.log(tag_array);
            if(tag_count != 11){
               $(".tags").append("<div style=\"margin: 5px;\" class=\"tag\"><p>"+tag+"</p><a href=\"#\">x</a></div>");
            } else {
               $(".tags").append("<div style=\"margin: 5px;\" class=\"tag\"><p>15 tags already selected!</p><a href=\"#\">x</a></div>");
               $("#tag_name").attr("disabled","disabled");
            }
         }else{
              console.log("Alredy Tagged - "+tag);
            }
      }
   });
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select multiple="multiple" size="10" id="tag_name">
   <option>apple</option>
   <option>pear</option>
   <option>pineapple</option>
   <option>peach</option>
   <option>strawberry</option>
   <option>raspberry</option>
   <option>cherry</option>
   <option>watermelon</option>
   <option>orange</option>
   <option>banana</option>
   <option>grape</option>
   <option>honeydew</option>
   <option>apricot</option>
</select>
```
```
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])`)