Answers for "how to compare previous value with current in javascript"

0

how to compare previous value with current in javascript

var previousText = null;
function foo() {
  var currentText = $(".showText").text();
  if (previousText == currentText) {
    $(".showText").html("same text");
  }
  previousText = currentText;
}
Posted by: Guest on December-11-2020

Code answers related to "how to compare previous value with current in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language