Advertisement
kstoyanov

02. Print every N-th Element from an Array v2

Sep 18th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(args) {
  2.   const step = Number(args.pop());
  3.  
  4.   const arrResult = args.filter((_, index) => index % step === 0);
  5.  
  6.   console.log(arrResult.join('\n'));
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement