JSFiddle - React, Tailwind, and code Playground

HTML

<input type = "text" id="firstName" value="Jim"/>
<input type = "text" id="lastName" value="Smith"/>
<input type = "text" id="phoneNumber" value="123-456-7890"/>

JavaScript

var $items = $('#firstName, #lastName,#phoneNumber,#address ')
var obj = {}
$items.each(function() {
    obj[this.id] = $(this).val()
})
 
$('body').append('<br><pre>'+JSON.stringify(obj, null, ' '))