DEV Community

Ega Prasetya
Ega Prasetya

Posted on

5 1

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!

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️