Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // While loop
- function numbersNto1(input) {
- let currentNum = Number(input);
- while (currentNum >= 1) {
- console.log(currentNum);
- currentNum--;
- }
- }
- // For Loop
- function numbersNto1(input) {
- let currentNum = Number(input);
- for (let num = currentNum; num >= 1; num--){
- console.log(num);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment