JSFiddle - React, Tailwind, and code Playground

HTML

<input type="checkbox" name="email" />
<input type="checkbox" name="name" />
<input type="checkbox" name="hi" />

<a id="click">click me</a>

JavaScript

var obj = {}
$('#click').on('click', function() {
    $('input[type="checkbox"]').each(function() {
        var name = $(this).attr('name');
        obj[name] = $(this).is(':checked') ? 1 : 0;
    });
    console.log(obj);
});