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

159
Vistas
Javascript my function parameter is undefined when console.logging

I'm creating a function that searches for the current part of the array that you are at. I've already created something like this before, but somehow it says that my param is undefined when i try to console.log it. I've already searched multiple simulair questions, but I couldn't find a right answer for me.

        /**
         * @param {int} DesIndex
         * @param {int} question
         * @returns {QuizPart}
         */
        openModal(question, DesIndex) {
            let questionIndex = this.quiz[DesIndex]
            console.log(DesIndex)
            console.log(questionIndex)

Now this.quiz is the array that I'm in (It's multidimentional). This already worked in other code that looked exactly the same, but not in here. In the other code, when I console log the parameter it would say the number of the part of the array where I'm at, but here it's undefined.

logged function

infoModal {quiz: Array(3), questionsArray: Array(0), modal: div#myModal.modal, questionNumber: 0, div: div#modal-content.modal-content, …}
body: div#containerID.container
div: div#modal-content.modal-content
modal: div#myModal.modal
nextbtn: button#nextbtn.nextbtn
prevbtn: button#prevbtn.prevbtn
questionNumber: 0
questionsArray: []
quiz: (3) [QuizPart, QuizPart, QuizPart]
[[Prototype]]: Object

function itself

openModal: openModal(question, DesIndex) { //displays the modal if button is clicked // this.nextbtn.onclick = () => {…}
length: 2
name: "openModal"
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.s (<anonymous>:1:83)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.s (<anonymous>:1:83)]
[[FunctionLocation]]: index.html?_ijt=3msd…=RELOAD_ON_SAVE:258

When i console log te int itself it shows in the browser as a pointerEvent

Call function:

document.getElementById('openModal').addEventListener("click", InMod.openModal.bind(InMod));
about 4 years ago · Juan Pablo Isaza
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