I have been working on a code snippet to filter out numeric values from an array, but instead of getting only the numbers, I am receiving the complete array. I am unable to identify where the issue lies in my code. Can someone please assist me as I am currently stuck and need help with this...
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML Demo</title>
</head>
<body>
<script>
arr = ["apple", 5, "Mango", 6];
function filterNumeric(arrayName){
var i = 0;
var numericArray=[];
for (i; i <arrayName.length;i++){
if (typeof(arrayName[i] === 'number')) {
numericArray+=arrayName[i];
}
}
return numericArray;
}
var filter = filterNumeric(arr);
alert(filter);
</script>
</body>
</html>