Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

add one to array with for each

const addOne = (arr) => {
  // Solution code here...
  let x =[] ;
  arr.forEach(e=> {
    let NewEle =arr[e-1] +1 ;
    if(arr[e-1] !== 0){
      x.push(NewEle);
    }

  });
  return x ;
};
 
PREVIOUS NEXT
Tagged: #add #array
ADD COMMENT
Topic
Name
1+3 =