JSFiddle - React, Tailwind, and code Playground

JavaScript

$( document ).ready(function() {
      var resizeTimeout;
      finalWidth = $(window).width();       
       
      $(window).resize(function() {
        clearTimeout(resizeTimeout);
        resizeTimeout= setTimeout(doneResizing, 500);      
     });
    
     doneResizing(); //trigger initial assignment
 });


function doneResizing()
{
    //resize just happened, pixels changed
    var finalWidth;
    finalWidth = $(window).width();

    alert(finalWidth); //and whatever else you want to do
    anotherFunction(finalWidth);    
    
}

function anotherFunction(finalWidth)
{
    alert("This is anotherFunction:"+finalWidth);   
}