Javascript currency formatting

Hello now I am back again and now I want write how about to convert number to currency format. Maybe we know about javascript plugin to convert currency but it actually has a javascript function itself. Example I from Indonesia and I want currency number to “Rupiah”. If we want use javascript, you must read from this documentation
Example this is basic number formatting:

var number = 3500;

document.write(new Intl.NumberFormat().format(number));
// Result = 3,500

And this is if I using locales, example I use Indonesian:

var number = 123456.789;

// Indonesian uses comma as decimal separator and period for thousands
document.write(new Intl.NumberFormat('ID').format(number));
// Result = 123.456,789

And for more info list code locales, you can read from this
And now how if I want use currency code like ¥ or €

var number = 123456.789;

// the Japanese yen doesn't use a minor unit
document.write(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(number));
// Result = ¥123,457

Form more info about style currency code, you can read from this
For more info about date format you can read on this