Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function printNthElement(arr) {
- let result = [];
- let step = Number(arr[arr.length - 1]);
- for (let i = 0; i < arr.length - 1; i += step) {
- result.push(arr[i])
- }
- console.log(result.join(' '));
- }
Advertisement
Add Comment
Please, Sign In to add comment