str.removeWhitespaces()
// ๐ธ str.removeWhitespaces()
String.prototype.removeWhitespaces = function() {
return this.replace(/\s+/g, '');
};
๐็ฏไพ๏ผ
// multi-line string
let str = `
as void async while
`;
str.removeWhitespaces() // "asvoidasyncwhile"
Last updated
Was this helpful?