Replacing characters within a string in AngularJS
<p>Although I've seen similar question's nothing quite answers why this doesn't work, and I'm unaware of an alternative.</p>

<p>I'm making a very simple calculator and when pulling the expression from the string I need to replace symbols such as '×' and '÷' with operators recognized by the eval. </p>

<p>Currently I'm trying to work through the string one character at a time and copy it into a new string, replacing where necessary. It seems that none of the <code>if</code> statements checking for characters in the string are ever called and I dont know why.</p>

<pre><code>for (var i = 0; i &lt; (expressionPre.length) ; i++) {
    alert(expressionPre[i]);
    if (expressionPre[i] == "÷") {
        expressionPost += "/";
    } else if (expressionPre[i] === '×') {
        expressionPost += "*";
        alert("Finally!");
    } else if (expressionPre[i] == "−") {
        expressionPost += "-";
    } else if (expressionPre[i] % 1 == 0) {
        expressionPost += expressionPre[i];
    }
    alert(expressionPost[i]);
}
</code></pre>