13th Oct 2022, 10:56 AM
Mozzie
Mozzie - avatar
5 odpowiedzi
+ 6
// Use (for in) loop, for in loop is used to print all your object values. I solve yr problem below for(var newvar in userData ) { console.log(userData [newvar]+"</br>"); }
13th Oct 2022, 11:48 PM
Usman Shinwari🦂
Usman Shinwari🦂 - avatar
+ 4
Yes its possible to print key also.Kim Jonas Cabugayan . for(var newvar in userData ) { console.log(newvar+"-" + userData[newvar] +"</br>" ); }
14th Oct 2022, 10:00 AM
Usman Shinwari🦂
Usman Shinwari🦂 - avatar
+ 2
you can't print object like that you have to give the refrence what you wanna print. like this console.log(userData.username); console.log(userData.userID); if you wanna print all you can use for example Map.
13th Oct 2022, 11:07 AM
Davinder Kumar
Davinder Kumar - avatar
+ 1
To print total values of object , try : Values: console.log(Object.values(userData)); string form : console.log(JSON.stringify(userData));
13th Oct 2022, 11:33 AM
Jayakrishna 🇮🇳
0
Is it possible to print with username, userID etc.. To knows whose who?
14th Oct 2022, 3:36 AM
Mozzie
Mozzie - avatar