remove element logic in js

Hi, I written the code in JS

I used below logic to remove the element fro array and in concole output is coming properly but its not accepting anf showing blank array as my output

var count = 0
for(var i =0; i < nums.length; i++){
if(nums[i] == val){
nums.splice(i, 1);
count++;
}
}

Do i need to follow some code standard while returning ?

Comments (2)