Javascript replace all

javascript
function replaceAll(string, search, replace) {
  return string.split(search).join(replace);
}