I have this string in an input variable like this: var input = "javascript";
i want to change this string to "j4v4sr1pt" by replacing a with 4 and i with 1.
i tried to do something like this but didn't work for me , i am new to JavaScript .can someone tell me what i am doing wrong here ? THanks for down votes in advance :D
<script>
var input = "javascript";
var output= "";
for ( var i=0;i<input.length ; i++)
   { if ( input[i] == "a")
       {output[i] = "4"; }
     else if ( input[i] == "i")
     {  output[i] ="1"; }
     else
       output[i]=input[i];
    }// end forloop
</script>
 
     
    