0

Console.log(group) returns object Object.

Tried this code. Var group = {}; group.love = 2; group.turn = 3; Console.log(group); Console return -->> object Object What is the error?

20th Sep 2020, 2:14 PM
Lucifer
Lucifer - avatar
8 Antworten
+ 2
No error ,use JSON.stringify(group) to see the values
20th Sep 2020, 2:32 PM
Abhay
Abhay - avatar
+ 1
Abhay I tried the code in codepen.io , it showed me the object values, properly.
20th Sep 2020, 2:35 PM
Lucifer
Lucifer - avatar
+ 1
Lucifer It stringifies the values ,you still need to use console.log to print to it to the console console.log(JSON.stringify(group)) It doesn't works here for some reason which I am unaware of :-\
20th Sep 2020, 2:40 PM
Abhay
Abhay - avatar
0
Abhay So, I can't use Console.log?
20th Sep 2020, 2:34 PM
Lucifer
Lucifer - avatar
0
Abhay I tried JSON.stringify(group) it isn't working
20th Sep 2020, 2:38 PM
Lucifer
Lucifer - avatar
0
Abhay thankyou brother.
20th Sep 2020, 2:48 PM
Lucifer
Lucifer - avatar
0
✌️
20th Sep 2020, 2:51 PM
Abhay
Abhay - avatar
0
The code should looks like as follows and then will work here on the Sololearn‘s Playground: var group = {}; group.love = 2; group.turn = 3; console.log(group);
20th Sep 2020, 3:28 PM
JaScript
JaScript - avatar