Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Thousands separator

node v16.18.0
version: 1.0.2
endpointsharetweet
const { isFinite } = require('lodash'); const computeDisplayValue = (limit) => { const parsedLimit = parseInt(limit, 10); if (isFinite(parsedLimit)) { return parsedLimit.toLocaleString('en-US'); } return limit; }; console.log(computeDisplayValue('Unlimited')); console.log(computeDisplayValue('10000')); console.log(computeDisplayValue('1000000')); console.log(computeDisplayValue('100000.00')); console.log(computeDisplayValue(100000000));
Loading…

no comments

    sign in to comment