How to use for to replace certain symbols

We have one string, called “javascript is awesome”. We need to replace certain symbols in this string, then we could have refult like: “j4v4scr1pt 1s 4w3s0m3”. a = 4, i = 1, e = 3, o = 0. We need to do this by FOR method. Please help me, I have no idia how to do this with for. Thats all I wrote:

var input = "javascript is awesome";
var output = "";
for(i = 0; i < input.length; i++){
        output += input[i]

I think replace() is ideal to use but you can also check this