Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

282
Visualizações
¿Cómo determino cuándo un usuario cumplirá 18 años en JavaScript?

Tengo problemas con la tarea 9:

 // Task #7) Prompt the user for their birthday and convert it to a Date object // Remember - when prompting the user, it comes in as a string var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; var birthDate = prompt("Enter your birthdate mm/dd/yyyy"); var bd = new Date(birthDate); // Task #8) Display the date the user was born in a format that shows the day of the week, month, date, and year document.write("You were born on " + days[bd.getDay()] + ", "); document.write(months[bd.getMonth()] + " "); document.write(bd.getDate() + ", " + bd.getFullYear() + "<br>"); // Task #9) Calculate when the user turned 18 // Task #10) Display the 18th birthday in a format // that shows the day of the week, month, date, and year

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Esto debería funcionar:

 const turn18 = new Date(db.getFullYear() + 18, db.getMonth(), db.getDate())
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda