how to get month name in month function in javascript code example

Example 1: javascript month name

let date = new Date(2020, 05, 21); // 2020-06-21
let longMonth = date.toLocaleString('en-us', { month: 'long' }); /* June */
let shortMonth = date.toLocaleString('en-us', { month: 'short' }); /* Jun */
let narrowMonth = date.toLocaleString('en-us', { month: 'narrow' }); /* J */

Example 2: how to write a program that alerts the current month in words in javascript

var currentDate = new Date();
currentDate.toString;
var b = currentDate.toString();
var c = b.slice(4,7);
if (c === "Jan"){
    document.write("Current month: January")
}else if(c === "Feb"){
    document.write("Current month: February")
}else if(c === "Mar"){
    document.write("Current month: March")
}else if(c === "Apr"){
    document.write("Current month: April")
}else if(c === "May"){
    document.write("Current month: May")
}else if(c === "Jun"){
    document.write("Current month: June")
}else if(c === "Jul"){
    document.write("Current month: July")
}else if(c === "Aug"){
    document.write("Current month: August")
}else if(c === "Sep"){
    document.write("Current month: September")
}else if(c === "Oct"){
    document.write("Current month: October")
}else if(c === "Nov"){
    document.write("Current month: November")
}else if(c === "Dec"){
    document.write("Current month: December")
}