replace all the spaces in string with %20 in js without replace method code example Example: javascript string spaces replace with %20 string.replace()