I have this question :
An Array nums is given. Per one operation you remove one number with a value of K or under K from the array. After each removal K is increased by one.
So I have this as answer
function getNumber(nums,k){
k = nums.slice(1);
let j = k++;
a = nums.push(j)
return a;
}
let arr = [1,2,3,4];
let k = 1;
console.log(getNumber(arr,k));
It does not work as expected , its supposed to remove the first number or any number in the array and add 1 , how can I do this ?