Fix typos
This commit is contained in:
@ -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"
|
||||
|
||||
@ -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};",
|
||||
|
||||
@ -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"
|
||||
]
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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};",
|
||||
|
||||
Reference in New Issue
Block a user