JSFiddle - React, Tailwind, and code Playground

by Tom M

JavaScript

let arr = [
    ["PENNY", 1.01], 
    ["NICKEL", 2.05], 
    ["DIME", 3.1], 
    ["QUARTER", 4.25], 
    ["ONE", 90], 
    ["FIVE", 55], 
    ["TEN", 20], 
    ["TWENTY", 60], 
    ["ONE HUNDRED", 100]
    ];
    
function objectify(arr) {
    return arr.reduce(function(p, c) {
         p[c[0]] = c[1];
         return p;
    }, {});
}

let test = objectify(arr);
 
 console.log(test);