0

Object inititalization

I really wanted to ask. Between this to code, which is better Var person={name:"Afeez", age:19}; And Var person={ Name:"Afeez", age:19, };

27th Jun 2018, 5:04 PM
Korede
2 ответов
+ 4
Korede they are exactly the same However, this is normally done in one line like the first example: Var person={name:"Afeez", age:19};
27th Jun 2018, 5:09 PM
Agent
Agent - avatar
+ 1
Both of them are one and the same thing, just the second one looks more clear and properly intended but in case when you have large number of objects with small names than first one is recommended
27th Jun 2018, 5:08 PM
RZK 022
RZK 022 - avatar