JSFiddle - React, Tailwind, and code Playground

by agconti

JavaScript

// this doesnt work
var dict = {1: "ACCOUNTING", 5: "HUMAN RESOURCES", 6: "DEVELOPERS"};
alert(dict[1]);
alert(dict["ACCOUNTING"]);

//but this will
var dict = {"ACCOUNTING": 1, "HUMAN RESOURCES":5};
alert(dict[1]);
alert(dict["ACCOUNTING"]);