How to prevent adding duplicate values to a javascript array

Actually i want to do .prevent adding duplicate values to a array.

I’m using this below code.


   for(let i =0;i<this.mydata.length;i++){
        if(this.brandName.indexOf(this.brandName) == -1) {
           this.brandName.push(this.mydata[i]);
           }    
        }

please help anyone

Duplicate: How to remove duplicate value from an array