Here is the code snippet I've put together
function findValueInArray(value, array) {
var result = false;
for (var i = 0; i < array.length; i++) {
if (array[i] === value) {
result = true;
}
}
return result;
}
function removeDuplicates(array2) {
var uniqueArray = [];
for (var i = 0; i < array2.length; i++) {
var val = array2[i];
if (!findValueInArray(val, uniqueArray)) {
uniqueArray.push(val);
}
}
console.log(uniqueArray);
}
However, upon executing this piece of code, it results in freezing the browser. What could potentially be causing this issue?