JSFiddle - React, Tailwind, and code Playground

JavaScript

var status = 1;

if(typeof checkStatus == 'undefined'){
  alert('checkStatus is undefined');
  var checkStatus = status;
  // I'm expecting the next time the form is submitted, checkStatus will be set, but it's not
}else{
  if(checkStatus == status){
    alert('checkStatus is equal to ' + status);
  }
}