Category

List of articles for category: "Javascript"
JavaScript Tip: Throw an Error if a Required Parameter Is Missing Image

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.
JavaScript Tip: Get Valuable Info About Device Battery Image

JavaScript Tip: Get Valuable Info About Device Battery

TODO.
JavaScript Tip: How to Sort an Array of Integers Image

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: Replace Switch Statements With Object Literals Image

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: Return Object Literal From an Arrow Function Image

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.