Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

177
Vistas
How to Replace Const With Other Valua In Java Script

i have Constanta In Javascript , i want to replace This Value Before Initialitate this conts but not working , i have idea to replacing Const With Other Const but This not Working again

const audioMap = [
    "<?php echo base_url('sounds/Airport_Bell.mp3');?>",
    "<?php echo base_url('sounds/C.wav'); ?>"
];

self.queue.shift();

document.getElementById("list_antrian").innerHTML = JSON.stringify(self.queue);

let audio = new Audio();

function playSequence(sounds) {

    const playNextSounds = (sounds) => {
        if (sounds.length > 0) {
            var audio = new Audio();
            audio.src = sounds[0];
            audio.currentTime = 0;
            audio.play();
            sounds.shift();
            audio.addEventListener('ended', function () {
                return playNextSounds(sounds);
            })
        } else {
            self._call();
        }
    }

    let currentSoundIndex = 0;

    if (sounds.length > 0) {
        const audio = new Audio();
        audio.src = sounds[0];
        audio.currentTime = 0;
        audio.play();
        sounds.shift();

        audio.addEventListener('ended', function () {
            return playNextSounds(sounds);
        })
    } else {
        self._call();
    }

}

playSequence([
    "<?php echo base_url('sounds/A.wav'); ?>",
    "<?php echo base_url('sounds/B.wav'); ?>",
    "<?php echo base_url('sounds/C.wav'); ?>"
]);

I want Change playSequence With audioMap

Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

use let when mutating, const when it's constant.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const

You can merge those array's together, like in the following, if you're trying to just bring in audioMap and the array currently being passed into playSequence

const audioMap = [
  "<?php echo base_url('sounds/Airport_Bell.mp3');?>",
  "<?php echo base_url('sounds/C.wav'); ?>"
];
const audioSet = [
  "<?php echo base_url('sounds/A.wav'); ?>",
  "<?php echo base_url('sounds/B.wav'); ?>",
  "<?php echo base_url('sounds/C.wav'); ?>"
]
playSequence([...audioSet, ...audioMap]); 

You can also mutate the array, but I recommend the approach above.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda