خرید بک لینک

Vote count: 0

I'm reading an article that says that {} is a valid JavaScript program.

I tried it and it worked fine.

Then I tried this and it worked:

{name:'Lord Stark'} <--- the entire program (not assigning it to a variable or anything)


But then I tried the following and it threw an error at the comma.

{name:'Lord Stark',reignsOver:'Winterfell'} <--- again this is the entire program


My question is, why does a plain object with more than one property (and consequently a comma), retu an error unless assigned to a variable when an object with only a single entry does not?

asked 35 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 15 ارديبهشت 1395 ساعت: 12:24

صفحه بندی