Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(num, arr) {
- let print = "";
- for (let i = num - 1; i >= 0; i--){
- print += `${arr[i]} `;
- }
- console.log(print);
- }
- Решение със slice(), reverse() и join():
- function solve(num, arr) {
- let reverseArr = arr.slice(0, num).reverse();
- console.log(reverseArr.join(' '));
- }
- Или тарикатската:)
- function solve(num, arr) {
- console.log(arr.slice(0, num).reverse().join(' '));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement