Enter a comma after every 10 digits in Javascript?

I put 10-digit mobile numbers in Textarea, as in the following. 242452354643663463636346366363463636365636363634656346 but I need to put a comma (,) after every ten-digit number.

+3
source share
1 answer

Like this?

"242452354643663463636346366363463636365636363634656346".replace(/(\d{10})/g,"$1,")

// 2424523546,4366346363,6346366363,4636363656,3636363465,6346
+7
source

Source: https://habr.com/ru/post/1748278/


All Articles