Q:

How to select value from array by key

I have such array in my class:
   stuff = [
        { ['xwz']: 'https://site1.com' },
        { ['erx']: 'https://site2.com' },
        { ['qwery']: 'https://someurl-here.com' },
        { ['stuff']: 'http://morestuffhere.com' }
    ]

I want to get the value('https://...') by passing the key like this.stuff['xwz'] but didn't work this way. Any ideas?

A:

This should do the job.
// declare as
stuff = {
    'xwz': 'https://site1.com',
    'erx': 'https://site2.com',
    'qwery': 'https://someurl-here.com',
    'stuff': 'http://morestuffhere.com'
 }

// Access with
this.stuff['xwz'] // returns 'https://site1.com'

