DEV Community

loading...

Discussion on: 17 Pro JavaScript tricks you didn't know

Collapse
lukaszahradnik profile image
Lukáš Zahradník

I'm not sure you can call your first example as something a pro would write

let hungry = true;
let eat = hungry == true ? 'yes' : 'no';
Enter fullscreen mode Exit fullscreen mode

hungry == true really?

Collapse
cwraytech profile image
Christopher Wray

Better like this:

hungry ? “Yes” : “No”

Collapse
dakujem profile image
Andrej Rypo

Exactly 😆