I am desperate – I don’t see what I’m doing wrong. I try to replace all occurrences of ‘8969’ but I always get the original string (no matter whether tmp is a string or an int). Maybe it’s already too late, maybe I’m blind, …
var tmp = "8969";
alert("8969_8969".replace(/tmp/g, "99"));
Can someone help me out?
The
/characters are the container for a regular expression in this case. ‘tmp’ is therefore not used as a variable, but as a literal string.