News for hackers. Stuff that matters.
Re:Intent to stop using 'null' in my JS code by anonytrary on Sunday November 01, 2020 @12:38AM (#24957261)

  const w = (fn, _) => function(...args){
    return (_ = fn(...args)) === null ? undefined : _;
  };
  document.getElementById = w(document.getElementById.bind(document));
Re:Intent to stop using 'null' in my JS code by cmroanirgo on Sunday November 01, 2020 @01:17AM (#24957568)
I seriously hope this is joke code.

Returning undefined for null, as well as changing dom functions is a great way to ensure unintended side effects will creep into your code.

Re:Intent to stop using 'null' in my JS code by anonytrary on Sunday November 01, 2020 @02:00AM (#24957691)
It is an illustration of a concept. I wouldn't call it a joke, but I also wouldn't use it.
Re:Intent to stop using 'null' in my JS code by philihp on Sunday November 01, 2020 @01:36AM (#24957626)
For sure you wouldn’t actually commit this, but it’s for sure interesting to do the mental gymnastics to understand it.