The code is like this
const reducer = (accumlator, currentVal) => accumlator.push( {id: currentVal} );
const ids = ['123', '456'];
// want to get [{id:123}, {id:456}]
const rs = ids.reduce(reducer, []);
console.log(rs);
But says: TypeError: accumlator.push is not a function at reducer (/home/user/list1.js:2:56) at Array.reduce ()
Any suggestions ?