Consider side bar simple server side script .
const publicArr = [];
function doWait2(ms){
   var start = new Date().getTime();
   var end = start;
                 
    while(end < start + ms) {
       end = new Date().getTime();
   }
}
function getfirstCall(){
    publicArr.push("Item1");
    doWait2(10000);
    return publicArr;
}
function getsecondCall(){
    publicArr.push("Item2");
    return publicArr;
}
When calling getfirstCall and getsecondCall one after another, each function returns a single item array (Item1 / Item2 respectively). Changes made by getfirstCall to publicArr are not reflected when client execute getsecondCall.
Note that getfirstCall waits 10 sec before returning allowing getsecondCall to be handled simultaneously by the server. not sure it is important.
Is this guarantee? each client call gets its own instances of the public variables?
Guess this is pretty fundamental with web development, and not only with side bar
 
    