JSFiddle - React, Tailwind, and code Playground

JavaScript

function rot13(str) { // LBH QVQ VG!
  var arr=str.split(" ");
  console.log(arr);
  var m;
  var stringX;
  var arrMax=[];
  var strMax="";
  //we must push here results from each last little loop but stringify first
  for (i=0;i<arr.length;i++)
    {
    strnew=[];
    strnew3=[];
      for (y=0;y<arr[i].length;y++)
        
        {
          if (arr[i].charCodeAt(y) >= 78 && arr[i].charAt(y).match(/[a-z]/i)) {
          f = arr[i].charCodeAt(y)-13; }
          
          else if (arr[i].charCodeAt(y) < 78 && arr[i].charAt(y).match(/[a-z]/i)) {
          f = arr[i].charCodeAt(y)+13; }
          
          else {f = arr[i].charAt(y);} 
          strnew.push(f);
          //with 'if' below we gonna limit address only to final subloop where array is allpacked, next we operate this packed array from subloop
          if (y==arr[i].length-1){
          //lets remind us how our operative stacked array in a finished subloop looks -- 
          console.log(strnew);
          //now we shall address every part of array with fromCharCode
        
         for (c=0; c<strnew.length;c++)
          {
if (strnew[c] !== "!" && strnew[c] !== "?" && strnew[c] !==".") {m = String.fromCharCode(strnew[c]);}
else if (strnew[c] === "!") {m = "!";} 
            else if (strnew[c] === "?") {m = "?";} 
            else if (strnew[c] === ".") {m = ".";}
//else if (strnew[c]==NaN) {console.log("this was supposed to be branch responsible for adding ! but it fails, its so dead here that even console log wont output");}
//with following each pair of numbers is converted into character          

strnew3.push(m);
         // strnew3.push(m);
          //now we shall address final sub-sub-loop when our converted array is already stacked
          if (c==strnew.length-1) {
          
         //console.log(strnew3);
          // now wee need to make our operative array into string
          stringX = strnew3.join("");
          // use this line below to confirm that we turned arr into string...