3

I have to make an object with - like:

let myObject = {
  one-property: 'assignee'
}

but JavaScript does not allow this. So any trick to make this work with -? My whole backend has objects with - on keys.

Sebastian Simon
  • 18,263
  • 7
  • 55
  • 75
erik.hac
  • 111
  • 1
  • 9

1 Answers1

10

You have to put the key in quotes

let myObject = {
  'one-property': 'assignee'
}
fab
  • 1,189
  • 12
  • 21