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

3rd Mar 2022, 2:23 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
7 odpowiedzi
+ 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! 🙏
5th Mar 2022, 3:50 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 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.
3rd Mar 2022, 3:17 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
I went back and reviewed ES6 Map. Evidently, that’s not the same as what this question requires.
3rd Mar 2022, 4:56 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
it returns an array like this--> [0, 3, 4] because you are multiplying values with an index of the array Thank You
24th Dec 2022, 4:11 PM
Ghulam mustafa
Ghulam mustafa - avatar