For input fields you could use ECMA6ECMAScript 6 like the following:
Get your form in a constant:
const form = document.querySelector('form') Grab all values:
Object.values(form).reduce((obj,field) => { obj[field.name] = field.value; return obj }, {}) AboveThe above snippet will produce an object with the input name as the key and its value.