Over the last few years, I've collected a list of valuable tips while developing and writing web applications. Some are clever, some I use almost every day, and some are more advanced — but they're all useful.
JavaScript Tip: Return Object Literal From an Arrow Function
How to return an object literal from an expression-bodied arrow function as introduced by ECMAScript 2015.
JavaScript Tip: Replace Switch Statements With Object Literals
I prefer using JavaScript's object literals over switch statements as the code is faster, more readable, and less verbose.
JavaScript Tip: Get Valuable Info About Device Battery
TODO.
JavaScript Tip: How to Sort an Array of Integers
To sort an array of integers in JavaScript, we must provide a compare function that defines the sort order.
JavaScript Tip: Throw an Error if a Required Parameter Is Missing
Default function parameters allow named parameters to be initialized with default values if no value or undefined is passed.