'How do i make a number in An array increase by 1

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 ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source