+ 2
I have a question...
Why in javascript if I declare object within object it gives an error, but if I first declare object and then put it inside other object it works fine. for example: //doesn't work var obj1; var obj2; var database={ obj1={}, obj2={} } //works fine var obj1={} var obj2={} var database={ obj1, obj2 }
5 Answers
+ 4
In object , values are stored as key value pair and they are seperated using colon.
+ 2
yep, you have to do it with the colon to work in objects
+ 1
youd want to do something like this...
https://code.sololearn.com/WbjAeFY4OeLO/?ref=app
+ 1
Ok thanks âșïž
0
Now it is working fine. But why didn't it work for "=" sign. Is it because it is inside an object?