Javascript Program To Print Numbers From 0 to 50

Spread the love

This is a simple Javascript function to print numbers from 0 to 50. I am going to use arrow function to print the values.

const print = (number) => {
  for(let i=0;i<=number;i++) {
     console.log(i); //or
     document.write(i) //you can use if you want to print in broswer
  }
}

You can call this print method by passing any number as parameter / arguement.

e.g : print(50);

Happy Coding!

Leave a Comment