js number comma

example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
const n = 11111111111111;
console.log(n.toLocaleString());
// 11,111,111,111,111

// console.log(navigator.languages);
}

{
const n = 11111111111111;
const nuberWithCommas = n.toLocaleString('ko-KR');
console.log(nuberWithCommas);
// 11,111,111,111,111
}

참고

Author

chinsung

Posted on

2021-09-04

Updated on

2021-09-04

Licensed under

댓글