Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

161
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda