diff --git a/snippets/formatDuration.md b/snippets/formatDuration.md index 82ed43ebb..b851e305e 100644 --- a/snippets/formatDuration.md +++ b/snippets/formatDuration.md @@ -10,7 +10,7 @@ Returns the human-readable format of the given number of milliseconds. - Divide `ms` with the appropriate values to obtain the appropriate values for `day`, `hour`, `minute`, `second` and `millisecond`. - Use `Object.entries()` with `Array.prototype.filter()` to keep only non-zero values. - Use `Array.prototype.map()` to create the string for each value, pluralizing appropriately. -- Use `String.prototype.join(', ')` to combine the values into a string. +- Use `String.prototype.join()` to combine the values into a string. ```js const formatDuration = ms => { diff --git a/snippets/formatSeconds.md b/snippets/formatSeconds.md index 90515b23d..9cae1cee5 100644 --- a/snippets/formatSeconds.md +++ b/snippets/formatSeconds.md @@ -10,7 +10,7 @@ Returns the ISO format of the given number of seconds. - Divide `s` with the appropriate values to obtain the appropriate values for `hour`, `minute` and `second`. - Store the `sign` in a variable to prepend it to the result. - Use `Array.prototype.map()` in combination with `Math.floor()` and `String.prototype.padStart()` to stringify and format each segment. -- Use `String.prototype.join(':')` to combine the values into a string. +- Use `String.prototype.join()` to combine the values into a string. ```js const formatSeconds = s => { diff --git a/snippets/get.md b/snippets/get.md index 2f7dd2f43..1ab333c20 100644 --- a/snippets/get.md +++ b/snippets/get.md @@ -8,7 +8,7 @@ lastUpdated: 2020-10-19T22:49:51+03:00 Retrieves a set of properties indicated by the given selectors from an object. - Use `Array.prototype.map()` for each selector, `String.prototype.replace()` to replace square brackets with dots. -- Use `String.prototype.split('.')` to split each selector. +- Use `String.prototype.split()` to split each selector. - Use `Array.prototype.filter()` to remove empty values and `Array.prototype.reduce()` to get the value indicated by each selector. ```js diff --git a/snippets/palindrome.md b/snippets/palindrome.md index f5c1709f3..b1a6aefbf 100644 --- a/snippets/palindrome.md +++ b/snippets/palindrome.md @@ -9,7 +9,7 @@ Checks if the given string is a palindrome. - Normalize the string to `String.prototype.toLowerCase()` and use `String.prototype.replace()` to remove non-alphanumeric characters from it. - Use the spread operator (`...`) to split the normalized string into individual characters. -- Use `Array.prototype.reverse()`, `String.prototype.join('')` and compare the result to the normalized string. +- Use `Array.prototype.reverse()`, `String.prototype.join()` and compare the result to the normalized string. ```js const palindrome = str => { diff --git a/snippets/parseCookie.md b/snippets/parseCookie.md index 531058b22..77c17fcc5 100644 --- a/snippets/parseCookie.md +++ b/snippets/parseCookie.md @@ -7,8 +7,8 @@ lastUpdated: 2020-10-22T20:24:04+03:00 Parses an HTTP Cookie header string, returning an object of all cookie name-value pairs. -- Use `String.prototype.split(';')` to separate key-value pairs from each other. -- Use `Array.prototype.map()` and `String.prototype.split('=')` to separate keys from values in each pair. +- Use `String.prototype.split()` to separate key-value pairs from each other. +- Use `Array.prototype.map()` and `String.prototype.split()` to separate keys from values in each pair. - Use `Array.prototype.reduce()` and `decodeURIComponent()` to create an object with all key-value pairs. ```js diff --git a/snippets/reverseNumber.md b/snippets/reverseNumber.md index 77fbd4646..a46e31544 100644 --- a/snippets/reverseNumber.md +++ b/snippets/reverseNumber.md @@ -8,11 +8,11 @@ lastUpdated: 2020-09-18T21:19:23+03:00 Reverses a number. - Use `Object.prototype.toString()` to convert `n` to a string. -- Use `String.prototype.split('')`, `Array.prototype.reverse()` and `String.prototype.join('')` to get the reversed value of `n` as a string. +- Use `String.prototype.split()`, `Array.prototype.reverse()` and `String.prototype.join()` to get the reversed value of `n` as a string. - Use `parseFloat()` to convert the string to a number and `Math.sign()` to preserve its sign. ```js -const reverseNumber = n => +const reverseNumber = n => parseFloat(`${n}`.split('').reverse().join('')) * Math.sign(n); ```