Thursday 4 May 2017

Array is not an Array [on hold]

I have a object that looks like an array

var questions = 

[ { started_time: 2017-05-04T12:46:39.439Z,
    word: 'bottle',
    questionId: '161013bd-00cc-4ad1-8f98-1a8384e202c8' },
  { started_time: 2017-05-04T12:47:26.130Z,
    word: 'play',
    questionId: 'a84bd1b4-8b9c-4ec7-862d-ba994ac1f371' },
  { started_time: 2017-05-04T12:47:50.156Z,
    word: 'bottle',
    questionId: '4c7e1ee8-651e-4086-8e69-ce64414a815a' },
  { started_time: 2017-05-04T12:54:40.703Z,
    word: 'was',
    questionId: '79412420-eee9-47e0-8fb8-d854c5889765' },
  { started_time: 2017-05-04T12:55:36.474Z,
    word: 'liked',
    questionId: '525d90c9-4cca-433c-99c5-56bb54756b9c' } ]

I'm trying to create an array of words like this:

["bottle", "play", "was", "liked"]

When I try questions.map(etc..) I get

TypeError: questions.map is not a function

and Array.isArray(questions) is false

I can not figure out why I can't treat this as an array. Any help will be much appreciated.



via Kittovski

No comments:

Post a Comment