January 27, 2023
No items found.
The Object.getOwnPropertyDescriptors() method: This method returns an object that has the same property descriptors as the given object. It allows you to access the property descriptor of any object, including non-enumerable properties.
The String.prototype.trimStart() and String.prototype.trimEnd() methods: These methods were introduced in ES2019 and they allow you to remove whitespace from the beginning and end of a string, respectively.
The globalThis property: This property was introduced in ES2020 and it gives you a way to access the global object from any context, whether it is a web page, web worker, or a Node.js script.
The matchAll() method: This method was introduced in ES2020 and returns an iterator of all results matching a regular expression in a given string.
Efficiently Converting Float to Integer: Traditionally, the conversion of float to an integer involved the use of Math.ceil(), Math.floor() or Math.round(), however by using a bitwise OR Operator, this conversion can be simplified and sped up.
The IN operator: The ‘IN’ keyword can be utilised to determine if a string or symbol property is defined in an object. This feature both reduces the amount of code required, and prevents errors when accessing private property which may be null.