Check/detect space in a string and remove it in JavaScript?
var text = "Raju Kumar Yadav"
if (/\s/g.test(text )) {
text = text .replace(/\s/g, '');
}
console.log(text);
Output:
"RajuKumarYadav"
var text = "Raju Kumar Yadav"
if (/\s/g.test(text )) {
text = text .replace(/\s/g, '');
}
console.log(text);
Output:
"RajuKumarYadav"
Comments
Post a Comment