How can I access a JavaScript object which has spaces in the object’s key?

Use ECMAscripts “bracket notation”:

myTextOptions[ 'character names' ].kid;

You can use that notation either way, reading & writting.

For more information read out here:

  • https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects

Leave a Comment