Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

currency conversion to locale string js

var number = 123456.789;

// request a currency format
console.log(number.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }));
// → 123.456,79 €

// the Japanese yen doesn't use a minor unit
console.log(number.toLocaleString('ja-JP', { style: 'currency', currency: 'JPY' }))
// → ¥123,457

// limit to three significant digits
console.log(number.toLocaleString('en-IN', { maximumSignificantDigits: 3 }));
// → 1,23,000

// Use the host default language with options for number formatting
var num = 30000.65;
console.log(num.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}));
// → "30,000.65" where English is the default language, or
// → "30.000,65" where German is the default language, or
// → "30 000,65" where French is the default language
Comment

currency conversion to locale string js

var number = 123456.789;

// German uses comma as decimal separator and period for thousands
console.log(number.toLocaleString('de-DE'));
// → 123.456,789

// Arabic in most Arabic speaking countries uses Eastern Arabic digits
console.log(number.toLocaleString('ar-EG'));
// → ١٢٣٤٥٦٫٧٨٩

// India uses thousands/lakh/crore separators
console.log(number.toLocaleString('en-IN'));
// → 1,23,456.789

// the nu extension key requests a numbering system, e.g. Chinese decimal
console.log(number.toLocaleString('zh-Hans-CN-u-nu-hanidec'));
// → 一二三,四五六.七八九

// when requesting a language that may not be supported, such as
// Balinese, include a fallback language, in this case Indonesian
console.log(number.toLocaleString(['ban', 'id']));
// → 123.456,789
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to check request type in js 
Javascript :: node js login and registration 
Javascript :: variables con nombre dinamico javascript 
Javascript :: javascript get the last item in an array 
Javascript :: spam system discord.js 
Javascript :: create owl component react js 
Javascript :: javascript sorting an array 
Javascript :: change app name in react native android 
Javascript :: Install PHP debugbar 
Javascript :: javascript cheatsheet 
Javascript :: if syntax javascript 
Javascript :: strict type javascript 
Javascript :: add table header dynamically in jquery 
Javascript :: react split 
Javascript :: form handling in react 
Javascript :: react form validation 
Javascript :: jsx react 
Javascript :: js get location params 
Javascript :: react-bootstrap-table2-editor 
Javascript :: django add csrf token to formdata 
Javascript :: how to add a tilemap in phaser 3 
Javascript :: No match found for location with path 
Javascript :: browserrouter invalid hook call 
Javascript :: why is this undefined in react 
Javascript :: javascipt async 
Javascript :: js get dropdown value 
Javascript :: html call javascript function with input value 
Javascript :: javascript this Inside Object Method 
Javascript :: find the second largest number in an array javascript 
Javascript :: tutorial of machine learning js 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =