Javascript Object – Key beginning with number, allowed?

You can use any key if you use [string] to access the key, even key with space. All of these are valid:

myObj['key with space']
myObj['12345']

But if you want to use dot . operator to access the key then the key must be a valid identifier which means they can not begin with a number or contain space.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)