When the following JavaScript code is executed, I want the code "action.type" or "action.params" to work.
actions.slice().parallel().reduce((acc, rawAction) => {
const actionType = rawAction[0]
const actionParams = rawAction.slice(1)
const action = {type : actionType, params: actionParams, }
return acc.concat([action, ])
}, []).concat()
But, after the function is executed, when I am debugging, "action.type" and "action.params" is not defined. (undefined message)
It looks like a simple String array rather than an action Object consisting of the keys "type" and "params".
Why does it work and what should I do?
Thank you.
Aucun commentaire:
Enregistrer un commentaire