Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript format number as currency

const formatter = new Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: 'USD',
  minimumFractionDigits: 2
})

formatter.format(1000) // "$1,000.00"
formatter.format(10) // "$10.00"
formatter.format(123233000) // "$123,233,000.00"
Comment

Javascript number format, currency format

const yourNumber = -100
const nf = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'GBP' })
console.log(nf.format(yourNumber))
 Run code snippet
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript enumerate 
Javascript :: regular expression start and end with same character javascript 
Javascript :: input javascript console 
Javascript :: Node Sass version 6.0.0 is incompatible with ^4.0.0 || ^5.0.0 
Javascript :: custom error js 
Javascript :: expo build android app bundle 
Javascript :: javascript compare 2 thresholds color 
Javascript :: javascript regular expression flags 
Javascript :: javascript get boundary client rect 
Javascript :: javascript dom last child 
Javascript :: invoke lambda nodejs 
Javascript :: javascript regex check if string is empty 
Javascript :: axios not defined 
Javascript :: count occurrences of character in string javascript 
Javascript :: bootstrap js link not working 
Javascript :: ng serve without reload 
Javascript :: on_raw_reaction_add example 
Javascript :: router class in backbone 
Javascript :: js get element by class 
Javascript :: javascript remove empty elements from array 
Javascript :: eslint no-param-reassign 
Javascript :: js greater than or equal to 
Javascript :: jetbrains font 
Javascript :: easyui datagrid double click cell 
Javascript :: convert seconds to hours minutes seconds javascript 
Javascript :: get width of a dom element js 
Javascript :: newtonsoft json object to json string 
Javascript :: ajaxcall 
Javascript :: javascript date - 7 days 
Javascript :: video play on page load 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =