const fields = [\'email\', \'password\']; const objFields = {}; fields.forEach(value => { objFields[value] = \'\'; }); console.log(objFiel
You could map objects and assign all to a single object.
const fields = ['email', 'password'], object = Object.assign({}, ...fields.map(key => ({ [key]: '' }))); console.log(object);