.replace(/ /g,'')
Hello, can somebody explain what this expression .replace(/ /g,'' ) means?
Hello, can somebody explain what this expression .replace(/ /g,'' ) means?
Hi @sanjana12
The above code replaces space " "with an empty value. for example :-
"ABC DEF" will get replaced as empty "ABCDEF".
You can refer to this link or these references.
Example, create a workflow, add JavaScript activity and enter the below script
vars.string = "ABCD EFGH 1234";
vars.replaceString = vars.string.replace(/ /g,'');
logInfo("Original String Value: "+vars.string );
logInfo("Replaced String Value: "+vars.replaceString);Run the workflow, and right click JS activity and select display logs. You can see the result as below,

Regards
Akshay
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.