Challenge question in JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Challenge question in JavaScript

I think one of the challenge questions is mistaken. The question is let obj= { 1: 0, 0: 1 }; console.log(obj['1']); The result shows 1, but I think it should be 0, because on position '1' the value is 0.

27th Jun 2018, 6:59 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
2 Answers
+ 3
D⚽⚽⚽⚽7⃣7⃣7⃣ , No problem :) I have tried the given code in SoloLearn JS editor, and it outputs "0" as expected. Unfortunately, the provided answer is wrong :/
27th Jun 2018, 7:44 PM
777
777 - avatar
+ 5
I'm sorry the object was let obj, not object as I write it.
27th Jun 2018, 7:28 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar