An interesting JavaScript template string trick: You can replace this: {...


An interesting JavaScript template string trick:

You can replace this:
{
"aria-required": isRequired ? "true" : "false";
}

with this:

{
"aria-required": `${isRequired}`
}

The template string evaluates the bool to "true" or "false".

#JavaScript

View original on X