Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

82
Views
No se puede acceder al "audio" antes de la inicialización en el problema js en la línea 2

Hice un reloj y una alarma hace un tiempo y tal vez iba a agregar algunos más y ahora el reloj ya no se muestra. Problema posiblemente alrededor de la línea 2 (Aprender a codificar, sé que probablemente sea algo simple) El código de error que recibo es solo la inicialización del audio que dice que no puede acceder a pesar de que está en el mismo archivo

 ''' const display = document.getElementById('clock'); const audio = new audio('finAlarm.wav'); audio.loop = true; let alarmTime = null; let alarmTimeout = null; function updateTime() { const date = new Date(); const hour = formatTime(date.getHours()); const minutes = formatTime(date.getMinutes()); const seconds = formatTime(date.getSeconds()); display.innerText=`${hour} : ${minutes} : ${seconds}` } function formatTime(time) { if ( time < 10 ) { return '0' + time; } return time; } function setAlarmTime(value) { alarmTime = value; } function setAlarm() { if(alarmTime) { const current = new Date(); const timeToAlarm = new Date(alarmTime); if (timeToAlarm > current) { const timeout = timeToAlarm.getTime() - current.getTime(); alarmTimeout = setTimeout(() => audio.play(), timeout); alert('Alarm set'); } } } function clearAlarm() { var name = prompt("are you up?>:)") if (name ==null || name=="") { txt = "incorrect >:(|)" } else { audio.pause(); audio.currentTime = 0; alert('Alarm Stopped') } alert(txt); audio.pause(); audio.currentTime = 0; if (alarmTimeout) { clearTimeout(alarmTimeout); alert('Alarm Stopped'); } } setInterval(updateTime, 1000); '''
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!