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));