diff --git a/curriculum/challenges/_meta/learn-advanced-array-methods-by-building-a-statistics-calculator/meta.json b/curriculum/challenges/_meta/learn-advanced-array-methods-by-building-a-statistics-calculator/meta.json index efe4168729c..19d22067a1e 100644 --- a/curriculum/challenges/_meta/learn-advanced-array-methods-by-building-a-statistics-calculator/meta.json +++ b/curriculum/challenges/_meta/learn-advanced-array-methods-by-building-a-statistics-calculator/meta.json @@ -122,96 +122,116 @@ "title": "Step 27" }, { - "id": "6352ea3a5b79e614ee2282fd", + "id": "65aac0678d51b3f1a0cb8061", "title": "Step 28" }, { - "id": "6352ebd3ab962c168a122e85", + "id": "65c4dc57418fd6bfc710d61d", "title": "Step 29" }, { - "id": "6352ec8b9c70fd17b8c7ba3f", + "id": "65ca2d0625aa3a3201067f70", "title": "Step 30" }, { - "id": "6352ecef9f045519063da9b3", + "id": "65e62efde0592ec4b4bb6a69", "title": "Step 31" }, { - "id": "6352edee8a4de01ad693f0e4", + "id": "65f83a7ca7047318e3ccff7c", "title": "Step 32" }, { - "id": "6352ee566a59d31d24bde74b", + "id": "6352ea3a5b79e614ee2282fd", "title": "Step 33" }, { - "id": "6352f09b1e53a420e7873344", + "id": "6352ebd3ab962c168a122e85", "title": "Step 34" }, { - "id": "6352f179bdca23221298a5ba", + "id": "6352ec8b9c70fd17b8c7ba3f", "title": "Step 35" }, { - "id": "6352f2526dccb523150b64fb", + "id": "6352ecef9f045519063da9b3", "title": "Step 36" }, { - "id": "6352f2a24eb71b24284ca2b6", + "id": "6352edee8a4de01ad693f0e4", "title": "Step 37" }, { - "id": "6352faf71a9db52631864634", + "id": "6352ee566a59d31d24bde74b", "title": "Step 38" }, { - "id": "6352fbb93a91a8272f838d42", + "id": "6352f09b1e53a420e7873344", "title": "Step 39" }, { - "id": "6352fcb156834128001ea945", + "id": "6352f179bdca23221298a5ba", "title": "Step 40" }, { - "id": "6352fce75b2d3b2924930f1e", + "id": "6352f2526dccb523150b64fb", "title": "Step 41" }, { - "id": "6352fe473d53592a40ae403b", + "id": "6352f2a24eb71b24284ca2b6", "title": "Step 42" }, { - "id": "6352fed209792d2b89e92ea1", + "id": "6352faf71a9db52631864634", "title": "Step 43" }, { - "id": "6352ff27e0e51b2c7dce0010", + "id": "6352fbb93a91a8272f838d42", "title": "Step 44" }, { - "id": "6352ffe4cfafa72d595a0007", + "id": "6352fcb156834128001ea945", "title": "Step 45" }, { - "id": "6353004b235d7a2e0b913f2b", + "id": "6352fce75b2d3b2924930f1e", "title": "Step 46" }, { - "id": "6353024f5eab012fa2f57eec", + "id": "6352fe473d53592a40ae403b", "title": "Step 47" }, { - "id": "6353028147d3c7309017216a", + "id": "6352fed209792d2b89e92ea1", "title": "Step 48" }, { - "id": "635302be760d6031d11a06cd", + "id": "6352ff27e0e51b2c7dce0010", "title": "Step 49" }, { - "id": "6374249d3fbf2a5b079ba036", + "id": "6352ffe4cfafa72d595a0007", "title": "Step 50" + }, + { + "id": "6353004b235d7a2e0b913f2b", + "title": "Step 51" + }, + { + "id": "6353024f5eab012fa2f57eec", + "title": "Step 52" + }, + { + "id": "6353028147d3c7309017216a", + "title": "Step 53" + }, + { + "id": "635302be760d6031d11a06cd", + "title": "Step 54" + }, + { + "id": "6374249d3fbf2a5b079ba036", + "title": "Step 55" } ] } \ No newline at end of file diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e93db104661305c5f658.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e93db104661305c5f658.md index b3f924b675f..ba3a16425c3 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e93db104661305c5f658.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e93db104661305c5f658.md @@ -7,7 +7,30 @@ dashedName: step-26 # --description-- -In your new function, declare an empty `counts` object. You will use this to track the number of times each number appears in the list. +To calculate the occurrence you can use the following approach: + +```js +const numbersArr = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4]; +const counts = {}; +numbersArr.forEach((el) => { + if (counts[el]) { + counts[el] += 1; + } else { + counts[el] = 1; + } +}); +``` + +Check if the current number is already in the `counts` object. If it is, incremented by `1`. If it is not, set it to `1`. + +Resulting object. The keys are the numbers from the array and the values are the number of times each number appears in the list: + +```js +{ 1: 3, 2: 3, 3: 3, 4: 3, 5: 2 } +``` + +For this step, start by declaring an empty `counts` object. Later on in the project, you will use this object to calculate the mode of the list of numbers. + # --hints-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e96d2604f813c656750b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e96d2604f813c656750b.md index ac0e2ac90dd..031b9f2a733 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e96d2604f813c656750b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e96d2604f813c656750b.md @@ -7,28 +7,16 @@ dashedName: step-27 # --description-- -Remember that the `.forEach()` method allows you to run a callback function for each element in the array. +To better understand how the `getMode` function is going to work, you will need to print out its contents. This will allow you to see what is happening as you build out the function. But first you will need to return the `array` so it can be tested properly. -Use the `.forEach()` method to loop through the `array`. In the callback, use the `el` parameter to access the `counts` object and increment the count for each number. +Inside your `getMode` function return your `array` parameter. # --hints-- -Your `getMode` function should use the `.forEach()` method. +You should return the `array` parameter inside the `getMode` function. ```js -assert.match(getMode.toString(), /array\.forEach\(/); -``` - -Your `.forEach()` method should have a callback function which takes an `el` parameter. - -```js -assert.match(getMode.toString(), /(array\.forEach\(\s*(\(\s*el\s*\)|el)\s*=>|array\.forEach\(\s*function\s*\(\s*el\s*\)\s*\{)/); -``` - -Your `.forEach()` method should increment the count for each number. Don't forget the fallback value. - -```js -assert.match(getMode.toString(), /(array\.forEach\(\s*(\(\s*el\s*\)|el)\s*=>|array\.forEach\(\s*function\s*\(\s*el\s*\)\s*\{)\s*\{?\s*(return)?\s*counts\s*\[\s*el\s*\]\s*=\s*\(\s*counts\s*\[\s*el\s*\]\s*\|\|\s*0\s*\)\s*\+\s*1\s*\}?/); +assert.match(getMode.toString(), /return\s+array\s*;?/); ``` # --seed-- @@ -118,34 +106,33 @@ input { ``` ```js -const getMean = (array) => array.reduce((acc, el) => acc + el, 0) / array.length; +const getMean = array => array.reduce((acc, el) => acc + el, 0) / array.length; -const getMedian = (array) => { +const getMedian = array => { const sorted = array.sort((a, b) => a - b); const median = array.length % 2 === 0 ? getMean([sorted[array.length / 2], sorted[array.length / 2 - 1]]) : sorted[Math.floor(array.length / 2)]; return median; -} +}; ---fcc-editable-region-- -const getMode = (array) => { +const getMode = array => { const counts = {}; + --fcc-editable-region-- -} ---fcc-editable-region-- - + --fcc-editable-region-- +}; const calculate = () => { - const value = document.querySelector("#numbers").value; + const value = document.querySelector('#numbers').value; const array = value.split(/,\s*/g); const numbers = array.map(el => Number(el)).filter(el => !isNaN(el)); - + const mean = getMean(numbers); const median = getMedian(numbers); - document.querySelector("#mean").textContent = mean; - document.querySelector("#median").textContent = median; -} + document.querySelector('#mean').textContent = mean; + document.querySelector('#median').textContent = median; +}; ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ea3a5b79e614ee2282fd.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ea3a5b79e614ee2282fd.md index 0639f3597f3..88ed8671056 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ea3a5b79e614ee2282fd.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ea3a5b79e614ee2282fd.md @@ -1,8 +1,8 @@ --- id: 6352ea3a5b79e614ee2282fd -title: Step 28 +title: Step 33 challengeType: 0 -dashedName: step-28 +dashedName: step-33 --- # --description-- @@ -140,10 +140,7 @@ const getMedian = (array) => { --fcc-editable-region-- const getMode = (array) => { const counts = {}; - array.forEach((el) => { - counts[el] = (counts[el] || 0) + 1; - }) - + array.forEach(el => counts[el] = (counts[el] || 0) + 1) } --fcc-editable-region-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ebd3ab962c168a122e85.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ebd3ab962c168a122e85.md index 87a51007f65..08ad0b34849 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ebd3ab962c168a122e85.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ebd3ab962c168a122e85.md @@ -1,8 +1,8 @@ --- id: 6352ebd3ab962c168a122e85 -title: Step 29 +title: Step 34 challengeType: 0 -dashedName: step-29 +dashedName: step-34 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ec8b9c70fd17b8c7ba3f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ec8b9c70fd17b8c7ba3f.md index d4090b5711c..fc874424639 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ec8b9c70fd17b8c7ba3f.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ec8b9c70fd17b8c7ba3f.md @@ -1,8 +1,8 @@ --- id: 6352ec8b9c70fd17b8c7ba3f -title: Step 30 +title: Step 35 challengeType: 0 -dashedName: step-30 +dashedName: step-35 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ecef9f045519063da9b3.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ecef9f045519063da9b3.md index a25b1801a66..2feb5e280e6 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ecef9f045519063da9b3.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ecef9f045519063da9b3.md @@ -1,8 +1,8 @@ --- id: 6352ecef9f045519063da9b3 -title: Step 31 +title: Step 36 challengeType: 0 -dashedName: step-31 +dashedName: step-36 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352edee8a4de01ad693f0e4.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352edee8a4de01ad693f0e4.md index 7663e663235..132c261f1cb 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352edee8a4de01ad693f0e4.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352edee8a4de01ad693f0e4.md @@ -1,8 +1,8 @@ --- id: 6352edee8a4de01ad693f0e4 -title: Step 32 +title: Step 37 challengeType: 0 -dashedName: step-32 +dashedName: step-37 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ee566a59d31d24bde74b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ee566a59d31d24bde74b.md index a0ddf971cfa..b1aa8b94681 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ee566a59d31d24bde74b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ee566a59d31d24bde74b.md @@ -1,8 +1,8 @@ --- id: 6352ee566a59d31d24bde74b -title: Step 33 +title: Step 38 challengeType: 0 -dashedName: step-33 +dashedName: step-38 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f09b1e53a420e7873344.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f09b1e53a420e7873344.md index 18d8a8f6e2a..03a9f6d5a9e 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f09b1e53a420e7873344.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f09b1e53a420e7873344.md @@ -1,8 +1,8 @@ --- id: 6352f09b1e53a420e7873344 -title: Step 34 +title: Step 39 challengeType: 0 -dashedName: step-34 +dashedName: step-39 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f179bdca23221298a5ba.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f179bdca23221298a5ba.md index 2cacfe6dd2c..dea3e2d12e3 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f179bdca23221298a5ba.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f179bdca23221298a5ba.md @@ -1,8 +1,8 @@ --- id: 6352f179bdca23221298a5ba -title: Step 35 +title: Step 40 challengeType: 0 -dashedName: step-35 +dashedName: step-40 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f2526dccb523150b64fb.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f2526dccb523150b64fb.md index cd43da91db2..f9b9d4a9e66 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f2526dccb523150b64fb.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f2526dccb523150b64fb.md @@ -1,8 +1,8 @@ --- id: 6352f2526dccb523150b64fb -title: Step 36 +title: Step 41 challengeType: 0 -dashedName: step-36 +dashedName: step-41 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f2a24eb71b24284ca2b6.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f2a24eb71b24284ca2b6.md index 2c7bba39ff2..f3349635bd7 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f2a24eb71b24284ca2b6.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f2a24eb71b24284ca2b6.md @@ -1,8 +1,8 @@ --- id: 6352f2a24eb71b24284ca2b6 -title: Step 37 +title: Step 42 challengeType: 0 -dashedName: step-37 +dashedName: step-42 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352faf71a9db52631864634.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352faf71a9db52631864634.md index 703d7b44eec..e12d963476f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352faf71a9db52631864634.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352faf71a9db52631864634.md @@ -1,8 +1,8 @@ --- id: 6352faf71a9db52631864634 -title: Step 38 +title: Step 43 challengeType: 0 -dashedName: step-38 +dashedName: step-43 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fbb93a91a8272f838d42.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fbb93a91a8272f838d42.md index adb70079857..748a964689e 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fbb93a91a8272f838d42.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fbb93a91a8272f838d42.md @@ -1,8 +1,8 @@ --- id: 6352fbb93a91a8272f838d42 -title: Step 39 +title: Step 44 challengeType: 0 -dashedName: step-39 +dashedName: step-44 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md index 2dd3ea02268..a9ebf1a0a4d 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md @@ -1,8 +1,8 @@ --- id: 6352fcb156834128001ea945 -title: Step 40 +title: Step 45 challengeType: 0 -dashedName: step-40 +dashedName: step-45 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fce75b2d3b2924930f1e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fce75b2d3b2924930f1e.md index 3cca7355590..9ed32b64db0 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fce75b2d3b2924930f1e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fce75b2d3b2924930f1e.md @@ -1,8 +1,8 @@ --- id: 6352fce75b2d3b2924930f1e -title: Step 41 +title: Step 46 challengeType: 0 -dashedName: step-41 +dashedName: step-46 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fe473d53592a40ae403b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fe473d53592a40ae403b.md index cf7cf15002f..a6a0907d469 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fe473d53592a40ae403b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fe473d53592a40ae403b.md @@ -1,8 +1,8 @@ --- id: 6352fe473d53592a40ae403b -title: Step 42 +title: Step 47 challengeType: 0 -dashedName: step-42 +dashedName: step-47 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fed209792d2b89e92ea1.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fed209792d2b89e92ea1.md index 8b2fb478b96..0c1896055e0 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fed209792d2b89e92ea1.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fed209792d2b89e92ea1.md @@ -1,8 +1,8 @@ --- id: 6352fed209792d2b89e92ea1 -title: Step 43 +title: Step 48 challengeType: 0 -dashedName: step-43 +dashedName: step-48 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ff27e0e51b2c7dce0010.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ff27e0e51b2c7dce0010.md index c7c9986ba4c..425d506d406 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ff27e0e51b2c7dce0010.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ff27e0e51b2c7dce0010.md @@ -1,8 +1,8 @@ --- id: 6352ff27e0e51b2c7dce0010 -title: Step 44 +title: Step 49 challengeType: 0 -dashedName: step-44 +dashedName: step-49 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ffe4cfafa72d595a0007.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ffe4cfafa72d595a0007.md index 0b66945d484..b578054c742 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ffe4cfafa72d595a0007.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ffe4cfafa72d595a0007.md @@ -1,8 +1,8 @@ --- id: 6352ffe4cfafa72d595a0007 -title: Step 45 +title: Step 50 challengeType: 0 -dashedName: step-45 +dashedName: step-50 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6353004b235d7a2e0b913f2b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6353004b235d7a2e0b913f2b.md index 8865585e9f2..a056a62e106 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6353004b235d7a2e0b913f2b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6353004b235d7a2e0b913f2b.md @@ -1,8 +1,8 @@ --- id: 6353004b235d7a2e0b913f2b -title: Step 46 +title: Step 51 challengeType: 0 -dashedName: step-46 +dashedName: step-51 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6353024f5eab012fa2f57eec.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6353024f5eab012fa2f57eec.md index a84fcbb2d45..e6be6540cf4 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6353024f5eab012fa2f57eec.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6353024f5eab012fa2f57eec.md @@ -1,8 +1,8 @@ --- id: 6353024f5eab012fa2f57eec -title: Step 47 +title: Step 52 challengeType: 0 -dashedName: step-47 +dashedName: step-52 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6353028147d3c7309017216a.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6353028147d3c7309017216a.md index 4e1bfe9c9fa..156118c9a93 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6353028147d3c7309017216a.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6353028147d3c7309017216a.md @@ -1,8 +1,8 @@ --- id: 6353028147d3c7309017216a -title: Step 48 +title: Step 53 challengeType: 0 -dashedName: step-48 +dashedName: step-53 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635302be760d6031d11a06cd.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635302be760d6031d11a06cd.md index a3830b2fb8c..e0bb3bbb859 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635302be760d6031d11a06cd.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635302be760d6031d11a06cd.md @@ -1,8 +1,8 @@ --- id: 635302be760d6031d11a06cd -title: Step 49 +title: Step 54 challengeType: 0 -dashedName: step-49 +dashedName: step-54 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6374249d3fbf2a5b079ba036.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6374249d3fbf2a5b079ba036.md index c6d82667489..43d09221faf 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6374249d3fbf2a5b079ba036.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6374249d3fbf2a5b079ba036.md @@ -1,8 +1,8 @@ --- id: 6374249d3fbf2a5b079ba036 -title: Step 50 +title: Step 55 challengeType: 0 -dashedName: step-50 +dashedName: step-55 --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/65aac0678d51b3f1a0cb8061.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/65aac0678d51b3f1a0cb8061.md new file mode 100644 index 00000000000..c340d1502ed --- /dev/null +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/65aac0678d51b3f1a0cb8061.md @@ -0,0 +1,147 @@ +--- +id: 65aac0678d51b3f1a0cb8061 +title: Step 28 +challengeType: 0 +dashedName: step-28 +--- + +# --description-- + +Inside the `calculate` function, you have already called the `getMean` and `getMedian` functions. + +Below those function calls, add a `console.log(getMode(numbers))`. + +To see the result, enter the numbers `4, 4, 2, 5` and click on the `"Calculate"` button. Open up the console to see the following array: + +```js +[ 2, 4, 4, 5 ] +``` + +# --hints-- + +You should call `console.log(getMode(numbers))` inside the `calculate` function. + +```js +assert.match(calculate.toString(), /console\.log\(getMode\(numbers\)\)/); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +
+ + + + +Enter a list of comma-separated numbers.
+ ++ The mean of a list of numbers is the average, calculated by + taking the sum of all numbers and dividing that by the count of numbers. +
+Mean:
++ The median of a list of numbers is the number that appears in + the middle of the list, when sorted from least to greatest. +
+Median:
++ The mode of a list of numbers is the number that appears most + often in the list. +
+Mode:
++ The range of a list of numbers is the difference between the + largest and smallest numbers in the list. +
+Range:
++ The variance of a list of numbers measures how far the values + are from the mean, on average. +
+Variance:
++ The standard deviation of a list of numbers is the square + root of the variance. +
++ Standard Deviation: +
+Enter a list of comma-separated numbers.
+ ++ The mean of a list of numbers is the average, calculated by + taking the sum of all numbers and dividing that by the count of numbers. +
+Mean:
++ The median of a list of numbers is the number that appears in + the middle of the list, when sorted from least to greatest. +
+Median:
++ The mode of a list of numbers is the number that appears most + often in the list. +
+Mode:
++ The range of a list of numbers is the difference between the + largest and smallest numbers in the list. +
+Range:
++ The variance of a list of numbers measures how far the values + are from the mean, on average. +
+Variance:
++ The standard deviation of a list of numbers is the square + root of the variance. +
++ Standard Deviation: +
+Enter a list of comma-separated numbers.
+ ++ The mean of a list of numbers is the average, calculated by + taking the sum of all numbers and dividing that by the count of numbers. +
+Mean:
++ The median of a list of numbers is the number that appears in + the middle of the list, when sorted from least to greatest. +
+Median:
++ The mode of a list of numbers is the number that appears most + often in the list. +
+Mode:
++ The range of a list of numbers is the difference between the + largest and smallest numbers in the list. +
+Range:
++ The variance of a list of numbers measures how far the values + are from the mean, on average. +
+Variance:
++ The standard deviation of a list of numbers is the square + root of the variance. +
++ Standard Deviation: +
+Enter a list of comma-separated numbers.
+ ++ The mean of a list of numbers is the average, calculated by + taking the sum of all numbers and dividing that by the count of numbers. +
+Mean:
++ The median of a list of numbers is the number that appears in + the middle of the list, when sorted from least to greatest. +
+Median:
++ The mode of a list of numbers is the number that appears most + often in the list. +
+Mode:
++ The range of a list of numbers is the difference between the + largest and smallest numbers in the list. +
+Range:
++ The variance of a list of numbers measures how far the values + are from the mean, on average. +
+Variance:
++ The standard deviation of a list of numbers is the square + root of the variance. +
++ Standard Deviation: +
+Enter a list of comma-separated numbers.
+ ++ The mean of a list of numbers is the average, calculated by + taking the sum of all numbers and dividing that by the count of numbers. +
+Mean:
++ The median of a list of numbers is the number that appears in + the middle of the list, when sorted from least to greatest. +
+Median:
++ The mode of a list of numbers is the number that appears most + often in the list. +
+Mode:
++ The range of a list of numbers is the difference between the + largest and smallest numbers in the list. +
+Range:
++ The variance of a list of numbers measures how far the values + are from the mean, on average. +
+Variance:
++ The standard deviation of a list of numbers is the square + root of the variance. +
++ Standard Deviation: +
+