dabidabidesh

bomb 40->100

Jun 21st, 2020
319
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function bombNumbers(arr1, arr2) {
  2.  
  3.   let bombNumber = arr2.shift()
  4.   let range = arr2.shift();
  5.   //let bombLocation = 0;
  6.   //let bombedNumbers = [];
  7.  
  8.   for (let i = 0; i < arr1.length; i++) {
  9.     let currentNum = arr1[i]
  10.     if (currentNum == bombNumber) {
  11.       //bombLocation = i;
  12.       /* bombedNumbers.push(arr1.splice((bombLocation - range), (1 + 2 * range))); */
  13.       for (let j = i - range; j <= i + range; j++)
  14.         arr1[j] = 0
  15.  
  16.  
  17.     }
  18.   }
  19.  
  20.   let arr1Sum = 0;
  21.   for (let number of arr1) {
  22.     arr1Sum += Number(number)
  23.   }
  24.   console.log(`${arr1Sum}`)
  25. }
RAW Paste Data