Trim string in javascript

8 views
Skip to first unread message

ellionstore7

unread,
Mar 15, 2024, 12:40:03 AM3/15/24
to PlazaDoms
how to trim string in javascript

let text = "       Hello World!        ";
let result = text.replace(/^\s+|\s+$/gm,'');

ellionstore7

unread,
Mar 15, 2024, 12:43:39 AM3/15/24
to PlazaDoms
Reply all
Reply to author
Forward
0 new messages