The String prototype’s replace function only replaces the first occurrence of a substring by default. We can extend that with a global flag on the expression.
Short-circuiting Boolean expressions
|| “short circuit”. If the result is obvious from the left value, it doesn’t evaluate the right side because that value wouldn’t make a difference.