+ 2
JavaScript Challenge
Can someone please explain this question and answer? I donāt remember covering this in the JS tutorial. Thank you. What is the output of this code? let p= [4,3,2]; let q= p.map((v,w) => v*w); console.log (q);
7 Answers
+ 3
Thank you, Professor Solomoni Railoa for switching on the š”. I believe I have my shoes on the correct feet now, thanks to your awesome explanations! š
+ 1
Harsh Bajpai š®š³ Thatās the correct answer, but I still donāt understand how/why that is the correct answer.
Actually, [0,3,4] as an array.
+ 1
I went back and reviewed ES6 Map. Evidently, thatās not the same as what this question requires.
+ 1
it returns an array
like this--> [0, 3, 4]
because you are multiplying values with an index of the array
Thank You