DEV Community

Discussion on: Let's talk about how powerful split function is

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

I think all these three are similar, . split('\n'), . split(/\n/) and . split(/\n/g).

Do you know that you can . split(/\.(.+)$/)?

Collapse
 
heyrohit profile image
Rohit Gupta

/g in regex is for all instances in a string :)