DEV Community

Discussion on: 7 Killer JavaScript One-Liners that you must know

Collapse
 
thumbone profile image
Bernd Wechner • Edited

Poe's Law (look it up if you need to it's an essential part of modern internet vocabulary)

As in surely, when I read this, I read it as a parody, a joke ...

Replacing this:

console.log(Array.isArray(fruit)); //output - false
Enter fullscreen mode Exit fullscreen mode

with this:

console.log(isArray(fruit)); //output - false
Enter fullscreen mode Exit fullscreen mode

is a killer one-liner indeed. Well the killer one-liner is in fact:

const isArray = (arr) => Array.isArray(arr);
Enter fullscreen mode Exit fullscreen mode

As in, it's one line, no-one needs (a killer).

And on a close inspection the errors aside (a hasty post it seems) they all seem to be in jest.