I'm a javascript newbie.
I have a line of code:
data.content_teaser.image_square_attachment_url
square can change: I have a variable called contentType that can be 'square'
, or 'vertical'
or 'horizontal'
.
In ruby I can use send with the string interpolation, how can I obtain the same in js?
Something like "data.content_teaser.image_" + contentType + "_attachment_url"