diff --git a/snippet_data/archivedSnippetList.json b/snippet_data/archivedSnippetList.json index 9461d44ef..4ee5c0b46 100644 --- a/snippet_data/archivedSnippetList.json +++ b/snippet_data/archivedSnippetList.json @@ -65,7 +65,7 @@ "type": "snippetListing", "title": "countVowels", "attributes": { - "text": "Retuns `number` of vowels in provided string.\n\nUse a regular expression to count the number of vowels `(A, E, I, O, U)` in a `string`.\n\n", + "text": "Returns `number` of vowels in provided string.\n\nUse a regular expression to count the number of vowels `(A, E, I, O, U)` in a `string`.\n\n", "tags": [ "string", "beginner" diff --git a/snippet_data/archivedSnippets.json b/snippet_data/archivedSnippets.json index 73b2ea2da..e3e454f1e 100644 --- a/snippet_data/archivedSnippets.json +++ b/snippet_data/archivedSnippets.json @@ -106,7 +106,7 @@ "type": "snippet", "attributes": { "fileName": "countVowels.md", - "text": "Retuns `number` of vowels in provided string.\n\nUse a regular expression to count the number of vowels `(A, E, I, O, U)` in a `string`.\n\n", + "text": "Returns `number` of vowels in provided string.\n\nUse a regular expression to count the number of vowels `(A, E, I, O, U)` in a `string`.\n\n", "codeBlocks": { "es6": "const countVowels = str => (str.match(/[aeiou]/gi) || []).length;", "es5": "var countVowels = function countVowels(str) {\n return (str.match(/[aeiou]/gi) || []).length;\n};", diff --git a/snippet_data/glossaryTerms.json b/snippet_data/glossaryTerms.json index 215d861da..e2a3f317c 100644 --- a/snippet_data/glossaryTerms.json +++ b/snippet_data/glossaryTerms.json @@ -915,7 +915,7 @@ "type": "glossaryTerm", "title": "Recursion", "attributes": { - "text": "Recursion is the repeated application of a process. \nIn JavaScript, recursion involves functions that call themselves repeatedly until they reach a base condition. \nThe base condition breaks out of the recursion loop because otherwise the function would call itself indefinitely. \nRecursion is very useful when working with nested data, especially when the nesting depth is dynamically defined or unkown.\n", + "text": "Recursion is the repeated application of a process. \nIn JavaScript, recursion involves functions that call themselves repeatedly until they reach a base condition. \nThe base condition breaks out of the recursion loop because otherwise the function would call itself indefinitely. \nRecursion is very useful when working with nested data, especially when the nesting depth is dynamically defined or unknown.\n", "tags": [ "Recursion" ] diff --git a/snippet_data/snippetList.json b/snippet_data/snippetList.json index 076db11f6..214323e54 100644 --- a/snippet_data/snippetList.json +++ b/snippet_data/snippetList.json @@ -1858,7 +1858,7 @@ "type": "snippetListing", "title": "haveSameContents", "attributes": { - "text": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n\n", + "text": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurrences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n\n", "tags": [ "array", "intermediate" diff --git a/snippet_data/snippets.json b/snippet_data/snippets.json index f7ec82bac..02df5db56 100644 --- a/snippet_data/snippets.json +++ b/snippet_data/snippets.json @@ -3039,7 +3039,7 @@ "type": "snippet", "attributes": { "fileName": "haveSameContents.md", - "text": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n\n", + "text": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurrences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n\n", "codeBlocks": { "es6": "const haveSameContents = (a, b) => {\n for (const v of new Set([...a, ...b]))\n if (a.filter(e => e === v).length !== b.filter(e => e === v).length) return false;\n return true;\n};", "es5": "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\nvar haveSameContents = function haveSameContents(a, b) {\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n var _loop = function _loop() {\n var v = _step.value;\n if (a.filter(function (e) {\n return e === v;\n }).length !== b.filter(function (e) {\n return e === v;\n }).length) return {\n v: false\n };\n };\n\n for (var _iterator = new Set([].concat(_toConsumableArray(a), _toConsumableArray(b)))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var _ret = _loop();\n\n if (_typeof(_ret) === \"object\") return _ret.v;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n _iterator[\"return\"]();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return true;\n};", diff --git a/snippets/haveSameContents.md b/snippets/haveSameContents.md index f539e03a3..c85db2dc5 100644 --- a/snippets/haveSameContents.md +++ b/snippets/haveSameContents.md @@ -6,7 +6,7 @@ tags: array,intermediate Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise. Use a `for...of` loop over a `Set` created from the values of both arrays. -Use `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays. +Use `Array.prototype.filter()` to compare the amount of occurrences of each distinct value in both arrays. Return `false` if the counts do not match for any element, `true` otherwise. ```js diff --git a/snippets_archive/countVowels.md b/snippets_archive/countVowels.md index 77a593853..4111a147a 100644 --- a/snippets_archive/countVowels.md +++ b/snippets_archive/countVowels.md @@ -3,7 +3,7 @@ title: countVowels tags: string,beginner --- -Retuns `number` of vowels in provided string. +Returns `number` of vowels in provided string. Use a regular expression to count the number of vowels `(A, E, I, O, U)` in a `string`. diff --git a/vscode_snippets/snippets.json b/vscode_snippets/snippets.json index d739feebf..f345f2f91 100644 --- a/vscode_snippets/snippets.json +++ b/vscode_snippets/snippets.json @@ -1202,7 +1202,7 @@ " return true;", "};" ], - "description": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n" + "description": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurrences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n" }, "head": { "prefix": "30s_head",