Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Write a function that receives a number M and a number N (M will always be bigger than N).
- // Print all numbers from M to N.
- // for loop
- function numbersMtoN(m, n) {
- for (let num = m; num >= n; num--) {
- console.log(num);
- }
- }
- // while loop
- function numbersMtoN(m, n) {
- while (m >= n) {
- console.log(m);
- m--;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment