Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(list, num) {
- let counter = 0;
- let current_list = [];
- while (true) {
- if (counter >= list.length) {
- break
- }
- current_list.push(list[counter]);
- counter += num;
- }
- console.log(current_list);
- }
- solve(['5', '20', '31', '4', '20'], 2)
- solve(['dsa', 'asd', 'test', 'tset'], 2)
- solve(['1', '2', '3', '4', '5'], 6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement