Please implement a function, a string to replace each space to "20%." For example, when the string is We Are Happy. After the string is replaced after We% 20Are% 20Happy.
Code:
function replaceSpace(str)
{
return str.replace(/\s/g,'%20');
}
Ideas: