From 8baa70b711af30a335a2b07657feb74f28733a6f Mon Sep 17 00:00:00 2001 From: Carlos Diaz Date: Thu, 13 Apr 2023 12:30:58 -0700 Subject: [PATCH 1/9] Adds hint to exercise There's an idea I've been made aware of called undesirable difficulty in learning theory. The idea is that sometimes obstacles are put in place that take the focus off learning a specific thing by introducing a challenge on a thing that might be related but not critical to the task at hand. In this exercise, I notice pretty much everyone reaches for the splice method and I suspect it is because of the language in the prompt. Specifically: "removes the other arguments from that array" I've added a hint that I think would not take away from the challenge but give learners an alternative way to think about the exercise. --- 04_removeFromArray/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/04_removeFromArray/README.md b/04_removeFromArray/README.md index d3a2ee9..4d1da13 100644 --- a/04_removeFromArray/README.md +++ b/04_removeFromArray/README.md @@ -10,7 +10,7 @@ removeFromArray([1, 2, 3, 4], 3); // should remove 3 and return [1,2,4] The first test on this one is fairly easy, but there are a few things to think about(or google) here for the later tests: +- throughout the logic in your `removeFromArray` function, you can manipulate the original array you pass into the function call or create a new array that is returned as the result. - how to remove a single element from an array - how to deal with multiple optional arguments in a javascript function - [Check this link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments). Scroll down to the bit about `Array.from` or the spread operator. - [Or this link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). - \ No newline at end of file From 5a2075512f043863c1d79a137c0e2e5752fb2c1a Mon Sep 17 00:00:00 2001 From: Carlos Diaz Date: Sat, 15 Apr 2023 07:36:19 -0700 Subject: [PATCH 2/9] Update 04_removeFromArray/README.md Co-authored-by: Rachel Moser <33227096+rlmoser99@users.noreply.github.com> --- 04_removeFromArray/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/04_removeFromArray/README.md b/04_removeFromArray/README.md index 4d1da13..552debd 100644 --- a/04_removeFromArray/README.md +++ b/04_removeFromArray/README.md @@ -10,7 +10,7 @@ removeFromArray([1, 2, 3, 4], 3); // should remove 3 and return [1,2,4] The first test on this one is fairly easy, but there are a few things to think about(or google) here for the later tests: -- throughout the logic in your `removeFromArray` function, you can manipulate the original array you pass into the function call or create a new array that is returned as the result. +- you can manipulate the original array you pass into the function call or create a new array that is returned as the result. - how to remove a single element from an array - how to deal with multiple optional arguments in a javascript function - [Check this link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments). Scroll down to the bit about `Array.from` or the spread operator. - [Or this link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). From a0b07d91c971abfb2797218a6f27638e6b7de505 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 06:02:23 +0000 Subject: [PATCH 3/9] Bump @babel/traverse from 7.22.11 to 7.23.2 Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.11 to 7.23.2. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse) --- updated-dependencies: - dependency-name: "@babel/traverse" dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 90 +++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/package-lock.json b/package-lock.json index 06a4e1b..7a7f3fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,12 +39,12 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.10.tgz", - "integrity": "sha512-/KKIMG4UEL35WmI9OlvMhurwtytjvXoFcGNrOvyG9zIzA8YmPjVtIZUf7b05+TPO7G7/GEmLHDaoCgACHl9hhA==", + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", "dev": true, "dependencies": { - "@babel/highlight": "^7.22.10", + "@babel/highlight": "^7.22.13", "chalk": "^2.4.2" }, "engines": { @@ -177,12 +177,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.10.tgz", - "integrity": "sha512-79KIf7YiWjjdZ81JnLujDRApWtl7BxTqWD88+FFdQEIOG8LJ0etDOM7CXuIgGJa55sGOwZVwuEsaLEm0PJ5/+A==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dev": true, "dependencies": { - "@babel/types": "^7.22.10", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -217,22 +217,22 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz", - "integrity": "sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-function-name": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz", - "integrity": "sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "dependencies": { - "@babel/template": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" @@ -324,9 +324,9 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", - "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true, "engines": { "node": ">=6.9.0" @@ -356,12 +356,12 @@ } }, "node_modules/@babel/highlight": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.10.tgz", - "integrity": "sha512-78aUtVcT7MUscr0K5mIEnkwxPE0MaxkR5RxRwuHaQ+JuU5AmTPhY+do2mdzVTnIJJpyBglql2pehuBIWHug+WQ==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, @@ -441,9 +441,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.11.tgz", - "integrity": "sha512-R5zb8eJIBPJriQtbH/htEQy4k7E2dHWlD2Y2VT07JCzwYZHBxV5ZYtM0UhXSNMT74LyxuM+b1jdL7pSesXbC/g==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -630,33 +630,33 @@ } }, "node_modules/@babel/template": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.5.tgz", - "integrity": "sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.5", - "@babel/parser": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.11.tgz", - "integrity": "sha512-mzAenteTfomcB7mfPtyi+4oe5BZ6MXxWcn4CX+h4IRJ+OOGXBrWU6jDQavkQI9Vuc5P+donFabBfFCcmWka9lQ==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.10", - "@babel/generator": "^7.22.10", - "@babel/helper-environment-visitor": "^7.22.5", - "@babel/helper-function-name": "^7.22.5", + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.22.11", - "@babel/types": "^7.22.11", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -674,13 +674,13 @@ } }, "node_modules/@babel/types": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.11.tgz", - "integrity": "sha512-siazHiGuZRz9aB9NpHy9GOs9xiQPKnMzgdr493iI1M67vRXpnEq8ZOOKzezC5q7zwuQ6sDhdSp4SD9ixKSqKZg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { From f4293596b7b9fdb2f0da83cff8fb4a91256f86ea Mon Sep 17 00:00:00 2001 From: MaoShizhong <122839503+MaoShizhong@users.noreply.github.com> Date: Mon, 15 Jan 2024 09:06:44 +0000 Subject: [PATCH 4/9] Improve wording in README regarding TOP provided solution Same change made in parallel with the css-exercises repo to unify wording. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f0b0250..0baef88 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ If you have a suggestion to improve an exercise, an idea for a new exercise, or 2. Before you start working on any exercises, you should first ensure you have the following installed: - **NPM**. You should have installed NPM already in our [Installing Node.js](https://www.theodinproject.com/paths/foundations/courses/foundations/lessons/installing-node-js) lesson. Just in case you need to check, type `npm --version` in your terminal. If you get back `Command 'npm' not found, but can be installed with:`, **do not follow the instructions in the terminal** to install with `apt-get` as this causes permission issues. Instead, go back to the installation lesson and install Node with NVM by following the instructions there. - **Jest**. After cloning this repository to your local machine and installing NPM, go into the newly created directory (`cd javascript-exercises`) and run `npm install`. This will install Jest and set up the testing platform based on our preconfigured settings. (Note: if you get warnings that packages are out of date or contain vulnerabilities, you can safely ignore them for these exercises.) - + 3. Each exercise includes the following: - A markdown file with a description of the task, an empty (or mostly empty) JavaScript file, and a set of tests. @@ -26,7 +26,7 @@ If you have a suggestion to improve an exercise, an idea for a new exercise, or 4. Some of the exercises have test conditions defined in their spec file as `test.skip` compared to `test`. This is purposeful. After you pass one `test`, you will change the next `test.skip` to `test` and test your code again. You'll do this until all conditions are satisfied. **All tests must pass at the same time**, and you should not have any `test.skip` instances by the time you finish an exercise. 5. Once you successfully finish an exercise, check the `solutions` directory within each exercise to compare it with yours. - You should not be checking the solution for an exercise until you finish it! - - Keep in mind that TOP's solution is not the only solution. Generally as long as all of the tests pass, your solution should be fine. + - If your solution differs wildly from TOP's solution (and still passes the self-check criteria), that's completely fine. Do feel free to ask about it in the chatroom if there are parts you do not understand. 6. Do not submit your solutions to this repo, as any PRs that do so will be closed without merging. **Note**: Due to the way Jest handles failed tests, it may return an exit code of 1 if any tests fail. NPM will interpret this as an error and you may see some `npm ERR!` messages after Jest runs. You can ignore these, or run your test with `npm test exerciseName.spec.js --silent` to supress the errors. From e7f5d91bd18976e8197bfe3568fc68423242ab5b Mon Sep 17 00:00:00 2001 From: kennotfindsymbol <129994557+kennotfindsymbol@users.noreply.github.com> Date: Fri, 19 Jan 2024 19:19:49 +0800 Subject: [PATCH 5/9] Fix typo I think it should be 'randomly' instead of 'randomaly' on line31. --- 02_repeatString/solution/repeatString-solution.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02_repeatString/solution/repeatString-solution.spec.js b/02_repeatString/solution/repeatString-solution.spec.js index c506ce1..e50b3d9 100644 --- a/02_repeatString/solution/repeatString-solution.spec.js +++ b/02_repeatString/solution/repeatString-solution.spec.js @@ -28,7 +28,7 @@ describe('repeatString', () => { const number = Math.floor(Math.random() * 1000); /*The .match(/((hey))/g).length is a regex that will count the number of heys in the result, which if your function works correctly will equal the number that - was randomaly generated. */ + was randomly generated. */ expect(repeatString('hey', number).match(/((hey))/g).length).toEqual( number ); From f682844f772a550b95564c0b87172784ec11256a Mon Sep 17 00:00:00 2001 From: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com> Date: Fri, 19 Jan 2024 08:13:57 -0500 Subject: [PATCH 6/9] Update 04_removeFromArray/README.md --- 04_removeFromArray/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/04_removeFromArray/README.md b/04_removeFromArray/README.md index 552debd..2df2e8b 100644 --- a/04_removeFromArray/README.md +++ b/04_removeFromArray/README.md @@ -13,4 +13,4 @@ The first test on this one is fairly easy, but there are a few things to think a - you can manipulate the original array you pass into the function call or create a new array that is returned as the result. - how to remove a single element from an array - how to deal with multiple optional arguments in a javascript function -- [Check this link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments). Scroll down to the bit about `Array.from` or the spread operator. - [Or this link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). +- For more information, check out MDN's page on [function arguments](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments) - scroll down to the bit about `Array.from` or the spread operator. You can also check out MDN's page on [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). From d3a748812b2f82efc519e97ffd016276d7b68c89 Mon Sep 17 00:00:00 2001 From: MaoShizhong <122839503+MaoShizhong@users.noreply.github.com> Date: Fri, 19 Jan 2024 13:24:18 +0000 Subject: [PATCH 7/9] Update wording --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0baef88..df9df9a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ If you have a suggestion to improve an exercise, an idea for a new exercise, or 4. Some of the exercises have test conditions defined in their spec file as `test.skip` compared to `test`. This is purposeful. After you pass one `test`, you will change the next `test.skip` to `test` and test your code again. You'll do this until all conditions are satisfied. **All tests must pass at the same time**, and you should not have any `test.skip` instances by the time you finish an exercise. 5. Once you successfully finish an exercise, check the `solutions` directory within each exercise to compare it with yours. - You should not be checking the solution for an exercise until you finish it! - - If your solution differs wildly from TOP's solution (and still passes the self-check criteria), that's completely fine. Do feel free to ask about it in the chatroom if there are parts you do not understand. + - If your solution differs wildly from TOP's solution (and still passes the exercise's requirements), that's completely fine. Do feel free to ask about it in our Discord if there are parts you do not understand. 6. Do not submit your solutions to this repo, as any PRs that do so will be closed without merging. **Note**: Due to the way Jest handles failed tests, it may return an exit code of 1 if any tests fail. NPM will interpret this as an error and you may see some `npm ERR!` messages after Jest runs. You can ignore these, or run your test with `npm test exerciseName.spec.js --silent` to supress the errors. From c87cd1c9d892c85187d2573b1beaa43416120307 Mon Sep 17 00:00:00 2001 From: MaoShizhong <122839503+MaoShizhong@users.noreply.github.com> Date: Fri, 19 Jan 2024 13:28:31 +0000 Subject: [PATCH 8/9] Use lazy numbering as per style guide --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index df9df9a..5270cb6 100644 --- a/README.md +++ b/README.md @@ -13,21 +13,21 @@ If you have a suggestion to improve an exercise, an idea for a new exercise, or 1. Fork and clone this repository. To learn how to fork a repository, see the GitHub documentation on how to [fork a repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo). - Copies of repositories on your machine are called clones. If you need help cloning to your local environment you can learn how from the GitHub documentation on [cloning a repository](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository). -2. Before you start working on any exercises, you should first ensure you have the following installed: +1. Before you start working on any exercises, you should first ensure you have the following installed: - **NPM**. You should have installed NPM already in our [Installing Node.js](https://www.theodinproject.com/paths/foundations/courses/foundations/lessons/installing-node-js) lesson. Just in case you need to check, type `npm --version` in your terminal. If you get back `Command 'npm' not found, but can be installed with:`, **do not follow the instructions in the terminal** to install with `apt-get` as this causes permission issues. Instead, go back to the installation lesson and install Node with NVM by following the instructions there. - **Jest**. After cloning this repository to your local machine and installing NPM, go into the newly created directory (`cd javascript-exercises`) and run `npm install`. This will install Jest and set up the testing platform based on our preconfigured settings. (Note: if you get warnings that packages are out of date or contain vulnerabilities, you can safely ignore them for these exercises.) -3. Each exercise includes the following: +1. Each exercise includes the following: - A markdown file with a description of the task, an empty (or mostly empty) JavaScript file, and a set of tests. - A `solutions` directory that contains a solution and the same test file with all of the tests unskipped. To complete an exercise, you'll need to go to the exercise directory with `cd exerciseName` in the terminal and run `npm test exerciseName.spec.js`. This should run the test file and show you the output. When you first run a test, it will fail. This is by design! You must open the exercise file and write the code needed to get the test to pass. -4. Some of the exercises have test conditions defined in their spec file as `test.skip` compared to `test`. This is purposeful. After you pass one `test`, you will change the next `test.skip` to `test` and test your code again. You'll do this until all conditions are satisfied. **All tests must pass at the same time**, and you should not have any `test.skip` instances by the time you finish an exercise. -5. Once you successfully finish an exercise, check the `solutions` directory within each exercise to compare it with yours. +1. Some of the exercises have test conditions defined in their spec file as `test.skip` compared to `test`. This is purposeful. After you pass one `test`, you will change the next `test.skip` to `test` and test your code again. You'll do this until all conditions are satisfied. **All tests must pass at the same time**, and you should not have any `test.skip` instances by the time you finish an exercise. +1. Once you successfully finish an exercise, check the `solutions` directory within each exercise to compare it with yours. - You should not be checking the solution for an exercise until you finish it! - If your solution differs wildly from TOP's solution (and still passes the exercise's requirements), that's completely fine. Do feel free to ask about it in our Discord if there are parts you do not understand. -6. Do not submit your solutions to this repo, as any PRs that do so will be closed without merging. +1. Do not submit your solutions to this repo, as any PRs that do so will be closed without merging. **Note**: Due to the way Jest handles failed tests, it may return an exit code of 1 if any tests fail. NPM will interpret this as an error and you may see some `npm ERR!` messages after Jest runs. You can ignore these, or run your test with `npm test exerciseName.spec.js --silent` to supress the errors. From 3a49a90dd7431f84bf775f79bb10440046b0cd61 Mon Sep 17 00:00:00 2001 From: Damon <126731021+damon314159@users.noreply.github.com> Date: Mon, 5 Feb 2024 09:59:37 +0000 Subject: [PATCH 9/9] feat: extra test case --- 04_removeFromArray/removeFromArray.spec.js | 3 +++ 04_removeFromArray/solution/removeFromArray-solution.spec.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/04_removeFromArray/removeFromArray.spec.js b/04_removeFromArray/removeFromArray.spec.js index 21f34cf..823680f 100644 --- a/04_removeFromArray/removeFromArray.spec.js +++ b/04_removeFromArray/removeFromArray.spec.js @@ -7,6 +7,9 @@ describe('removeFromArray', () => { test.skip('removes multiple values', () => { expect(removeFromArray([1, 2, 3, 4], 3, 2)).toEqual([1, 4]); }); + test.skip('removes multiple of the same value', () => { + expect(removeFromArray([1, 2, 2, 3], 2)).toEqual([1, 3]); + }); test.skip('ignores non present values', () => { expect(removeFromArray([1, 2, 3, 4], 7, "tacos")).toEqual([1, 2, 3, 4]); }); diff --git a/04_removeFromArray/solution/removeFromArray-solution.spec.js b/04_removeFromArray/solution/removeFromArray-solution.spec.js index ed03e08..cc5e6da 100644 --- a/04_removeFromArray/solution/removeFromArray-solution.spec.js +++ b/04_removeFromArray/solution/removeFromArray-solution.spec.js @@ -7,6 +7,9 @@ describe('removeFromArray', () => { test('removes multiple values', () => { expect(removeFromArray([1, 2, 3, 4], 3, 2)).toEqual([1, 4]); }); + test('removes multiple of the same value', () => { + expect(removeFromArray([1, 2, 2, 3], 2)).toEqual([1, 3]); + }); test('ignores non present values', () => { expect(removeFromArray([1, 2, 3, 4], 7, 'tacos')).toEqual([1, 2, 3, 4]); });