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

157
Views
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
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!