Nicolasc546565ds46 0 Report post Posted January 22, 2022 sabem me dizer pq o switch case nao ta funcionando? obrigado desde jávar dia = new Date(); var diasem = dia.getDay; console.log(diasem); switch (diasem) { case 0: console.log = ("Domingo"); break; case 1: console.log = ("Segunda"); break; case 2: console.log = ("Terça"); break; case 3: console.log = ("Quarta"); break; case 4: console.log = ("Quinta"); break; case 5: console.log = ('Sexta'); break; case 6: console.log = ("Sabado"); break; default: console.log("[ERRO] Numero invalido"); break; } Share this post Link to post Share on other sites
Guilherme Luiz 41 Report post Posted February 14, 2022 Porque o getDay é um metodo de função. let day = new Date(); console.log(day.getDay()); //Output - (int) 1 (segunda-feira) Share this post Link to post Share on other sites
washalbano 54 Report post Posted February 14, 2022 dia.toLocaleDateString("pt-br", {weekday: "long"}) Share this post Link to post Share on other sites