DEV Community

Ega Prasetya
Ega Prasetya

Posted on

Shorthand Javascript Techniques

Declaring Variables

Alt Text

Ternary Operators

Alt Text

Assignment Operators

Alt Text

Switch Case

Alt Text

If Presence

Alt Text

Arrow Functions

Alt Text

Object Array Notation

Alt Text

Happy Coding!

Top comments (2)

Collapse
 
jaca22 profile image
Jacek Dunikowski • Edited

Ternary Operators:

// SHORTHAND
let number = x > 9 ? true : false;

Even more shorthand:

// SHORTHAND
let number = x > 9;
Collapse
 
egaprsty profile image
Ega Prasetya

Ah, this is also very cool bro. Nice comment!