diff --git a/snippets/cloneRegExp.md b/snippets/cloneRegExp.md index 2754495f2..5ebbb6558 100644 --- a/snippets/cloneRegExp.md +++ b/snippets/cloneRegExp.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:23:47+03:00 Clones a regular expression. -- Use `new RegExp()`, `RegExp.prototype.source` and `RegExp.prototype.flags` to clone the given regular expression. +- Use the `RegExp` constructor, `RegExp.prototype.source` and `RegExp.prototype.flags` to clone the given regular expression. ```js const cloneRegExp = regExp => new RegExp(regExp.source, regExp.flags); diff --git a/snippets/queryStringToObject.md b/snippets/queryStringToObject.md index 202d78720..e0f3be07b 100644 --- a/snippets/queryStringToObject.md +++ b/snippets/queryStringToObject.md @@ -8,7 +8,7 @@ lastUpdated: 2020-11-03T22:11:18+02:00 Generates an object from the given query string or URL. - Use `String.prototype.split()` to get the params from the given `url`. -- Use `new URLSearchParams()` to create an appropriate object and convert it to an array of key-value pairs using the spread operator (`...`). +- Use the `URLSearchParams` constructor to create an appropriate object and convert it to an array of key-value pairs using the spread operator (`...`). - Use `Array.prototype.reduce()` to convert the array of key-value pairs into an object. ```js diff --git a/snippets/stringifyCircularJSON.md b/snippets/stringifyCircularJSON.md index d3406922f..baeb51528 100644 --- a/snippets/stringifyCircularJSON.md +++ b/snippets/stringifyCircularJSON.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:24:30+03:00 Serializes a JSON object containing circular references into a JSON format. -- Create a `new WeakSet()` to store and check seen values, using `WeakSet.prototype.add()` and `WeakSet.prototype.has()`. +- Create a `WeakSet` to store and check seen values, using `WeakSet.prototype.add()` and `WeakSet.prototype.has()`. - Use `JSON.stringify()` with a custom replacer function that omits values already in `seen`, adding new values as necessary. - ⚠️ **NOTICE:** This function finds and removes circular references, which causes circular data loss in the serialized JSON. diff --git a/snippets/triggerEvent.md b/snippets/triggerEvent.md index 4f6a92d8a..6abb34027 100644 --- a/snippets/triggerEvent.md +++ b/snippets/triggerEvent.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:24:44+03:00 Triggers a specific event on a given element, optionally passing custom data. -- Use `new CustomEvent()` to create an event from the specified `eventType` and details. +- Use the `CustomEvent` constructor to create an event from the specified `eventType` and details. - Use `EventTarget.dispatchEvent()` to trigger the newly created event on the given element. - Omit the third argument, `detail`, if you do not want to pass custom data to the triggered event.