« first day (5020 days earlier)      last day (57 days later) » 

12:55 AM
@ThiefMaster I thought I was the only one. I never use var because it seems lazy to use for some reason, and it just makes code look ugly to me. let and const are much better overall. To me, at this point, var doesn't exist in JavaScript.
 
9 hours later…
9:29 AM
IMHO the only place where var is ok is when testing stuff in the console, since you can't re-run code that uses let on the global scope. so in that case it's easier to just use var and later replace it with let or const... (of course wrapping everything in an IIFE works just as well)
9:55 AM
I'm experiencing a strange problem (I'm using java servlets).
When I open the Firefox console and I RE-send a POST request, the session associated to that POST-request is null, even though in the request header indeed the request has the cookie (because it's literally the same as before, I'm just re-sending the request).
Of course, the original post request has the same cookie and the Session in the servlet is NOT null for the original request, but it becomes null if I re-send again the post request...WHY?!
10:06 AM
@Curio, from the information you have provided that should not be happening huh, can you give more detail or post a minimal example so we can reproduce your error
@matt Ok I found out that the 2 POSTS requests are identical, BUT the second time the re-sent post request gets redirected without the cookie and that causes session == null
The original post request gets instead redirected with its cookie.
gets redirected browser side?
Redirects to another servlet:
response.sendRedirect("MyOtherServlet")
And the filter applied to ALL servlets notices that the session is null
The re-sent post request has 2 more headers:
1) Cache-Control no-cache
2) Pragma no-cache

Actually I do have a NoCacheFilter mapped to ALL servlets, but this NoCacheFilter sets the no-cache headers on the RESPONSE, NOT on the request.
10:28 AM
you sure the cookie is being sent also, bc it doesnt seem to answer why the session was null from a seemingly identical post request
The cookies in the POST requests are also set and the JSESSIONID is the same

The get requests (due to redirect) after the post are identical, except for the cookie: the second one doesn't have any cookie set.
 
3 hours later…
1:09 PM
its not that var is wrong, i use it precisely because i prefer its flexibility
        const {err}         = fn();
        if(err)return;

        const {err:err2}    = fn2();
        if(err2)return;
the whole var vs let vs const is bordering on eval = evil syndrome
lets banish and brand parts of the language EviL bc some noob programmer in donuts-ville idaho might make a mistake
ultimately, for me, if youre going to go down the whole const road you might as well go full on typescript hadnt you?
type primitive = string | number | boolean | undefined | null;

type Unwrap<T> =
    T extends Promise<infer U> ? UnwrapSimple<U> :
    T extends Output<infer U> ? UnwrapSimple<U> :
    UnwrapSimple<T>;

type UnwrapSimple<T> =
    T extends primitive ? T :
    T extends Array<infer U> ? UnwrappedArray<U> :
    T extends object ? UnwrappedObject<T> :
    never;

interface UnwrappedArray<T> extends Array<Unwrap<T>> {}

type UnwrappedObject<T> = {
    [P in keyof T]: Unwrap<T[P]>;
};

function unwrap<T>(val: T): Unwrap<T>;
i just asked chatgpt via https://js2ts.com/ to convert the cssutilities function above to typescript and chatgpt left
the building
is there any real difference to choose let over var in many of the contexts where it is used, aside from var = saVAge syndrome
also i think they might have missed a trick by hoisting let definitions anyway, otherwise we could have had
        let x   = x;
tbh i hadnt given it much thought, i was just being funky, however ...
      console.log((()=>(abort(),timer=setTimeout(callback,delay)))());    //  1598923

      console.log((()=>{abort(); timer=setTimeout(callback,delay)})());   //  undefined
 
5 hours later…
6:21 PM
Question: On the topic of variables, if doing "someVariable = 'someValue'" in the browser adds "someVariable" to "window" by default, then what is "someVariable" appended to in Node.js, since it's not a browser environment and doesn't have the "window" property?
@ParkingMaster There is always a global object in JS. Any assignments without a declaration go to it. In the browser, the global object is window, in Node.js it's global (also same in web workers).
6:49 PM
@VLAZ Hm, never knew that Node.js has a global object
 
3 hours later…

« first day (5020 days earlier)      last day (57 days later) »