remove all whitespace from array javascript code example Example: javascript remove all spaces from string str = str.replace(/\s/g, '');