JSFiddle - React, Tailwind, and code Playground

by Galo Aragoneses

JavaScript

var getMonth = (function() {
    var months = [
        "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio",
        "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];
 
    return function(n) {
        if (n < 1 || n > 12)
            throw new RangeError("Mes incorrecto");
        return months[n-1];
    };
 
}()); //end IIFE
 
alert( getMonth(12) );