62
rated 0 times
[
63]
[
1]
/ answers: 1 / hits: 159529
/ 10 Years ago, wed, may 28, 2014, 12:00:00
I want to check if an array contains role
. If it does, I want to move the role
to the front of the array.
var data= [email,role,type,name];
if (role in data) data.remove(data.indexOf(role)); data.unshift(role)
data;
Here, I got the result:
[role, email, role, type, name]
How can I fix this?
More From » arrays