JSFiddle - React, Tailwind, and code Playground

by Cale Bergh

JavaScript

var obj = {
'1': 'One!',
'2': '0',
'3': false
}

valueExists(1);
valueExists(2) // should output "0";
valueExists(3) // should output "false";
valueExists(4) // should output '';


function valueExists( prop ) {
console.log( obj[prop] || '');
}