I want the function to return all 3-digit integers to the front of the array. When I console log this, I get 8 arrays, none of which is the output I'm looking for. I suspect the error starts when I begin using for ().
Also, any tips on how to further clean up the code is appreciated as I am learning best practices as I go.
let numList = [1, 324,34, 3434, 304, 2929, 23, 444]
function checkLength (num){
num.forEach(function (n){
var stringLength = n.toString().length; //n = 324, 204, 444
for (i=0; i<num.length; i++){
if (stringLength == 3){
let a = num.splice (i,1);
num.unshift (a[0]);
}
}
})
console.log(num);
}
checkLength(numList);