diff --git a/snippets/runAsync.md b/snippets/runAsync.md index 2a918e39b..1c33a6e2a 100644 --- a/snippets/runAsync.md +++ b/snippets/runAsync.md @@ -7,9 +7,9 @@ lastUpdated: 2020-10-22T20:24:30+03:00 Runs a function in a separate thread by using a [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers), allowing long running functions to not block the UI. -- Create a `new Worker()` using a `Blob` object URL, the contents of which should be the stringified version of the supplied function. +- Create a `Worker` using a `Blob` object URL, the contents of which should be the stringified version of the supplied function. - Immediately post the return value of calling the function back. -- Return a `new Promise()`, listening for `onmessage` and `onerror` events and resolving the data posted back from the worker, or throwing an error. +- Return a `Promise`, listening for `onmessage` and `onerror` events and resolving the data posted back from the worker, or throwing an error. ```js const runAsync = fn => { diff --git a/snippets/sleep.md b/snippets/sleep.md index 30dea957d..b4ffeb529 100644 --- a/snippets/sleep.md +++ b/snippets/sleep.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:24:30+03:00 Delays the execution of an asynchronous function. -- Delay executing part of an `async` function, by putting it to sleep, returning a `new Promise()`. +- Delay executing part of an `async` function, by putting it to sleep, returning a `Promise`. ```js const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); diff --git a/snippets/weekOfYear.md b/snippets/weekOfYear.md index aeb0a8910..6a6f54863 100644 --- a/snippets/weekOfYear.md +++ b/snippets/weekOfYear.md @@ -6,7 +6,7 @@ firstSeen: 2021-08-15T05:00:00-04:00 Returns the zero-indexed week of the year that a date corresponds to. -- Use `new Date()` and `Date.prototype.getFullYear()` to get the first day of the year as a `Date` object. +- Use the `Date` constructor and `Date.prototype.getFullYear()` to get the first day of the year as a `Date` object. - Use `Date.prototype.setDate()`, `Date.prototype.getDate()` and `Date.prototype.getDay()` along with the modulo (`%`) operator to get the first Monday of the year. - Subtract the first Monday of the year from the given `date` and divide with the number of milliseconds in a week. - Use `Math.round()` to get the zero-indexed week of the year corresponding to the given `date`. diff --git a/snippets/yesterday.md b/snippets/yesterday.md index 63df1041e..42dc14de6 100644 --- a/snippets/yesterday.md +++ b/snippets/yesterday.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:24:44+03:00 Results in a string representation of yesterday's date. -- Use `new Date()` to get the current date. +- Use the `Date` constructor to get the current date. - Decrement it by one using `Date.prototype.getDate()` and set the value to the result using `Date.prototype.setDate()`. - Use `Date.prototype.toISOString()` to return a string in `yyyy-mm-dd` format.