javascript replace without replace()

JavaScript
function fakeReplace(data, substr, newstr) {
    return data.map(function(s) {
       return s.split(substr).join(newstr);
    })
}
Source

Also in JavaScript: