[Solved] How to reverse a mathematical expression saved as a string in JavaScript?


function r(s) {
  var txt = "";
  for(var i = s.length - 1; i >= 0; i--) {
    txt += s[i];
  }
  return txt;
}

var mathex = "2+5-7%8";

alert(r(mathex));

solved How to reverse a mathematical expression saved as a string in JavaScript?