dasauser

Untitled

Sep 16th, 2020
950
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function checkElements(array, step) {
  2.   let stepped_value = 0, null_elements = [];
  3.   while (stepped_value !== array[array.length - 1]) {
  4.     stepped_value = stepped_value + step;
  5.     if (!array.includes(stepped_value)) {
  6.       null_elements.push(stepped_value);
  7.     }
  8.   }
  9.   return null_elements;
  10. }
  11.  
  12. console.log(checkElements([2,4,8,24], 2));
RAW Paste Data