Update formatting

This commit is contained in:
Isabelle Viktoria Maciohsek
2022-01-30 12:03:45 +02:00
parent 8b3ee1c65b
commit 3596467b4b
4 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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

View File

@ -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.

View File

@ -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.