I am working on an assignment using javascript but I am stuck on a problem. When I try to join together several .replace commands i do not get the expected output. I do not use any libraries like Jquery.
var str = ('abc abc');
str = str.replace(/a/g, 'b').replace(/b/g, 'c');
alert(str);
With my code I get this output: ccc ccc. When I should get this: bcc bcc.
Can anyone see what I am doing wrong?
Best regards, a student from Norway :)