JSFiddle - React, Tailwind, and code Playground

by kkdaily

JavaScript

var states = {
	MA: "MAss"
}

var state = states["CA"]

var acc = {}

if (state && !acc[state]) {
	acc[state] = []
}

alert(JSON.stringify(acc))