JSFiddle - React, Tailwind, and code Playground

by tuando

HTML

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

<button id="run">Run</button>

JavaScript

$("#run").click(function() {
    var test = {};

    $(":checkbox").each(function() {
        test[this.name] = this.checked ? 1 : 0;
    });

    console.log(test);
});