javascript array unique values
var arr = [55, 44, 65,1,2,3,3,34,5];
var unique = [...new Set(arr)]
//just var unique = new Set(arr) wont be an array
javascript array unique values
var arr = [55, 44, 65,1,2,3,3,34,5];
var unique = [...new Set(arr)]
//just var unique = new Set(arr) wont be an array
unique elements in array javascript
var array3 = [1, 2, 4, 6, 1, 4, 9, 10, 2, 8];
function findUniqueElements_3(array) {
for (let i = 0; i < array.length; i++) {
for (let j = i + 1; j < array.length; j++) {
if (array[i] == array[j]) {
array.splice(j, 1)
}
}
}
console.log(`from third way : ${array}`);
}
findUniqueElements_3(array3)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us