0
var str = "hello world & hello universe";
gs.print(str.replace(/\s/g, ""))

Output:

How to remove space from string in ServiceNow and JavaScript?
Working Code Asked question July 21, 2023