const arr=['plus1','plus3']
const obj = {
'plus1':20,
'plus2':30,
'plus3':40
}
let newArr = arr.map(function(val) {
return this[val]
},obj)
console.log(newArr) // [20,40]
const a="-sub"
let newArr2 = arr.map(function(val) {
return val + this
},a)
console.log(newArr2) // ["plus1-sub","plus3-sub"]
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.