How can I define an enum in JavaScript?
Enums are part of TypeScript, but what about defining enums in plain old JavaScript? Here are a few way you can do that.
The JavaScript article collection contains a wide variety of ES6 helper functions. It includes helpers for dealing with primitives, arrays and objects, as well as algorithms, DOM manipulation functions and Node.js utilities.
Enums are part of TypeScript, but what about defining enums in plain old JavaScript? Here are a few way you can do that.
JavaScript's this
keyword can confuse beginners and veterans alike. Learn how it works in different scenarios and start using it correctly.
Maps and objects are very similar, but they have some differences that can help you decide which one better fits your use-case.
Learn how you can compare two objects in JavaScript using various different techniques.
A quick introduction to the JavaScript Proxy object and where it can be used.
Learn how to recursively nest objects linked to one another in a flat array.
Map an object to an object array, using the provided mapping function.
Learn the differences between the three most commonly used iteration methods in JavaScript, that often confuse beginners and veterans alike.
Learn how to compact an array or object in JavaScript using the Boolean
function and recursion.
Learn how to merge two arrays of objects, while combining objects based on a specified key.
Convert all the keys of an object to upper or lower case.
Find all the keys in a JavaScript object that match the given value.
Learn how to invert the key-value pairs of an object in JavaScript.
Learn how to transform objects by filtering their properties based on an array of keys or a predicate function.
Using the Proxy object, we can create dynamic getters and setters for objects in JavaScript.
Assign default values for all properties in an object that are undefined
.
Have you ever wanted to serialize an object but only include certain keys? Turns out JavaScript provides an easy way to do this!
Group the elements of an array based on the given function, producing an object with the grouped values.
Iterate over all own properties of an object, running a callback for each one.
Using the Proxy object, we can create chainable dynamic getters for objects in JavaScript.
JavaScript's strict mode can make your code faster, cleaner and more secure.
Create an array of objects from an object and one of its array-valued properties.
Learn how to type check objects at runtime using the powerful Proxy object in JavaScript.
Create a generator that walks through all the keys of a given object.