In this code can you write out what it would look in each iteration what array, index, and element would be I know element would be start as 1 and end as 5 but I'm not sure what the other would be. Just pick one not all of them thank you
The output in the console doesn't match with the code on the left lol, that was the output of running triple not square bruh
And if you want your question answered just add the index and array parameters to the display function and console.log them so you can see what they are for each iteration
Why didn't you just include the parameters index and array in the display function's signature and pass them to the console.log function like you are doing with element, if that's what you wanna visualize?
You are also using those in the three functions you got there so what exactly don't you get? I don't understand what confuses you
And what you are doing there is what the Array.prototype.map() function was made for btw
2
u/lgastako May 27 '24
why not run the code and see?
1
u/TheRealBornToCode Jun 01 '24 edited Jun 01 '24
Why didn't you just include the parameters
indexandarrayin thedisplayfunction's signature and pass them to theconsole.logfunction like you are doing with element, if that's what you wanna visualize?You are also using those in the three functions you got there so what exactly don't you get? I don't understand what confuses you
And what you are doing there is what the
Array.prototype.map()function was made for btw