Object output is undefined or object? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Object output is undefined or object?

The output is not displayed as it suppose to be. Need to display the output as it is (in text) instead of undefined or object. Any help is appericiated!👍 Here is my code: https://code.sololearn.com/Wxrek1w9yBgg/?ref=app

15th Sep 2018, 12:32 AM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
1 Answer
+ 4
At line 13, when you were pushing into the dictionary using newObj[i] = true i is really an object. Try doing console.log(i) in the loop. As a result, there is only one pair in the dictionary after the loop. The loss of information there is what causes JSON to stringify the object into [object Object].
15th Sep 2018, 1:40 AM
Hatsy Rei
Hatsy Rei - avatar