Hello Reader's, If you have an array having the multiple duplicate key values then by using Javascript you can make them skip.
Let's see the example below:-
Lets say an array full of duplicate data.
var axes2=[1,4,5,2,3,1,2,3,4,5,1,3,4];
var distinct_axes2=[];
for(var i=0;i<axes2.length;i++)
{
var str=axes2[i];
if(distinct_axes2.indexOf(str)==-1)
{
distinct_axes2.push(str);
}
}
console.log("distinct_axes2 : "+distinct_axes2); // distinct_axes2
Output:-
1,4,5,2,3
Now you can see every value is coming single time.
0 Comment(s)