0
var a = [1, 2, 3];
var b = n => n + 5;
var wtf = 'map'

a[wtf](b);     // Array(3) [ 6, 7, 8 ]
a['map'](b);   // Array(3) [ 6, 7, 8 ]

I don't understand the general principle behind it and can't figure out what is it called so I can look it up.

revamp
  • 3
  • 1
  • 1
  • You are dealing with `arrays` and `indexes` – Zak Nov 11 '20 at 19:52
  • Also you're dealing with *substituting* an `index`s nomenclature with a `variable` = `wtf` - So since the variable `wtf` gets `'map'` -- There is no difference between the `array[index]` `a['map']` and `a[wtf]` Since `wtf` is set to `'map'` – Zak Nov 11 '20 at 19:56
  • @Zak thank you! I think I got it! – revamp Nov 11 '20 at 20:00

0 Answers0