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

184
Views
¿Por qué recibo el error 'Error de sintaxis no detectado: el identificador 'randFilmIndex' ya ha sido declarado'?
 function getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min) + min); } function arrayRemove(arr, value) { return arr.filter(function(ele){ return ele != value; }); } // Define film list filmList = ['film1', 'film2', 'film3']; let randFilmIndex = getRandomInt(0, filmList.length); let randFilm = filmList[randFilmIndex]; filmList = arrayRemove(filmList, randFilm); document.getElementById('option1').innerHTML = randFilm;

¿Por qué este código da el error?

 Uncaught SyntaxError: Identifier 'randFilmIndex' has already been declared (at randomize-film.js:1:1)

cuando lo ejecuto?

Estoy usando el espacio de trabajo de codecademy y mi html es

 <!DOCTYPE html> <html> <head> <title>Rotten Tomatoes</title> <meta name="viewport" content="width=device-width,initial-scale=1" > <link href="style.css" rel="stylesheet"> <!-- Scripts --> <script src="scripts/randomize-film.js"></script> </head> <body> <center> <h1 class="title">Rotten Tomatoes Game</h1> <a href="rules.html"><h3>Click here to learn the rules</h3></a> <ul class="buttons"> <a href="you-picked-x-film.html"><li id="option1">Option 1</li></a> <a href="you-picked-x-film.html"><li id="option2">Option 2</li></a> </ul> </center> <script src="script.js"></script> </body> <!-- Scripts --> <script src="scripts/randomize-film.js"></script> </html>

¿Me pueden ayudar a descubrir cuál es el problema? Estoy tratando de hacer un juego de tomates podridos.

Mi sistema operativo es Linux y el navegador es Chromium, pero eso no debería importar.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Eliminar el elemento de secuencia de comandos adicional

 <script src="scripts/randomize-film.js"></script>
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!