JavaScript program to print Present Month


Below program shows you how to print Current Month.
We can get Current Month using new Date().getMonth() in JavaScript.

function getMonth() {
  const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; 

  var month = new Date().getMonth();
  var currentMonth = "The current month is " + monthNames[month];
  console.log(currentMonth);
}

getMonth();

Output:

 The current month is July

Try it Online here https://onecompiler.com/javascript/3x5qba3f6