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

179
Views
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 answers
Answer question

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 Report
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!