From fb8d2ace4a1f67f059de677fb508a7d72d59d195 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 30 Jun 2021 11:41:41 +0530 Subject: [PATCH 001/344] chore(deps): update dependency rollup to v2.52.4 (#42675) Co-authored-by: Renovate Bot --- tools/ui-components/package-lock.json | 6 +++--- tools/ui-components/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/ui-components/package-lock.json b/tools/ui-components/package-lock.json index d0bee00f37..03c6560cc3 100644 --- a/tools/ui-components/package-lock.json +++ b/tools/ui-components/package-lock.json @@ -17844,9 +17844,9 @@ } }, "rollup": { - "version": "2.52.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.52.3.tgz", - "integrity": "sha512-QF3Sju8Kl2z0osI4unyOLyUudyhOMK6G0AeqJWgfiyigqLAlnNrfBcDWDx+f1cqn+JU2iIYVkDrgQ6/KtwEfrg==", + "version": "2.52.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.52.4.tgz", + "integrity": "sha512-AXgUxxWXyGfsj8GKleR1k8KsG8G+7ZZDRU9RZb9PnLGSyTqI/1qf/+QSp1hRaR40j4yfBCKXs5khtGKiFwihfg==", "dev": true, "requires": { "fsevents": "~2.3.2" diff --git a/tools/ui-components/package.json b/tools/ui-components/package.json index 7a9b1e30f5..73caccd2f2 100644 --- a/tools/ui-components/package.json +++ b/tools/ui-components/package.json @@ -42,7 +42,7 @@ "postcss-import": "14.0.2", "tailwindcss": "2.2.4", "rimraf": "3.0.2", - "rollup": "2.52.3", + "rollup": "2.52.4", "rollup-plugin-postcss": "4.0.0", "rollup-plugin-terser": "7.0.2" }, From 718634a9f6db3cb5c341d2143b8e918c08fd52a7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 30 Jun 2021 14:57:33 +0530 Subject: [PATCH 002/344] chore(deps): update dependency @testing-library/dom to v8 (#42677) Co-authored-by: Renovate Bot --- package-lock.json | 234 +++++++++++++++++++++++++++++++++++++++++----- package.json | 2 +- 2 files changed, 211 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index abb731ec48..ede0ba7687 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6993,30 +6993,22 @@ "regenerator-runtime": "^0.13.4" } }, - "regenerator-runtime": { - "version": "0.13.7", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", - "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", - "dev": true - } - } - }, - "@testing-library/dom": { - "version": "7.31.2", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-7.31.2.tgz", - "integrity": "sha512-3UqjCpey6HiTZT92vODYLPxTBWlM8ZOOjr3LX5F37/VRipW2M1kX6I/Cm4VXzteZqfGfagg8yXywpcOgQBlNsQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/runtime": "^7.12.5", - "@types/aria-query": "^4.2.0", - "aria-query": "^4.2.2", - "chalk": "^4.1.0", - "dom-accessibility-api": "^0.5.6", - "lz-string": "^1.4.4", - "pretty-format": "^26.6.2" - }, - "dependencies": { + "@testing-library/dom": { + "version": "7.31.2", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-7.31.2.tgz", + "integrity": "sha512-3UqjCpey6HiTZT92vODYLPxTBWlM8ZOOjr3LX5F37/VRipW2M1kX6I/Cm4VXzteZqfGfagg8yXywpcOgQBlNsQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^4.2.0", + "aria-query": "^4.2.2", + "chalk": "^4.1.0", + "dom-accessibility-api": "^0.5.6", + "lz-string": "^1.4.4", + "pretty-format": "^26.6.2" + } + }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -7057,6 +7049,133 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "regenerator-runtime": { + "version": "0.13.7", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", + "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@testing-library/dom": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-8.0.0.tgz", + "integrity": "sha512-Ym375MTOpfszlagRnTMO+FOfTt6gRrWiDOWmEnWLu9OvwCPOWtK6i5pBHmZ07wUJiQ7wWz0t8+ZBK2wFo2tlew==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^4.2.0", + "aria-query": "^4.2.2", + "chalk": "^4.1.0", + "dom-accessibility-api": "^0.5.6", + "lz-string": "^1.4.4", + "pretty-format": "^27.0.2" + }, + "dependencies": { + "@jest/types": { + "version": "27.0.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.0.6.tgz", + "integrity": "sha512-aSquT1qa9Pik26JK5/3rvnYb4bGtm1VFNesHKmNTwmPIgOrixvhL2ghIvFRNEpzy3gU+rUgjIF/KodbkFAl++g==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^16.0.0", + "chalk": "^4.0.0" + } + }, + "@types/yargs": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.3.tgz", + "integrity": "sha512-YlFfTGS+zqCgXuXNV26rOIeETOkXnGQXP/pjjL9P0gO/EP9jTmc7pUBhx+jVEIxpq41RX33GQ7N3DzOSfZoglQ==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "pretty-format": { + "version": "27.0.6", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.0.6.tgz", + "integrity": "sha512-8tGD7gBIENgzqA+UBzObyWqQ5B778VIFZA/S66cclyd5YkFLYs2Js7gxDKf0MXtTc9zcS7t1xhdfcElJ3YIvkQ==", + "dev": true, + "requires": { + "@jest/types": "^27.0.6", + "ansi-regex": "^5.0.0", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + } + } + }, + "react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true + }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -11764,6 +11883,73 @@ "@babel/runtime": "^7.9.6", "@testing-library/dom": "^7.28.1", "requireindex": "^1.2.0" + }, + "dependencies": { + "@testing-library/dom": { + "version": "7.31.2", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-7.31.2.tgz", + "integrity": "sha512-3UqjCpey6HiTZT92vODYLPxTBWlM8ZOOjr3LX5F37/VRipW2M1kX6I/Cm4VXzteZqfGfagg8yXywpcOgQBlNsQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^4.2.0", + "aria-query": "^4.2.2", + "chalk": "^4.1.0", + "dom-accessibility-api": "^0.5.6", + "lz-string": "^1.4.4", + "pretty-format": "^26.6.2" + } + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "eslint-plugin-jsx-a11y": { diff --git a/package.json b/package.json index 1615d0f7e2..3c5d162f55 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "@babel/preset-react": "7.14.5", "@babel/preset-typescript": "7.14.5", "@testing-library/cypress": "7.0.6", - "@testing-library/dom": "7.31.2", + "@testing-library/dom": "8.0.0", "@testing-library/jest-dom": "5.14.1", "@testing-library/user-event": "13.1.9", "@typescript-eslint/eslint-plugin": "4.28.1", From 6b0040b3d195e0366a0840761fd3d5633d30195c Mon Sep 17 00:00:00 2001 From: Niraj Nandish Date: Wed, 30 Jun 2021 13:51:31 +0400 Subject: [PATCH 003/344] Contributor tools searches from all PRs (#42630) --- tools/contributor/dashboard-app/server/tools/get-prs.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/contributor/dashboard-app/server/tools/get-prs.js b/tools/contributor/dashboard-app/server/tools/get-prs.js index 7f0715b521..b9c6de81d6 100644 --- a/tools/contributor/dashboard-app/server/tools/get-prs.js +++ b/tools/contributor/dashboard-app/server/tools/get-prs.js @@ -1,7 +1,7 @@ const { Octokit } = require('@octokit/rest'); const { - github: { owner, secret, freeCodeCampRepo, defaultBase } + github: { owner, secret, freeCodeCampRepo } } = require('../../../lib/config'); const getPRs = async () => { @@ -11,7 +11,6 @@ const getPRs = async () => { const methodProps = { owner, repo: freeCodeCampRepo, - base: defaultBase, state: 'open', sort: 'created', direction: 'asc', From 3bb307b911ec8bb2276089b9d0fd13170d04fbce Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 30 Jun 2021 15:56:35 +0530 Subject: [PATCH 004/344] chore(deps): update dependency @testing-library/react to v12 (#42680) Co-authored-by: Renovate Bot --- client/package-lock.json | 81 +++++++++++++++--- client/package.json | 2 +- tools/ui-components/package-lock.json | 113 ++++++++++++++++++++------ tools/ui-components/package.json | 2 +- 4 files changed, 159 insertions(+), 39 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index c5431f643f..adf7eebeac 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -3649,9 +3649,9 @@ } }, "@testing-library/dom": { - "version": "7.31.0", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-7.31.0.tgz", - "integrity": "sha512-0X7ACg4YvTRDFMIuTOEj6B4NpN7i3F/4j5igOcTI5NC5J+N4TribNdErCHOZF1LBWhhcyfwxelVwvoYNMUXTOA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-8.0.0.tgz", + "integrity": "sha512-Ym375MTOpfszlagRnTMO+FOfTt6gRrWiDOWmEnWLu9OvwCPOWtK6i5pBHmZ07wUJiQ7wWz0t8+ZBK2wFo2tlew==", "dev": true, "requires": { "@babel/code-frame": "^7.10.4", @@ -3659,11 +3659,42 @@ "@types/aria-query": "^4.2.0", "aria-query": "^4.2.2", "chalk": "^4.1.0", - "dom-accessibility-api": "^0.5.4", + "dom-accessibility-api": "^0.5.6", "lz-string": "^1.4.4", - "pretty-format": "^26.6.2" + "pretty-format": "^27.0.2" }, "dependencies": { + "@jest/types": { + "version": "27.0.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.0.6.tgz", + "integrity": "sha512-aSquT1qa9Pik26JK5/3rvnYb4bGtm1VFNesHKmNTwmPIgOrixvhL2ghIvFRNEpzy3gU+rUgjIF/KodbkFAl++g==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^16.0.0", + "chalk": "^4.0.0" + } + }, + "@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dev": true, + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/yargs": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.3.tgz", + "integrity": "sha512-YlFfTGS+zqCgXuXNV26rOIeETOkXnGQXP/pjjL9P0gO/EP9jTmc7pUBhx+jVEIxpq41RX33GQ7N3DzOSfZoglQ==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -3704,6 +3735,32 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "pretty-format": { + "version": "27.0.6", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.0.6.tgz", + "integrity": "sha512-8tGD7gBIENgzqA+UBzObyWqQ5B778VIFZA/S66cclyd5YkFLYs2Js7gxDKf0MXtTc9zcS7t1xhdfcElJ3YIvkQ==", + "dev": true, + "requires": { + "@jest/types": "^27.0.6", + "ansi-regex": "^5.0.0", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + } + } + }, + "react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true + }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -3790,13 +3847,13 @@ } }, "@testing-library/react": { - "version": "11.2.7", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-11.2.7.tgz", - "integrity": "sha512-tzRNp7pzd5QmbtXNG/mhdcl7Awfu/Iz1RaVHY75zTdOkmHCuzMhRL83gWHSgOAcjS3CCbyfwUHMZgRJb4kAfpA==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-12.0.0.tgz", + "integrity": "sha512-sh3jhFgEshFyJ/0IxGltRhwZv2kFKfJ3fN1vTZ6hhMXzz9ZbbcTgmDYM4e+zJv+oiVKKEWZPyqPAh4MQBI65gA==", "dev": true, "requires": { "@babel/runtime": "^7.12.5", - "@testing-library/dom": "^7.28.1" + "@testing-library/dom": "^8.0.0" } }, "@tokenizer/token": { @@ -7572,9 +7629,9 @@ } }, "dom-accessibility-api": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.4.tgz", - "integrity": "sha512-TvrjBckDy2c6v6RLxPv5QXOnU+SmF9nBII5621Ve5fu6Z/BDrENurBEvlC1f44lKEUVqOpK4w9E5Idc5/EgkLQ==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.6.tgz", + "integrity": "sha512-DplGLZd8L1lN64jlT27N9TVSESFR5STaEJvX+thCby7fuCHonfPpAlodYc3vuUYbDuDec5w8AMP7oCM5TWFsqw==", "dev": true }, "dom-converter": { diff --git a/client/package.json b/client/package.json index 67df2f036c..37576e5eee 100644 --- a/client/package.json +++ b/client/package.json @@ -131,7 +131,7 @@ "@codesee/babel-plugin-instrument": "0.43.1", "@codesee/tracker": "0.43.1", "@testing-library/jest-dom": "5.14.1", - "@testing-library/react": "11.2.7", + "@testing-library/react": "12.0.0", "@types/react-transition-group": "4.4.1", "@types/redux-actions": "2.6.1", "autoprefixer": "10.2.6", diff --git a/tools/ui-components/package-lock.json b/tools/ui-components/package-lock.json index 03c6560cc3..3baa1bbff8 100644 --- a/tools/ui-components/package-lock.json +++ b/tools/ui-components/package-lock.json @@ -4447,13 +4447,21 @@ } }, "@babel/runtime-corejs3": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.14.0.tgz", - "integrity": "sha512-0R0HTZWHLk6G8jIk0FtoX+AatCtKnswS98VhXwGImFc759PJRp4Tru0PQYZofyijTFUr+gT8Mu7sgXVJLQ0ceg==", + "version": "7.14.7", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.14.7.tgz", + "integrity": "sha512-Wvzcw4mBYbTagyBVZpAJWI06auSIj033T/yNE0Zn1xcup83MieCddZA7ls3kme17L4NOGBrQ09Q+nKB41RLWBA==", "dev": true, "requires": { - "core-js-pure": "^3.0.0", + "core-js-pure": "^3.15.0", "regenerator-runtime": "^0.13.4" + }, + "dependencies": { + "core-js-pure": { + "version": "3.15.2", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.15.2.tgz", + "integrity": "sha512-D42L7RYh1J2grW8ttxoY1+17Y4wXZeKe7uyplAI3FkNQyI5OgBIAjUfFiTPfL1rs0qLpxaabITNbjKl1Sp82tA==", + "dev": true + } } }, "@babel/template": { @@ -6958,9 +6966,9 @@ } }, "@testing-library/dom": { - "version": "7.31.0", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-7.31.0.tgz", - "integrity": "sha512-0X7ACg4YvTRDFMIuTOEj6B4NpN7i3F/4j5igOcTI5NC5J+N4TribNdErCHOZF1LBWhhcyfwxelVwvoYNMUXTOA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-8.0.0.tgz", + "integrity": "sha512-Ym375MTOpfszlagRnTMO+FOfTt6gRrWiDOWmEnWLu9OvwCPOWtK6i5pBHmZ07wUJiQ7wWz0t8+ZBK2wFo2tlew==", "dev": true, "requires": { "@babel/code-frame": "^7.10.4", @@ -6968,9 +6976,9 @@ "@types/aria-query": "^4.2.0", "aria-query": "^4.2.2", "chalk": "^4.1.0", - "dom-accessibility-api": "^0.5.4", + "dom-accessibility-api": "^0.5.6", "lz-string": "^1.4.4", - "pretty-format": "^26.6.2" + "pretty-format": "^27.0.2" }, "dependencies": { "ansi-styles": { @@ -7025,13 +7033,13 @@ } }, "@testing-library/react": { - "version": "11.2.7", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-11.2.7.tgz", - "integrity": "sha512-tzRNp7pzd5QmbtXNG/mhdcl7Awfu/Iz1RaVHY75zTdOkmHCuzMhRL83gWHSgOAcjS3CCbyfwUHMZgRJb4kAfpA==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-12.0.0.tgz", + "integrity": "sha512-sh3jhFgEshFyJ/0IxGltRhwZv2kFKfJ3fN1vTZ6hhMXzz9ZbbcTgmDYM4e+zJv+oiVKKEWZPyqPAh4MQBI65gA==", "dev": true, "requires": { "@babel/runtime": "^7.12.5", - "@testing-library/dom": "^7.28.1" + "@testing-library/dom": "^8.0.0" } }, "@types/aria-query": { @@ -10628,9 +10636,9 @@ } }, "dom-accessibility-api": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.4.tgz", - "integrity": "sha512-TvrjBckDy2c6v6RLxPv5QXOnU+SmF9nBII5621Ve5fu6Z/BDrENurBEvlC1f44lKEUVqOpK4w9E5Idc5/EgkLQ==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.6.tgz", + "integrity": "sha512-DplGLZd8L1lN64jlT27N9TVSESFR5STaEJvX+thCby7fuCHonfPpAlodYc3vuUYbDuDec5w8AMP7oCM5TWFsqw==", "dev": true }, "dom-converter": { @@ -16696,17 +16704,39 @@ } }, "pretty-format": { - "version": "26.6.2", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", - "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==", + "version": "27.0.6", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.0.6.tgz", + "integrity": "sha512-8tGD7gBIENgzqA+UBzObyWqQ5B778VIFZA/S66cclyd5YkFLYs2Js7gxDKf0MXtTc9zcS7t1xhdfcElJ3YIvkQ==", "dev": true, "requires": { - "@jest/types": "^26.6.2", + "@jest/types": "^27.0.6", "ansi-regex": "^5.0.0", - "ansi-styles": "^4.0.0", + "ansi-styles": "^5.0.0", "react-is": "^17.0.1" }, "dependencies": { + "@jest/types": { + "version": "27.0.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.0.6.tgz", + "integrity": "sha512-aSquT1qa9Pik26JK5/3rvnYb4bGtm1VFNesHKmNTwmPIgOrixvhL2ghIvFRNEpzy3gU+rUgjIF/KodbkFAl++g==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^16.0.0", + "chalk": "^4.0.0" + } + }, + "@types/yargs": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.3.tgz", + "integrity": "sha512-YlFfTGS+zqCgXuXNV26rOIeETOkXnGQXP/pjjL9P0gO/EP9jTmc7pUBhx+jVEIxpq41RX33GQ7N3DzOSfZoglQ==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", @@ -16714,12 +16744,30 @@ "dev": true }, "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + }, + "chalk": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", "dev": true, "requires": { - "color-convert": "^2.0.1" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + } } }, "color-convert": { @@ -16737,11 +16785,26 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, diff --git a/tools/ui-components/package.json b/tools/ui-components/package.json index 73caccd2f2..74ae250b26 100644 --- a/tools/ui-components/package.json +++ b/tools/ui-components/package.json @@ -33,7 +33,7 @@ "@storybook/addon-links": "6.3.1", "@storybook/addon-postcss": "2.0.0", "@storybook/react": "6.3.1", - "@testing-library/react": "11.2.7", + "@testing-library/react": "12.0.0", "autoprefixer": "10.2.6", "babel-loader": "8.2.2", "babel-plugin-transform-react-remove-prop-types": "0.4.24", From 25fcf835ed61f76c415f6f2b5140c287cf8e8eff Mon Sep 17 00:00:00 2001 From: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com> Date: Wed, 30 Jun 2021 17:33:19 +0530 Subject: [PATCH 005/344] fix(tools): set homepage for CRA builds (#42681) --- tools/contributor/dashboard-app/server/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/contributor/dashboard-app/server/package.json b/tools/contributor/dashboard-app/server/package.json index 9013912412..30ec63e051 100644 --- a/tools/contributor/dashboard-app/server/package.json +++ b/tools/contributor/dashboard-app/server/package.json @@ -15,7 +15,7 @@ "bugs": { "url": "https://github.com/freeCodeCamp/freeCodeCamp/issues" }, - "homepage": "https://github.com/freeCodeCamp/freeCodeCamp#readme", + "homepage": "https://tools.freecodecamp.org", "author": "freeCodeCamp ", "main": "none", "scripts": { From dc168cd96de93cfe12b0a4b3da888eafdce0387e Mon Sep 17 00:00:00 2001 From: gikf <60067306+gikf@users.noreply.github.com> Date: Wed, 30 Jun 2021 14:25:46 +0200 Subject: [PATCH 006/344] fix(curriculum): clean-up Project Euler 101-120 (#42597) Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> --- .../problem-101-optimum-polynomial.md | 27 ++++++++---- ...problem-103-special-subset-sums-optimum.md | 33 ++++++++------- .../problem-104-pandigital-fibonacci-ends.md | 14 +++---- ...problem-105-special-subset-sums-testing.md | 33 ++++++++++----- ...em-106-special-subset-sums-meta-testing.md | 17 ++++---- .../problem-107-minimal-network.md | 41 ++++++++++++++++--- .../problem-108-diophantine-reciprocals-i.md | 14 ++++--- .../project-euler/problem-109-darts.md | 36 ++++++++++------ .../problem-110-diophantine-reciprocals-ii.md | 6 ++- .../problem-111-primes-with-runs.md | 29 +++++++++---- .../problem-112-bouncy-numbers.md | 8 ++-- .../problem-113-non-bouncy-numbers.md | 12 +++--- ...oblem-114-counting-block-combinations-i.md | 14 ++++--- ...blem-115-counting-block-combinations-ii.md | 22 +++++----- .../problem-116-red-green-or-blue-tiles.md | 18 +++++--- .../problem-117-red-green-and-blue-tiles.md | 14 ++++--- .../problem-118-pandigital-prime-sets.md | 10 ++--- .../problem-119-digit-power-sum.md | 16 ++++---- .../problem-120-square-remainders.md | 14 +++---- 19 files changed, 237 insertions(+), 141 deletions(-) diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-101-optimum-polynomial.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-101-optimum-polynomial.md index 7573114475..430a7c72a1 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-101-optimum-polynomial.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-101-optimum-polynomial.md @@ -10,26 +10,35 @@ dashedName: problem-101-optimum-polynomial If we are presented with the first k terms of a sequence it is impossible to say with certainty the value of the next term, as there are infinitely many polynomial functions that can model the sequence. -As an example, let us consider the sequence of cube numbers. This is defined by the generating function, un = n3: 1, 8, 27, 64, 125, 216, ... +As an example, let us consider the sequence of cube numbers. This is defined by the generating function, $u_n = n^3: 1, 8, 27, 64, 125, 216, \ldots$ Suppose we were only given the first two terms of this sequence. Working on the principle that "simple is best" we should assume a linear relationship and predict the next term to be 15 (common difference 7). Even if we were presented with the first three terms, by the same principle of simplicity, a quadratic relationship should be assumed. -We shall define OP(k, n) to be the nth term of the optimum polynomial generating function for the first k terms of a sequence. It should be clear that OP(k, n) will accurately generate the terms of the sequence for n ≤ k, and potentially the first incorrect term (FIT) will be OP(k, k+1); in which case we shall call it a bad OP (BOP). +We shall define $OP(k, n)$ to be the $n^{th}$ term of the optimum polynomial generating function for the first k terms of a sequence. It should be clear that $OP(k, n)$ will accurately generate the terms of the sequence for $n ≤ k$, and potentially the first incorrect term (FIT) will be $OP(k, k+1)$; in which case we shall call it a bad OP (BOP). -As a basis, if we were only given the first term of sequence, it would be most sensible to assume constancy; that is, for n ≥ 2, OP(1, n) = u1. +As a basis, if we were only given the first term of sequence, it would be most sensible to assume constancy; that is, for $n ≥ 2, OP(1, n) = u_1$. Hence we obtain the following OPs for the cubic sequence: -OP(1, n) = 1 1, 1, 1, 1, ... OP(2, n) = 7n−6 1, 8, 15, ... OP(3, n) = 6n2−11n+6 1, 8, 27, 58, ... OP(4, n) = n3 1, 8, 27, 64, 125, ... +$$\begin{array}{ll} + OP(1, n) = 1 & 1, {\color{red}1}, 1, 1, \ldots \\\\ + OP(2, n) = 7n−6 & 1, 8, {\color{red}{15}}, \ldots \\\\ + OP(3, n) = 6n^2−11n+6 & 1, 8, 27, {\color{red}{58}}, \ldots \\\\ + OP(4, n) = n^3 & 1, 8, 27, 64, 125, \ldots +\end{array}$$ -Clearly no BOPs exist for k ≥ 4. By considering the sum of FITs generated by the BOPs (indicated in red above), we obtain 1 + 15 + 58 = 74. Consider the following tenth degree polynomial generating function: un = 1 − n + n2 − n3 + n4 − n5 + n6 − n7 + n8 − n9 + n10 Find the sum of FITs for the BOPs. +Clearly no BOPs exist for k ≥ 4. By considering the sum of FITs generated by the BOPs (indicated in $\color{red}{red}$ above), we obtain 1 + 15 + 58 = 74. Consider the following tenth degree polynomial generating function: + +$$u_n = 1 − n + n^2 − n^3 + n^4 − n^5 + n^6 − n^7 + n^8 − n^9 + n^{10}$$ + +Find the sum of FITs for the BOPs. # --hints-- -`euler101()` should return 37076114526. +`optimumPolynomial()` should return `37076114526`. ```js -assert.strictEqual(euler101(), 37076114526); +assert.strictEqual(optimumPolynomial(), 37076114526); ``` # --seed-- @@ -37,12 +46,12 @@ assert.strictEqual(euler101(), 37076114526); ## --seed-contents-- ```js -function euler101() { +function optimumPolynomial() { return true; } -euler101(); +optimumPolynomial(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-103-special-subset-sums-optimum.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-103-special-subset-sums-optimum.md index 1ba5808084..3def69ea45 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-103-special-subset-sums-optimum.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-103-special-subset-sums-optimum.md @@ -8,30 +8,35 @@ dashedName: problem-103-special-subset-sums-optimum # --description-- -Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: +Let $S(A)$ represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: -S(B) ≠ S(C); that is, sums of subsets cannot be equal. +1. $S(B) ≠ S(C)$; that is, sums of subsets cannot be equal. +2. If B contains more elements than C then $S(B) > S(C)$. -If B contains more elements than C then S(B) > S(C). +If $S(A)$ is minimised for a given n, we shall call it an optimum special sum set. The first five optimum special sum sets are given below. -If S(A) is minimised for a given n, we shall call it an optimum special sum set. The first five optimum special sum sets are given below. +$$\begin{align} + & n = 1: \\{1\\} \\\\ + & n = 2: \\{1, 2\\} \\\\ + & n = 3: \\{2, 3, 4\\} \\\\ + & n = 4: \\{3, 5, 6, 7\\} \\\\ + & n = 5: \\{6, 9, 11, 12, 13\\} \\\\ +\end{align}$$ -n = 1: {1}n = 2: {1, 2}n = 3: {2, 3, 4}n = 4: {3, 5, 6, 7}n = 5: {6, 9, 11, 12, 13} +It seems that for a given optimum set, $A = \\{a_1, a_2, \ldots, a_n\\}$, the next optimum set is of the form $B = \\{b, a_1 + b, a_2 + b, \ldots, a_n + b\\}$, where b is the "middle" element on the previous row. -It seems that for a given optimum set, A = {a1, a2, ... , an}, the next optimum set is of the form B = {b, a1+b, a2+b, ... ,an+b}, where b is the "middle" element on the previous row. +By applying this "rule" we would expect the optimum set for $n = 6$ to be $A = \\{11, 17, 20, 22, 23, 24\\}$, with $S(A) = 117$. However, this is not the optimum set, as we have merely applied an algorithm to provide a near optimum set. The optimum set for $n = 6$ is $A = \\{11, 18, 19, 20, 22, 25\\}$, with $S(A) = 115$ and corresponding set string: `111819202225`. -By applying this "rule" we would expect the optimum set for n = 6 to be A = {11, 17, 20, 22, 23, 24}, with S(A) = 117. However, this is not the optimum set, as we have merely applied an algorithm to provide a near optimum set. The optimum set for n = 6 is A = {11, 18, 19, 20, 22, 25}, with S(A) = 115 and corresponding set string: 111819202225. +Given that A is an optimum special sum set for $n = 7$, find its set string. -Given that A is an optimum special sum set for n = 7, find its set string. - -NOTE: This problem is related to Problem 105 and Problem 106. +**Note:** This problem is related to Problem 105 and Problem 106. # --hints-- -`euler103()` should return 20313839404245. +`optimumSpecialSumSet()` should return the string `20313839404245`. ```js -assert.strictEqual(euler103(), 20313839404245); +assert.strictEqual(optimumSpecialSumSet(), '20313839404245'); ``` # --seed-- @@ -39,12 +44,12 @@ assert.strictEqual(euler103(), 20313839404245); ## --seed-contents-- ```js -function euler103() { +function optimumSpecialSumSet() { return true; } -euler103(); +optimumSpecialSumSet(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-104-pandigital-fibonacci-ends.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-104-pandigital-fibonacci-ends.md index 625840f94a..1c61ea7c2e 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-104-pandigital-fibonacci-ends.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-104-pandigital-fibonacci-ends.md @@ -10,18 +10,18 @@ dashedName: problem-104-pandigital-fibonacci-ends The Fibonacci sequence is defined by the recurrence relation: -Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. +$F_n = F_{n − 1} + F_{n − 2}$, where $F_1 = 1$ and $F_2 = 1$ -It turns out that F541, which contains 113 digits, is the first Fibonacci number for which the last nine digits are 1-9 pandigital (contain all the digits 1 to 9, but not necessarily in order). And F2749, which contains 575 digits, is the first Fibonacci number for which the first nine digits are 1-9 pandigital. +It turns out that $F_{541}$, which contains 113 digits, is the first Fibonacci number for which the last nine digits are 1 - 9 pandigital (contain all the digits 1 to 9, but not necessarily in order). And $F_{2749}$, which contains 575 digits, is the first Fibonacci number for which the first nine digits are 1 - 9 pandigital. -Given that Fk is the first Fibonacci number for which the first nine digits AND the last nine digits are 1-9 pandigital, find k. +Given that $F_k$ is the first Fibonacci number for which the first nine digits AND the last nine digits are 1 - 9 pandigital, find `k`. # --hints-- -`euler104()` should return 329468. +`pandigitalFibonacciEnds()` should return `329468`. ```js -assert.strictEqual(euler104(), 329468); +assert.strictEqual(pandigitalFibonacciEnds(), 329468); ``` # --seed-- @@ -29,12 +29,12 @@ assert.strictEqual(euler104(), 329468); ## --seed-contents-- ```js -function euler104() { +function pandigitalFibonacciEnds() { return true; } -euler104(); +pandigitalFibonacciEnds(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-105-special-subset-sums-testing.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-105-special-subset-sums-testing.md index 28d4d6ac86..0a5d611f90 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-105-special-subset-sums-testing.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-105-special-subset-sums-testing.md @@ -8,37 +8,48 @@ dashedName: problem-105-special-subset-sums-testing # --description-- -Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: +Let $S(A)$ represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: -S(B) ≠ S(C); that is, sums of subsets cannot be equal. +1. $S(B) ≠ S(C)$; that is, sums of subsets cannot be equal. +2. If B contains more elements than C then $S(B) > S(C)$. -If B contains more elements than C then S(B) > S(C). +For example, {81, 88, 75, 42, 87, 84, 86, 65} is not a special sum set because 65 + 87 + 88 = 75 + 81 + 84, whereas {157, 150, 164, 119, 79, 159, 161, 139, 158} satisfies both rules for all possible subset pair combinations and $S(A) = 1286$. -For example, {81, 88, 75, 42, 87, 84, 86, 65} is not a special sum set because 65 + 87 + 88 = 75 + 81 + 84, whereas {157, 150, 164, 119, 79, 159, 161, 139, 158} satisfies both rules for all possible subset pair combinations and S(A) = 1286. +Using `sets`, an array with one-hundred sets, containing seven to twelve elements (the two examples given above are the first two sets), identify all the special sum sets, $A_1, A_2, \ldots, A_k$, and find the value of $(A_1) + S(A_2) + \cdots + S(A_k)$. -Using sets.txt (right click and "Save Link/Target As..."), a 4K text file with one-hundred sets containing seven to twelve elements (the two examples given above are the first two sets in the file), identify all the special sum sets, A1, A2, ..., Ak, and find the value of S(A1) + S(A2) + ... + S(Ak). - -NOTE: This problem is related to Problem 103 and Problem 106. +**Note:** This problem is related to Problem 103 and Problem 106. # --hints-- -`euler105()` should return 73702. +`testingSpecialSubsetSums(testSets)` should return `73702`. ```js -assert.strictEqual(euler105(), 73702); +assert.strictEqual(testingSpecialSubsetSums(_testSets), 73702); ``` # --seed-- +## --after-user-code-- + +```js +const _testSets = [ + [81,88,75,42,87,84,86,65],[157,150,164,119,79,159,161,139,158],[673,465,569,603,629,592,584,300,601,599,600],[90,85,83,84,65,87,76,46],[165,168,169,190,162,85,176,167,127],[224,275,278,249,277,279,289,295,139],[354,370,362,384,359,324,360,180,350,270],[599,595,557,298,448,596,577,667,597,588,602],[175,199,137,88,187,173,168,171,174],[93,187,196,144,185,178,186,202,182],[157,155,81,158,119,176,152,167,159],[184,165,159,166,163,167,174,124,83],[1211,1212,1287,605,1208,1189,1060,1216,1243,1200,908,1210],[339,299,153,305,282,304,313,306,302,228],[94,104,63,112,80,84,93,96],[41,88,82,85,61,74,83,81],[90,67,84,83,82,97,86,41],[299,303,151,301,291,302,307,377,333,280],[55,40,48,44,25,42,41],[1038,1188,1255,1184,594,890,1173,1151,1186,1203,1187,1195],[76,132,133,144,135,99,128,154],[77,46,108,81,85,84,93,83],[624,596,391,605,529,610,607,568,604,603,453],[83,167,166,189,163,174,160,165,133],[308,281,389,292,346,303,302,304,300,173],[593,1151,1187,1184,890,1040,1173,1186,1195,1255,1188,1203],[68,46,64,33,60,58,65],[65,43,88,87,86,99,93,90],[83,78,107,48,84,87,96,85],[1188,1173,1256,1038,1187,1151,890,1186,1184,1203,594,1195],[302,324,280,296,294,160,367,298,264,299],[521,760,682,687,646,664,342,698,692,686,672],[56,95,86,97,96,89,108,120],[344,356,262,343,340,382,337,175,361,330],[47,44,42,27,41,40,37],[139,155,161,158,118,166,154,156,78],[118,157,164,158,161,79,139,150,159],[299,292,371,150,300,301,281,303,306,262],[85,77,86,84,44,88,91,67],[88,85,84,44,65,91,76,86],[138,141,127,96,136,154,135,76],[292,308,302,346,300,324,304,305,238,166],[354,342,341,257,348,343,345,321,170,301],[84,178,168,167,131,170,193,166,162],[686,701,706,673,694,687,652,343,683,606,518],[295,293,301,367,296,279,297,263,323,159],[1038,1184,593,890,1188,1173,1187,1186,1195,1150,1203,1255],[343,364,388,402,191,383,382,385,288,374],[1187,1036,1183,591,1184,1175,888,1197,1182,1219,1115,1167],[151,291,307,303,345,238,299,323,301,302],[140,151,143,138,99,69,131,137],[29,44,42,59,41,36,40],[348,329,343,344,338,315,169,359,375,271],[48,39,34,37,50,40,41],[593,445,595,558,662,602,591,297,610,580,594],[686,651,681,342,541,687,691,707,604,675,699],[180,99,189,166,194,188,144,187,199],[321,349,335,343,377,176,265,356,344,332],[1151,1255,1195,1173,1184,1186,1188,1187,1203,593,1038,891],[90,88,100,83,62,113,80,89],[308,303,238,300,151,304,324,293,346,302],[59,38,50,41,42,35,40],[352,366,174,355,344,265,343,310,338,331],[91,89,93,90,117,85,60,106],[146,186,166,175,202,92,184,183,189],[82,67,96,44,80,79,88,76],[54,50,58,66,31,61,64],[343,266,344,172,308,336,364,350,359,333],[88,49,87,82,90,98,86,115],[20,47,49,51,54,48,40],[159,79,177,158,157,152,155,167,118],[1219,1183,1182,1115,1035,1186,591,1197,1167,887,1184,1175],[611,518,693,343,704,667,686,682,677,687,725],[607,599,634,305,677,604,603,580,452,605,591],[682,686,635,675,692,730,687,342,517,658,695],[662,296,573,598,592,584,553,593,595,443,591],[180,185,186,199,187,210,93,177,149],[197,136,179,185,156,182,180,178,99],[271,298,218,279,285,282,280,238,140],[1187,1151,890,593,1194,1188,1184,1173,1038,1186,1255,1203],[169,161,177,192,130,165,84,167,168],[50,42,43,41,66,39,36],[590,669,604,579,448,599,560,299,601,597,598],[174,191,206,179,184,142,177,180,90],[298,299,297,306,164,285,374,269,329,295],[181,172,162,138,170,195,86,169,168],[1184,1197,591,1182,1186,889,1167,1219,1183,1033,1115,1175],[644,695,691,679,667,687,340,681,770,686,517],[606,524,592,576,628,593,591,584,296,444,595],[94,127,154,138,135,74,136,141],[179,168,172,178,177,89,198,186,137],[302,299,291,300,298,149,260,305,280,370],[678,517,670,686,682,768,687,648,342,692,702],[302,290,304,376,333,303,306,298,279,153],[95,102,109,54,96,75,85,97],[150,154,146,78,152,151,162,173,119],[150,143,157,152,184,112,154,151,132],[36,41,54,40,25,44,42],[37,48,34,59,39,41,40],[681,603,638,611,584,303,454,607,606,605,596] +]; +``` + ## --seed-contents-- ```js -function euler105() { +function testingSpecialSubsetSums(sets) { return true; } -euler105(); +const testSets = [ + [81,88,75,42,87,84,86,65],[157,150,164,119,79,159,161,139,158],[673,465,569,603,629,592,584,300,601,599,600],[90,85,83,84,65,87,76,46],[165,168,169,190,162,85,176,167,127],[224,275,278,249,277,279,289,295,139],[354,370,362,384,359,324,360,180,350,270],[599,595,557,298,448,596,577,667,597,588,602],[175,199,137,88,187,173,168,171,174],[93,187,196,144,185,178,186,202,182],[157,155,81,158,119,176,152,167,159],[184,165,159,166,163,167,174,124,83],[1211,1212,1287,605,1208,1189,1060,1216,1243,1200,908,1210],[339,299,153,305,282,304,313,306,302,228],[94,104,63,112,80,84,93,96],[41,88,82,85,61,74,83,81],[90,67,84,83,82,97,86,41],[299,303,151,301,291,302,307,377,333,280],[55,40,48,44,25,42,41],[1038,1188,1255,1184,594,890,1173,1151,1186,1203,1187,1195],[76,132,133,144,135,99,128,154],[77,46,108,81,85,84,93,83],[624,596,391,605,529,610,607,568,604,603,453],[83,167,166,189,163,174,160,165,133],[308,281,389,292,346,303,302,304,300,173],[593,1151,1187,1184,890,1040,1173,1186,1195,1255,1188,1203],[68,46,64,33,60,58,65],[65,43,88,87,86,99,93,90],[83,78,107,48,84,87,96,85],[1188,1173,1256,1038,1187,1151,890,1186,1184,1203,594,1195],[302,324,280,296,294,160,367,298,264,299],[521,760,682,687,646,664,342,698,692,686,672],[56,95,86,97,96,89,108,120],[344,356,262,343,340,382,337,175,361,330],[47,44,42,27,41,40,37],[139,155,161,158,118,166,154,156,78],[118,157,164,158,161,79,139,150,159],[299,292,371,150,300,301,281,303,306,262],[85,77,86,84,44,88,91,67],[88,85,84,44,65,91,76,86],[138,141,127,96,136,154,135,76],[292,308,302,346,300,324,304,305,238,166],[354,342,341,257,348,343,345,321,170,301],[84,178,168,167,131,170,193,166,162],[686,701,706,673,694,687,652,343,683,606,518],[295,293,301,367,296,279,297,263,323,159],[1038,1184,593,890,1188,1173,1187,1186,1195,1150,1203,1255],[343,364,388,402,191,383,382,385,288,374],[1187,1036,1183,591,1184,1175,888,1197,1182,1219,1115,1167],[151,291,307,303,345,238,299,323,301,302],[140,151,143,138,99,69,131,137],[29,44,42,59,41,36,40],[348,329,343,344,338,315,169,359,375,271],[48,39,34,37,50,40,41],[593,445,595,558,662,602,591,297,610,580,594],[686,651,681,342,541,687,691,707,604,675,699],[180,99,189,166,194,188,144,187,199],[321,349,335,343,377,176,265,356,344,332],[1151,1255,1195,1173,1184,1186,1188,1187,1203,593,1038,891],[90,88,100,83,62,113,80,89],[308,303,238,300,151,304,324,293,346,302],[59,38,50,41,42,35,40],[352,366,174,355,344,265,343,310,338,331],[91,89,93,90,117,85,60,106],[146,186,166,175,202,92,184,183,189],[82,67,96,44,80,79,88,76],[54,50,58,66,31,61,64],[343,266,344,172,308,336,364,350,359,333],[88,49,87,82,90,98,86,115],[20,47,49,51,54,48,40],[159,79,177,158,157,152,155,167,118],[1219,1183,1182,1115,1035,1186,591,1197,1167,887,1184,1175],[611,518,693,343,704,667,686,682,677,687,725],[607,599,634,305,677,604,603,580,452,605,591],[682,686,635,675,692,730,687,342,517,658,695],[662,296,573,598,592,584,553,593,595,443,591],[180,185,186,199,187,210,93,177,149],[197,136,179,185,156,182,180,178,99],[271,298,218,279,285,282,280,238,140],[1187,1151,890,593,1194,1188,1184,1173,1038,1186,1255,1203],[169,161,177,192,130,165,84,167,168],[50,42,43,41,66,39,36],[590,669,604,579,448,599,560,299,601,597,598],[174,191,206,179,184,142,177,180,90],[298,299,297,306,164,285,374,269,329,295],[181,172,162,138,170,195,86,169,168],[1184,1197,591,1182,1186,889,1167,1219,1183,1033,1115,1175],[644,695,691,679,667,687,340,681,770,686,517],[606,524,592,576,628,593,591,584,296,444,595],[94,127,154,138,135,74,136,141],[179,168,172,178,177,89,198,186,137],[302,299,291,300,298,149,260,305,280,370],[678,517,670,686,682,768,687,648,342,692,702],[302,290,304,376,333,303,306,298,279,153],[95,102,109,54,96,75,85,97],[150,154,146,78,152,151,162,173,119],[150,143,157,152,184,112,154,151,132],[36,41,54,40,25,44,42],[37,48,34,59,39,41,40],[681,603,638,611,584,303,454,607,606,605,596] +]; + +testingSpecialSubsetSums(testSets); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-106-special-subset-sums-meta-testing.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-106-special-subset-sums-meta-testing.md index bb1db2e260..e771a72835 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-106-special-subset-sums-meta-testing.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-106-special-subset-sums-meta-testing.md @@ -8,11 +8,10 @@ dashedName: problem-106-special-subset-sums-meta-testing # --description-- -Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: +Let $S(A)$ represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: -S(B) ≠ S(C); that is, sums of subsets cannot be equal. - -If B contains more elements than C then S(B) > S(C). +1. $S(B) ≠ S(C)$; that is, sums of subsets cannot be equal. +2. If B contains more elements than C then $S(B) > S(C)$. For this problem we shall assume that a given set contains n strictly increasing elements and it already satisfies the second rule. @@ -20,14 +19,14 @@ Surprisingly, out of the 25 possible subset pairs that can be obtained from a se For n = 12, how many of the 261625 subset pairs that can be obtained need to be tested for equality? -NOTE: This problem is related to Problem 103 and Problem 105. +**Note:** This problem is related to Problem 103 and Problem 105. # --hints-- -`euler106()` should return 21384. +`subsetSumsMetaTesting()` should return `21384`. ```js -assert.strictEqual(euler106(), 21384); +assert.strictEqual(subsetSumsMetaTesting(), 21384); ``` # --seed-- @@ -35,12 +34,12 @@ assert.strictEqual(euler106(), 21384); ## --seed-contents-- ```js -function euler106() { +function subsetSumsMetaTesting() { return true; } -euler106(); +subsetSumsMetaTesting(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-107-minimal-network.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-107-minimal-network.md index f51dfe801d..7b4aa32e28 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-107-minimal-network.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-107-minimal-network.md @@ -10,29 +10,58 @@ dashedName: problem-107-minimal-network The following undirected network consists of seven vertices and twelve edges with a total weight of 243. -The same network can be represented by the matrix below. ABCDEFG A-161221--- B16--1720-- C12--28-31- D211728-181923 E-20-18--11 F--3119--27 G---231127- However, it is possible to optimise the network by removing some edges and still ensure that all points on the network remain connected. The network which achieves the maximum saving is shown below. It has a weight of 93, representing a saving of 243 − 93 = 150 from the original network. +Network with seven vertices and twelve edges -Using network.txt (right click and 'Save Link/Target As...'), a 6K text file containing a network with forty vertices, and given in matrix form, find the maximum saving which can be achieved by removing redundant edges whilst ensuring that the network remains connected. +The same network can be represented by the matrix below. + +| | A | B | C | D | E | F | G | +|---|----|----|----|----|----|----|----| +| A | - | 16 | 12 | 21 | - | - | - | +| B | 16 | - | - | 17 | 20 | - | - | +| C | 12 | - | - | 28 | - | 31 | - | +| D | 21 | 17 | 28 | - | 18 | 19 | 23 | +| E | - | 20 | - | 18 | - | - | 11 | +| F | - | - | 31 | 19 | - | - | 27 | +| G | - | - | - | 23 | 11 | 27 | - | + + +However, it is possible to optimise the network by removing some edges and still ensure that all points on the network remain connected. The network which achieves the maximum saving is shown below. It has a weight of 93, representing a saving of 243 − 93 = 150 from the original network. + +Network wtih seven vertices and left six edges: AB, BD, CA, DE, DF, EG + +Using `network`, an 2D array representing network in matrix form, find the maximum saving which can be achieved by removing redundant edges whilst ensuring that the network remains connected. Vertices not having connection will be represented with `-1`. # --hints-- -`euler107()` should return 259679. +`minimalNetwork(testNetwork)` should return `259679`. ```js -assert.strictEqual(euler107(), 259679); +assert.strictEqual(minimalNetwork(_testNetwork), 259679); ``` # --seed-- +## --after-user-code-- + +```js +const _testNetwork = [ + [-1,-1,-1,427,668,495,377,678,-1,177,-1,-1,870,-1,869,624,300,609,131,-1,251,-1,-1,-1,856,221,514,-1,591,762,182,56,-1,884,412,273,636,-1,-1,774],[-1,-1,262,-1,-1,508,472,799,-1,956,578,363,940,143,-1,162,122,910,-1,729,802,941,922,573,531,539,667,607,-1,920,-1,-1,315,649,937,-1,185,102,636,289],[-1,262,-1,-1,926,-1,958,158,647,47,621,264,81,-1,402,813,649,386,252,391,264,637,349,-1,-1,-1,108,-1,727,225,578,699,-1,898,294,-1,575,168,432,833],[427,-1,-1,-1,366,-1,-1,635,-1,32,962,468,893,854,718,427,448,916,258,-1,760,909,529,311,404,-1,-1,588,680,875,-1,615,-1,409,758,221,-1,-1,76,257],[668,-1,926,366,-1,-1,-1,250,268,-1,503,944,-1,677,-1,727,793,457,981,191,-1,-1,-1,351,969,925,987,328,282,589,-1,873,477,-1,-1,19,450,-1,-1,-1],[495,508,-1,-1,-1,-1,-1,765,711,819,305,302,926,-1,-1,582,-1,861,-1,683,293,-1,-1,66,-1,27,-1,-1,290,-1,786,-1,554,817,33,-1,54,506,386,381],[377,472,958,-1,-1,-1,-1,-1,-1,120,42,-1,134,219,457,639,538,374,-1,-1,-1,966,-1,-1,-1,-1,-1,449,120,797,358,232,550,-1,305,997,662,744,686,239],[678,799,158,635,250,765,-1,-1,-1,35,-1,106,385,652,160,-1,890,812,605,953,-1,-1,-1,79,-1,712,613,312,452,-1,978,900,-1,901,-1,-1,225,533,770,722],[-1,-1,647,-1,268,711,-1,-1,-1,283,-1,172,-1,663,236,36,403,286,986,-1,-1,810,761,574,53,793,-1,-1,777,330,936,883,286,-1,174,-1,-1,-1,828,711],[177,956,47,32,-1,819,120,35,283,-1,50,-1,565,36,767,684,344,489,565,-1,-1,103,810,463,733,665,494,644,863,25,385,-1,342,470,-1,-1,-1,730,582,468],[-1,578,621,962,503,305,42,-1,-1,50,-1,155,519,-1,-1,256,990,801,154,53,474,650,402,-1,-1,-1,966,-1,-1,406,989,772,932,7,-1,823,391,-1,-1,933],[-1,363,264,468,944,302,-1,106,172,-1,155,-1,-1,-1,380,438,-1,41,266,-1,-1,104,867,609,-1,270,861,-1,-1,165,-1,675,250,686,995,366,191,-1,433,-1],[870,940,81,893,-1,926,134,385,-1,565,519,-1,-1,313,851,-1,-1,-1,248,220,-1,826,359,829,-1,234,198,145,409,68,359,-1,814,218,186,-1,-1,929,203,-1],[-1,143,-1,854,677,-1,219,652,663,36,-1,-1,313,-1,132,-1,433,598,-1,-1,168,870,-1,-1,-1,128,437,-1,383,364,966,227,-1,-1,807,993,-1,-1,526,17],[869,-1,402,718,-1,-1,457,160,236,767,-1,380,851,132,-1,-1,596,903,613,730,-1,261,-1,142,379,885,89,-1,848,258,112,-1,900,-1,-1,818,639,268,600,-1],[624,162,813,427,727,582,639,-1,36,684,256,438,-1,-1,-1,-1,539,379,664,561,542,-1,999,585,-1,-1,321,398,-1,-1,950,68,193,-1,697,-1,390,588,848,-1],[300,122,649,448,793,-1,538,890,403,344,990,-1,-1,433,596,539,-1,-1,73,-1,318,-1,-1,500,-1,968,-1,291,-1,-1,765,196,504,757,-1,542,-1,395,227,148],[609,910,386,916,457,861,374,812,286,489,801,41,-1,598,903,379,-1,-1,-1,946,136,399,-1,941,707,156,757,258,251,-1,807,-1,-1,-1,461,501,-1,-1,616,-1],[131,-1,252,258,981,-1,-1,605,986,565,154,266,248,-1,613,664,73,-1,-1,686,-1,-1,575,627,817,282,-1,698,398,222,-1,649,-1,-1,-1,-1,-1,654,-1,-1],[-1,729,391,-1,191,683,-1,953,-1,-1,53,-1,220,-1,730,561,-1,946,686,-1,-1,389,729,553,304,703,455,857,260,-1,991,182,351,477,867,-1,-1,889,217,853],[251,802,264,760,-1,293,-1,-1,-1,-1,474,-1,-1,168,-1,542,318,136,-1,-1,-1,-1,392,-1,-1,-1,267,407,27,651,80,927,-1,974,977,-1,-1,457,117,-1],[-1,941,637,909,-1,-1,966,-1,810,103,650,104,826,870,261,-1,-1,399,-1,389,-1,-1,-1,202,-1,-1,-1,-1,867,140,403,962,785,-1,511,-1,1,-1,707,-1],[-1,922,349,529,-1,-1,-1,-1,761,810,402,867,359,-1,-1,999,-1,-1,575,729,392,-1,-1,388,939,-1,959,-1,83,463,361,-1,-1,512,931,-1,224,690,369,-1],[-1,573,-1,311,351,66,-1,79,574,463,-1,609,829,-1,142,585,500,941,627,553,-1,202,388,-1,164,829,-1,620,523,639,936,-1,-1,490,-1,695,-1,505,109,-1],[856,531,-1,404,969,-1,-1,-1,53,733,-1,-1,-1,-1,379,-1,-1,707,817,304,-1,-1,939,164,-1,-1,616,716,728,-1,889,349,-1,963,150,447,-1,292,586,264],[221,539,-1,-1,925,27,-1,712,793,665,-1,270,234,128,885,-1,968,156,282,703,-1,-1,-1,829,-1,-1,-1,822,-1,-1,-1,736,576,-1,697,946,443,-1,205,194],[514,667,108,-1,987,-1,-1,613,-1,494,966,861,198,437,89,321,-1,757,-1,455,267,-1,959,-1,616,-1,-1,-1,349,156,339,-1,102,790,359,-1,439,938,809,260],[-1,607,-1,588,328,-1,449,312,-1,644,-1,-1,145,-1,-1,398,291,258,698,857,407,-1,-1,620,716,822,-1,-1,293,486,943,-1,779,-1,6,880,116,775,-1,947],[591,-1,727,680,282,290,120,452,777,863,-1,-1,409,383,848,-1,-1,251,398,260,27,867,83,523,728,-1,349,293,-1,212,684,505,341,384,9,992,507,48,-1,-1],[762,920,225,875,589,-1,797,-1,330,25,406,165,68,364,258,-1,-1,-1,222,-1,651,140,463,639,-1,-1,156,486,212,-1,-1,349,723,-1,-1,186,-1,36,240,752],[182,-1,578,-1,-1,786,358,978,936,385,989,-1,359,966,112,950,765,807,-1,991,80,403,361,936,889,-1,339,943,684,-1,-1,965,302,676,725,-1,327,134,-1,147],[56,-1,699,615,873,-1,232,900,883,-1,772,675,-1,227,-1,68,196,-1,649,182,927,962,-1,-1,349,736,-1,-1,505,349,965,-1,474,178,833,-1,-1,555,853,-1],[-1,315,-1,-1,477,554,550,-1,286,342,932,250,814,-1,900,193,504,-1,-1,351,-1,785,-1,-1,-1,576,102,779,341,723,302,474,-1,689,-1,-1,-1,451,-1,-1],[884,649,898,409,-1,817,-1,901,-1,470,7,686,218,-1,-1,-1,757,-1,-1,477,974,-1,512,490,963,-1,790,-1,384,-1,676,178,689,-1,245,596,445,-1,-1,343],[412,937,294,758,-1,33,305,-1,174,-1,-1,995,186,807,-1,697,-1,461,-1,867,977,511,931,-1,150,697,359,6,9,-1,725,833,-1,245,-1,949,-1,270,-1,112],[273,-1,-1,221,19,-1,997,-1,-1,-1,823,366,-1,993,818,-1,542,501,-1,-1,-1,-1,-1,695,447,946,-1,880,992,186,-1,-1,-1,596,949,-1,91,-1,768,273],[636,185,575,-1,450,54,662,225,-1,-1,391,191,-1,-1,639,390,-1,-1,-1,-1,-1,1,224,-1,-1,443,439,116,507,-1,327,-1,-1,445,-1,91,-1,248,-1,344],[-1,102,168,-1,-1,506,744,533,-1,730,-1,-1,929,-1,268,588,395,-1,654,889,457,-1,690,505,292,-1,938,775,48,36,134,555,451,-1,270,-1,248,-1,371,680],[-1,636,432,76,-1,386,686,770,828,582,-1,433,203,526,600,848,227,616,-1,217,117,707,369,109,586,205,809,-1,-1,240,-1,853,-1,-1,-1,768,-1,371,-1,540],[774,289,833,257,-1,381,239,722,711,468,933,-1,-1,17,-1,-1,148,-1,-1,853,-1,-1,-1,-1,264,194,260,947,-1,752,147,-1,-1,343,112,273,344,680,540,-1] +]; +``` + ## --seed-contents-- ```js -function euler107() { +function minimalNetwork(network) { return true; } -euler107(); +const testNetwork = [ + [-1,-1,-1,427,668,495,377,678,-1,177,-1,-1,870,-1,869,624,300,609,131,-1,251,-1,-1,-1,856,221,514,-1,591,762,182,56,-1,884,412,273,636,-1,-1,774],[-1,-1,262,-1,-1,508,472,799,-1,956,578,363,940,143,-1,162,122,910,-1,729,802,941,922,573,531,539,667,607,-1,920,-1,-1,315,649,937,-1,185,102,636,289],[-1,262,-1,-1,926,-1,958,158,647,47,621,264,81,-1,402,813,649,386,252,391,264,637,349,-1,-1,-1,108,-1,727,225,578,699,-1,898,294,-1,575,168,432,833],[427,-1,-1,-1,366,-1,-1,635,-1,32,962,468,893,854,718,427,448,916,258,-1,760,909,529,311,404,-1,-1,588,680,875,-1,615,-1,409,758,221,-1,-1,76,257],[668,-1,926,366,-1,-1,-1,250,268,-1,503,944,-1,677,-1,727,793,457,981,191,-1,-1,-1,351,969,925,987,328,282,589,-1,873,477,-1,-1,19,450,-1,-1,-1],[495,508,-1,-1,-1,-1,-1,765,711,819,305,302,926,-1,-1,582,-1,861,-1,683,293,-1,-1,66,-1,27,-1,-1,290,-1,786,-1,554,817,33,-1,54,506,386,381],[377,472,958,-1,-1,-1,-1,-1,-1,120,42,-1,134,219,457,639,538,374,-1,-1,-1,966,-1,-1,-1,-1,-1,449,120,797,358,232,550,-1,305,997,662,744,686,239],[678,799,158,635,250,765,-1,-1,-1,35,-1,106,385,652,160,-1,890,812,605,953,-1,-1,-1,79,-1,712,613,312,452,-1,978,900,-1,901,-1,-1,225,533,770,722],[-1,-1,647,-1,268,711,-1,-1,-1,283,-1,172,-1,663,236,36,403,286,986,-1,-1,810,761,574,53,793,-1,-1,777,330,936,883,286,-1,174,-1,-1,-1,828,711],[177,956,47,32,-1,819,120,35,283,-1,50,-1,565,36,767,684,344,489,565,-1,-1,103,810,463,733,665,494,644,863,25,385,-1,342,470,-1,-1,-1,730,582,468],[-1,578,621,962,503,305,42,-1,-1,50,-1,155,519,-1,-1,256,990,801,154,53,474,650,402,-1,-1,-1,966,-1,-1,406,989,772,932,7,-1,823,391,-1,-1,933],[-1,363,264,468,944,302,-1,106,172,-1,155,-1,-1,-1,380,438,-1,41,266,-1,-1,104,867,609,-1,270,861,-1,-1,165,-1,675,250,686,995,366,191,-1,433,-1],[870,940,81,893,-1,926,134,385,-1,565,519,-1,-1,313,851,-1,-1,-1,248,220,-1,826,359,829,-1,234,198,145,409,68,359,-1,814,218,186,-1,-1,929,203,-1],[-1,143,-1,854,677,-1,219,652,663,36,-1,-1,313,-1,132,-1,433,598,-1,-1,168,870,-1,-1,-1,128,437,-1,383,364,966,227,-1,-1,807,993,-1,-1,526,17],[869,-1,402,718,-1,-1,457,160,236,767,-1,380,851,132,-1,-1,596,903,613,730,-1,261,-1,142,379,885,89,-1,848,258,112,-1,900,-1,-1,818,639,268,600,-1],[624,162,813,427,727,582,639,-1,36,684,256,438,-1,-1,-1,-1,539,379,664,561,542,-1,999,585,-1,-1,321,398,-1,-1,950,68,193,-1,697,-1,390,588,848,-1],[300,122,649,448,793,-1,538,890,403,344,990,-1,-1,433,596,539,-1,-1,73,-1,318,-1,-1,500,-1,968,-1,291,-1,-1,765,196,504,757,-1,542,-1,395,227,148],[609,910,386,916,457,861,374,812,286,489,801,41,-1,598,903,379,-1,-1,-1,946,136,399,-1,941,707,156,757,258,251,-1,807,-1,-1,-1,461,501,-1,-1,616,-1],[131,-1,252,258,981,-1,-1,605,986,565,154,266,248,-1,613,664,73,-1,-1,686,-1,-1,575,627,817,282,-1,698,398,222,-1,649,-1,-1,-1,-1,-1,654,-1,-1],[-1,729,391,-1,191,683,-1,953,-1,-1,53,-1,220,-1,730,561,-1,946,686,-1,-1,389,729,553,304,703,455,857,260,-1,991,182,351,477,867,-1,-1,889,217,853],[251,802,264,760,-1,293,-1,-1,-1,-1,474,-1,-1,168,-1,542,318,136,-1,-1,-1,-1,392,-1,-1,-1,267,407,27,651,80,927,-1,974,977,-1,-1,457,117,-1],[-1,941,637,909,-1,-1,966,-1,810,103,650,104,826,870,261,-1,-1,399,-1,389,-1,-1,-1,202,-1,-1,-1,-1,867,140,403,962,785,-1,511,-1,1,-1,707,-1],[-1,922,349,529,-1,-1,-1,-1,761,810,402,867,359,-1,-1,999,-1,-1,575,729,392,-1,-1,388,939,-1,959,-1,83,463,361,-1,-1,512,931,-1,224,690,369,-1],[-1,573,-1,311,351,66,-1,79,574,463,-1,609,829,-1,142,585,500,941,627,553,-1,202,388,-1,164,829,-1,620,523,639,936,-1,-1,490,-1,695,-1,505,109,-1],[856,531,-1,404,969,-1,-1,-1,53,733,-1,-1,-1,-1,379,-1,-1,707,817,304,-1,-1,939,164,-1,-1,616,716,728,-1,889,349,-1,963,150,447,-1,292,586,264],[221,539,-1,-1,925,27,-1,712,793,665,-1,270,234,128,885,-1,968,156,282,703,-1,-1,-1,829,-1,-1,-1,822,-1,-1,-1,736,576,-1,697,946,443,-1,205,194],[514,667,108,-1,987,-1,-1,613,-1,494,966,861,198,437,89,321,-1,757,-1,455,267,-1,959,-1,616,-1,-1,-1,349,156,339,-1,102,790,359,-1,439,938,809,260],[-1,607,-1,588,328,-1,449,312,-1,644,-1,-1,145,-1,-1,398,291,258,698,857,407,-1,-1,620,716,822,-1,-1,293,486,943,-1,779,-1,6,880,116,775,-1,947],[591,-1,727,680,282,290,120,452,777,863,-1,-1,409,383,848,-1,-1,251,398,260,27,867,83,523,728,-1,349,293,-1,212,684,505,341,384,9,992,507,48,-1,-1],[762,920,225,875,589,-1,797,-1,330,25,406,165,68,364,258,-1,-1,-1,222,-1,651,140,463,639,-1,-1,156,486,212,-1,-1,349,723,-1,-1,186,-1,36,240,752],[182,-1,578,-1,-1,786,358,978,936,385,989,-1,359,966,112,950,765,807,-1,991,80,403,361,936,889,-1,339,943,684,-1,-1,965,302,676,725,-1,327,134,-1,147],[56,-1,699,615,873,-1,232,900,883,-1,772,675,-1,227,-1,68,196,-1,649,182,927,962,-1,-1,349,736,-1,-1,505,349,965,-1,474,178,833,-1,-1,555,853,-1],[-1,315,-1,-1,477,554,550,-1,286,342,932,250,814,-1,900,193,504,-1,-1,351,-1,785,-1,-1,-1,576,102,779,341,723,302,474,-1,689,-1,-1,-1,451,-1,-1],[884,649,898,409,-1,817,-1,901,-1,470,7,686,218,-1,-1,-1,757,-1,-1,477,974,-1,512,490,963,-1,790,-1,384,-1,676,178,689,-1,245,596,445,-1,-1,343],[412,937,294,758,-1,33,305,-1,174,-1,-1,995,186,807,-1,697,-1,461,-1,867,977,511,931,-1,150,697,359,6,9,-1,725,833,-1,245,-1,949,-1,270,-1,112],[273,-1,-1,221,19,-1,997,-1,-1,-1,823,366,-1,993,818,-1,542,501,-1,-1,-1,-1,-1,695,447,946,-1,880,992,186,-1,-1,-1,596,949,-1,91,-1,768,273],[636,185,575,-1,450,54,662,225,-1,-1,391,191,-1,-1,639,390,-1,-1,-1,-1,-1,1,224,-1,-1,443,439,116,507,-1,327,-1,-1,445,-1,91,-1,248,-1,344],[-1,102,168,-1,-1,506,744,533,-1,730,-1,-1,929,-1,268,588,395,-1,654,889,457,-1,690,505,292,-1,938,775,48,36,134,555,451,-1,270,-1,248,-1,371,680],[-1,636,432,76,-1,386,686,770,828,582,-1,433,203,526,600,848,227,616,-1,217,117,707,369,109,586,205,809,-1,-1,240,-1,853,-1,-1,-1,768,-1,371,-1,540],[774,289,833,257,-1,381,239,722,711,468,933,-1,-1,17,-1,-1,148,-1,-1,853,-1,-1,-1,-1,264,194,260,947,-1,752,147,-1,-1,343,112,273,344,680,540,-1] +]; + +minimalNetwork(testNetwork); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-108-diophantine-reciprocals-i.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-108-diophantine-reciprocals-i.md index d216cfa9fd..52aa7ab07f 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-108-diophantine-reciprocals-i.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-108-diophantine-reciprocals-i.md @@ -10,19 +10,23 @@ dashedName: problem-108-diophantine-reciprocals-i In the following equation x, y, and n are positive integers. -1/`x` + 1/`y` = 1/`n` +$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$ For `n` = 4 there are exactly three distinct solutions: -1/5 + 1/20 = 1/4 -1/6 + 1/12 = 1/4 -1/8 + 1/8 = 1/4 +$$\begin{align} + & \frac{1}{5} + \frac{1}{20} = \frac{1}{4}\\\\ + \\\\ + & \frac{1}{6} + \frac{1}{12} = \frac{1}{4}\\\\ + \\\\ + & \frac{1}{8} + \frac{1}{8} = \frac{1}{4} +\end{align}$$ What is the least value of `n` for which the number of distinct solutions exceeds one-thousand? # --hints-- -`diophantineOne()` should return 180180. +`diophantineOne()` should return `180180`. ```js assert.strictEqual(diophantineOne(), 180180); diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-109-darts.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-109-darts.md index e7a580b45b..150a67a4d3 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-109-darts.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-109-darts.md @@ -10,28 +10,38 @@ dashedName: problem-109-darts In the game of darts a player throws three darts at a target board which is split into twenty equal sized sections numbered one to twenty. -The score of a dart is determined by the number of the region that the dart lands in. A dart landing outside the red/green outer ring scores zero. The black and cream regions inside this ring represent single scores. However, the red/green outer ring and middle ring score double and treble scores respectively. At the centre of the board are two concentric circles called the bull region, or bulls-eye. The outer bull is worth 25 points and the inner bull is a double, worth 50 points. There are many variations of rules but in the most popular game the players will begin with a score 301 or 501 and the first player to reduce their running total to zero is a winner. However, it is normal to play a "doubles out" system, which means that the player must land a double (including the double bulls-eye at the centre of the board) on their final dart to win; any other dart that would reduce their running total to one or lower means the score for that set of three darts is "bust". When a player is able to finish on their current score it is called a "checkout" and the highest checkout is 170: T20 T20 D25 (two treble 20s and double bull). There are exactly eleven distinct ways to checkout on a score of 6: +Darts board -D3 +The score of a dart is determined by the number of the region that the dart lands in. A dart landing outside the red/green outer ring scores zero. The black and cream regions inside this ring represent single scores. However, the red/green outer ring and middle ring score double and treble scores respectively. -D1 D2 +At the center of the board are two concentric circles called the bull region, or bulls-eye. The outer bull is worth 25 points and the inner bull is a double, worth 50 points. -S2 D2 +There are many variations of rules but in the most popular game the players will begin with a score of 301 or 501 and the first player to reduce their running total to zero is a winner. However, it is normal to play a "doubles out" system, which means that the player must land a double (including the double bulls-eye at the center of the board) on their final dart to win; any other dart that would reduce their running total to one or lower means the score for that set of three darts is "bust". -D2 D1 +When a player is able to finish on their current score it is called a "checkout" and the highest checkout is 170: T20 T20 D25 (two treble 20s and double bull). There are exactly eleven distinct ways to checkout on a score of 6: -S4 D1 +$$\begin{array} + \text{D3} & & \\\\ + D1 & D2 & \\\\ + S2 & D2 & \\\\ + D2 & D1 & \\\\ + S4 & D1 & \\\\ + S1 & S1 & D2 \\\\ + S1 & T1 & D1 \\\\ + S1 & S3 & D1 \\\\ + D1 & D1 & D1 \\\\ + D1 & S2 & D1 \\\\ + S2 & S2 & D1 +\end{array}$$ -S1 S1 D2 S1 T1 D1 S1 S3 D1 D1 D1 D1 D1 S2 D1 S2 S2 D1 - -Note that D1 D2 is considered different to D2 D1 as they finish on different doubles. However, the combination S1 T1 D1 is considered the same as T1 S1 D1. In addition we shall not include misses in considering combinations; for example, D3 is the same as 0 D3 and 0 0 D3. Incredibly there are 42336 distinct ways of checking out in total. How many distinct ways can a player checkout with a score less than 100? +Note that D1 D2 is considered different from D2 D1 as they finish on different doubles. However, the combination S1 T1 D1 is considered the same as T1 S1 D1. In addition, we shall not include misses in considering combinations; for example, D3 is the same as 0 D3 and 0 0 D3. Incredibly there are 42336 distinct ways of checking out in total. How many distinct ways can a player checkout with a score less than 100? # --hints-- -`euler109()` should return 38182. +`darts()` should return `38182`. ```js -assert.strictEqual(euler109(), 38182); +assert.strictEqual(darts(), 38182); ``` # --seed-- @@ -39,12 +49,12 @@ assert.strictEqual(euler109(), 38182); ## --seed-contents-- ```js -function euler109() { +function darts() { return true; } -euler109(); +darts(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-110-diophantine-reciprocals-ii.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-110-diophantine-reciprocals-ii.md index c50c81a164..79070c6654 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-110-diophantine-reciprocals-ii.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-110-diophantine-reciprocals-ii.md @@ -10,15 +10,17 @@ dashedName: problem-110-diophantine-reciprocals-ii In the following equation x, y, and n are positive integers. -1/`x` + 1/`y` = 1/`n` +$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$ It can be verified that when `n` = 1260 there are 113 distinct solutions and this is the least value of `n` for which the total number of distinct solutions exceeds one hundred. What is the least value of `n` for which the number of distinct solutions exceeds four million? +**Note:** This problem is a much more difficult version of Problem 108 and as it is well beyond the limitations of a brute force approach it requires a clever implementation. + # --hints-- -`diophantineTwo()` should return 9350130049860600. +`diophantineTwo()` should return `9350130049860600`. ```js assert.strictEqual(diophantineTwo(), 9350130049860600); diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-111-primes-with-runs.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-111-primes-with-runs.md index 920085b1f3..51373dcd65 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-111-primes-with-runs.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-111-primes-with-runs.md @@ -10,24 +10,35 @@ dashedName: problem-111-primes-with-runs Considering 4-digit primes containing repeated digits it is clear that they cannot all be the same: 1111 is divisible by 11, 2222 is divisible by 22, and so on. But there are nine 4-digit primes containing three ones: -1117, 1151, 1171, 1181, 1511, 1811, 2111, 4111, 8111 +$$1117, 1151, 1171, 1181, 1511, 1811, 2111, 4111, 8111$$ -We shall say that M(n, d) represents the maximum number of repeated digits for an n-digit prime where d is the repeated digit, N(n, d) represents the number of such primes, and S(n, d) represents the sum of these primes. +We shall say that $M(n, d)$ represents the maximum number of repeated digits for an n-digit prime where d is the repeated digit, $N(n, d)$ represents the number of such primes, and $S(n, d)$ represents the sum of these primes. -So M(4, 1) = 3 is the maximum number of repeated digits for a 4-digit prime where one is the repeated digit, there are N(4, 1) = 9 such primes, and the sum of these primes is S(4, 1) = 22275. It turns out that for d = 0, it is only possible to have M(4, 0) = 2 repeated digits, but there are N(4, 0) = 13 such cases. +So $M(4, 1) = 3$ is the maximum number of repeated digits for a 4-digit prime where one is the repeated digit, there are $N(4, 1) = 9$ such primes, and the sum of these primes is $S(4, 1) = 22275$. It turns out that for d = 0, it is only possible to have $M(4, 0) = 2$ repeated digits, but there are $N(4, 0) = 13$ such cases. In the same way we obtain the following results for 4-digit primes. -Digit, d M(4, d) N(4, d) S(4, d) 0 2 13 67061 1 3 9 22275 2 3 1 2221 3 3 12 46214 4 3 2 8888 5 3 1 5557 6 3 1 6661 7 3 9 57863 8 3 1 8887 9 3 7 48073 +| Digit, d | $M(4, d)$ | $N(4, d)$ | $S(4, d)$ | +|----------|-----------|-----------|-----------| +| 0 | 2 | 13 | 67061 | +| 1 | 3 | 9 | 22275 | +| 2 | 3 | 1 | 2221 | +| 3 | 3 | 12 | 46214 | +| 4 | 3 | 2 | 8888 | +| 5 | 3 | 1 | 5557 | +| 6 | 3 | 1 | 6661 | +| 7 | 3 | 9 | 57863 | +| 8 | 3 | 1 | 8887 | +| 9 | 3 | 7 | 48073 | -For d = 0 to 9, the sum of all S(4, d) is 273700. Find the sum of all S(10, d). +For d = 0 to 9, the sum of all $S(4, d)$ is 273700. Find the sum of all $S(10, d)$. # --hints-- -`euler111()` should return 612407567715. +`primesWithRuns()` should return `612407567715`. ```js -assert.strictEqual(euler111(), 612407567715); +assert.strictEqual(primesWithRuns(), 612407567715); ``` # --seed-- @@ -35,12 +46,12 @@ assert.strictEqual(euler111(), 612407567715); ## --seed-contents-- ```js -function euler111() { +function primesWithRuns() { return true; } -euler111(); +primesWithRuns(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-112-bouncy-numbers.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-112-bouncy-numbers.md index cd998d5bde..d2b8f07198 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-112-bouncy-numbers.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-112-bouncy-numbers.md @@ -22,10 +22,10 @@ Find the least number for which the proportion of bouncy numbers is exactly 99%. # --hints-- -`euler112()` should return 1587000. +`bouncyNumbers()` should return `1587000`. ```js -assert.strictEqual(euler112(), 1587000); +assert.strictEqual(bouncyNumbers(), 1587000); ``` # --seed-- @@ -33,12 +33,12 @@ assert.strictEqual(euler112(), 1587000); ## --seed-contents-- ```js -function euler112() { +function bouncyNumbers() { return true; } -euler112(); +bouncyNumbers(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-113-non-bouncy-numbers.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-113-non-bouncy-numbers.md index bc28697a24..a06f41a9a5 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-113-non-bouncy-numbers.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-113-non-bouncy-numbers.md @@ -14,16 +14,16 @@ Similarly if no digit is exceeded by the digit to its right it is called a decre We shall call a positive integer that is neither increasing nor decreasing a "bouncy" number; for example, 155349. -As n increases, the proportion of bouncy numbers below n increases such that there are only 12951 numbers below one-million that are not bouncy and only 277032 non-bouncy numbers below 1010. +As n increases, the proportion of bouncy numbers below n increases such that there are only 12951 numbers below one-million that are not bouncy and only 277032 non-bouncy numbers below ${10}^{10}$. -How many numbers below a googol (10100) are not bouncy? +How many numbers below a googol (${10}^{100}$) are not bouncy? # --hints-- -`euler113()` should return 51161058134250. +`nonBouncyNumbers()` should return `51161058134250`. ```js -assert.strictEqual(euler113(), 51161058134250); +assert.strictEqual(nonBouncyNumbers(), 51161058134250); ``` # --seed-- @@ -31,12 +31,12 @@ assert.strictEqual(euler113(), 51161058134250); ## --seed-contents-- ```js -function euler113() { +function nonBouncyNumbers() { return true; } -euler113(); +nonBouncyNumbers(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-114-counting-block-combinations-i.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-114-counting-block-combinations-i.md index c9ec66c9aa..01bd2e8d71 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-114-counting-block-combinations-i.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-114-counting-block-combinations-i.md @@ -10,14 +10,18 @@ dashedName: problem-114-counting-block-combinations-i A row measuring seven units in length has red blocks with a minimum length of three units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square. There are exactly seventeen ways of doing this. -How many ways can a row measuring fifty units in length be filled? NOTE: Although the example above does not lend itself to the possibility, in general it is permitted to mix block sizes. For example, on a row measuring eight units in length you could use red (3), black (1), and red (4). +Possible ways of placing block with a minimum length of three units, on a row with length of seven units + +How many ways can a row measuring fifty units in length be filled? + +**Note:** Although the example above does not lend itself to the possibility, in general it is permitted to mix block sizes. For example, on a row measuring eight units in length you could use red (3), black (1), and red (4). # --hints-- -`euler114()` should return 16475640049. +`countingBlockOne()` should return `16475640049`. ```js -assert.strictEqual(euler114(), 16475640049); +assert.strictEqual(countingBlockOne(), 16475640049); ``` # --seed-- @@ -25,12 +29,12 @@ assert.strictEqual(euler114(), 16475640049); ## --seed-contents-- ```js -function euler114() { +function countingBlockOne() { return true; } -euler114(); +countingBlockOne(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-115-counting-block-combinations-ii.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-115-counting-block-combinations-ii.md index 069a8a2c38..1e65da5610 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-115-counting-block-combinations-ii.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-115-counting-block-combinations-ii.md @@ -8,26 +8,26 @@ dashedName: problem-115-counting-block-combinations-ii # --description-- -NOTE: This is a more difficult version of Problem 114. +A row measuring `n` units in length has red blocks with a minimum length of `m` units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square. -A row measuring n units in length has red blocks with a minimum length of m units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square. +Let the fill-count function, $F(m, n)$, represent the number of ways that a row can be filled. -Let the fill-count function, F(m, n), represent the number of ways that a row can be filled. - -For example, F(3, 29) = 673135 and F(3, 30) = 1089155. +For example, $F(3, 29) = 673135$ and $F(3, 30) = 1089155$. That is, for m = 3, it can be seen that n = 30 is the smallest value for which the fill-count function first exceeds one million. -In the same way, for m = 10, it can be verified that F(10, 56) = 880711 and F(10, 57) = 1148904, so n = 57 is the least value for which the fill-count function first exceeds one million. +In the same way, for m = 10, it can be verified that $F(10, 56) = 880711$ and $F(10, 57) = 1148904$, so n = 57 is the least value for which the fill-count function first exceeds one million. -For m = 50, find the least value of n for which the fill-count function first exceeds one million. +For m = 50, find the least value of `n` for which the fill-count function first exceeds one million. + +**Note:** This is a more difficult version of Problem 114. # --hints-- -`euler115()` should return 168. +`countingBlockTwo()` should return `168`. ```js -assert.strictEqual(euler115(), 168); +assert.strictEqual(countingBlockTwo(), 168); ``` # --seed-- @@ -35,12 +35,12 @@ assert.strictEqual(euler115(), 168); ## --seed-contents-- ```js -function euler115() { +function countingBlockTwo() { return true; } -euler115(); +countingBlockTwo(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-116-red-green-or-blue-tiles.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-116-red-green-or-blue-tiles.md index 1f61195dea..2d2e54b83d 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-116-red-green-or-blue-tiles.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-116-red-green-or-blue-tiles.md @@ -12,18 +12,26 @@ A row of five black square tiles is to have a number of its tiles replaced with If red tiles are chosen there are exactly seven ways this can be done. +Possible ways to placing red oblong on a row with length of five units + If green tiles are chosen there are three ways. +Possible ways of placing green oblong on a row with length of five units + And if blue tiles are chosen there are two ways. -Assuming that colours cannot be mixed there are 7 + 3 + 2 = 12 ways of replacing the black tiles in a row measuring five units in length. How many different ways can the black tiles in a row measuring fifty units in length be replaced if colours cannot be mixed and at least one coloured tile must be used? NOTE: This is related to Problem 117. +Possible ways of placing blue oblong on a row with length of five units + +Assuming that colors cannot be mixed there are 7 + 3 + 2 = 12 ways of replacing the black tiles in a row measuring five units in length. How many different ways can the black tiles in a row measuring fifty units in length be replaced if colors cannot be mixed and at least one colored tile must be used? + +**Note:** This is related to Problem 117. # --hints-- -`euler116()` should return 20492570929. +`redGreenBlueOne()` should return `20492570929`. ```js -assert.strictEqual(euler116(), 20492570929); +assert.strictEqual(redGreenBlueOne(), 20492570929); ``` # --seed-- @@ -31,12 +39,12 @@ assert.strictEqual(euler116(), 20492570929); ## --seed-contents-- ```js -function euler116() { +function redGreenBlueOne() { return true; } -euler116(); +redGreenBlueOne(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-117-red-green-and-blue-tiles.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-117-red-green-and-blue-tiles.md index 80f46d1201..51c5743a75 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-117-red-green-and-blue-tiles.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-117-red-green-and-blue-tiles.md @@ -10,14 +10,18 @@ dashedName: problem-117-red-green-and-blue-tiles Using a combination of black square tiles and oblong tiles chosen from: red tiles measuring two units, green tiles measuring three units, and blue tiles measuring four units, it is possible to tile a row measuring five units in length in exactly fifteen different ways. -How many ways can a row measuring fifty units in length be tiled? NOTE: This is related to Problem 116. +Possible ways of placing red, green and blue oblongs on a row with length of five units + +How many ways can a row measuring fifty units in length be tiled? + +**Note**: This is related to Problem 116. # --hints-- -`euler117()` should return 100808458960497. +`redGreenBlueTilesTwo()` should return `100808458960497`. ```js -assert.strictEqual(euler117(), 100808458960497); +assert.strictEqual(redGreenBlueTilesTwo(), 100808458960497); ``` # --seed-- @@ -25,12 +29,12 @@ assert.strictEqual(euler117(), 100808458960497); ## --seed-contents-- ```js -function euler117() { +function redGreenBlueTilesTwo() { return true; } -euler117(); +redGreenBlueTilesTwo(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-118-pandigital-prime-sets.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-118-pandigital-prime-sets.md index 8bcd4b5dcd..00a0605319 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-118-pandigital-prime-sets.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-118-pandigital-prime-sets.md @@ -8,16 +8,16 @@ dashedName: problem-118-pandigital-prime-sets # --description-- -Using all of the digits 1 through 9 and concatenating them freely to form decimal integers, different sets can be formed. Interestingly with the set {2,5,47,89,631}, all of the elements belonging to it are prime. +Using all of the digits 1 through 9 and concatenating them freely to form decimal integers, different sets can be formed. Interestingly with the set $\\{2, 5, 47, 89, 631\\}$, all of the elements belonging to it are prime. How many distinct sets containing each of the digits one through nine exactly once contain only prime elements? # --hints-- -`euler118()` should return 44680. +`pandigitalPrimeSets()` should return `44680`. ```js -assert.strictEqual(euler118(), 44680); +assert.strictEqual(pandigitalPrimeSets(), 44680); ``` # --seed-- @@ -25,12 +25,12 @@ assert.strictEqual(euler118(), 44680); ## --seed-contents-- ```js -function euler118() { +function pandigitalPrimeSets() { return true; } -euler118(); +pandigitalPrimeSets(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-119-digit-power-sum.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-119-digit-power-sum.md index 40853a1314..72ed8397d7 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-119-digit-power-sum.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-119-digit-power-sum.md @@ -8,20 +8,20 @@ dashedName: problem-119-digit-power-sum # --description-- -The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with this property is 614656 = 284. +The number 512 is interesting because it is equal to the sum of its digits raised to some power: $5 + 1 + 2 = 8$, and $8^3 = 512$. Another example of a number with this property is $614656 = 28^4$. -We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a sum. +We shall define an to be the $n-th$ term of this sequence and insist that a number must contain at least two digits to have a sum. -You are given that a2 = 512 and a10 = 614656. +You are given that $a_2 = 512$ and $a_{10} = 614656$. -Find a30. +Find $a_{30}$. # --hints-- -`euler119()` should return 248155780267521. +`digitPowerSum()` should return `248155780267521`. ```js -assert.strictEqual(euler119(), 248155780267521); +assert.strictEqual(digitPowerSum(), 248155780267521); ``` # --seed-- @@ -29,12 +29,12 @@ assert.strictEqual(euler119(), 248155780267521); ## --seed-contents-- ```js -function euler119() { +function digitPowerSum() { return true; } -euler119(); +digitPowerSum(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-120-square-remainders.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-120-square-remainders.md index 6bcf398e78..828f12b906 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-120-square-remainders.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-120-square-remainders.md @@ -8,18 +8,18 @@ dashedName: problem-120-square-remainders # --description-- -Let r be the remainder when (a−1)n + (a+1)n is divided by a2. +Let `r` be the remainder when ${(a − 1)}^n + {(a + 1)}^n$ is divided by $a^2$. -For example, if a = 7 and n = 3, then r = 42: 63 + 83 = 728 ≡ 42 mod 49. And as n varies, so too will r, but for a = 7 it turns out that rmax = 42. +For example, if $a = 7$ and $n = 3$, then $r = 42: 6^3 + 8^3 = 728 ≡ 42 \\ \text{mod}\\ 49$. And as `n` varies, so too will `r`, but for $a = 7$ it turns out that $r_{max} = 42$. -For 3 ≤ a ≤ 1000, find ∑ rmax. +For $3 ≤ a ≤ 1000$, find $\sum{r}_{max}$. # --hints-- -`euler120()` should return 333082500. +`squareRemainders()` should return `333082500`. ```js -assert.strictEqual(euler120(), 333082500); +assert.strictEqual(squareRemainders(), 333082500); ``` # --seed-- @@ -27,12 +27,12 @@ assert.strictEqual(euler120(), 333082500); ## --seed-contents-- ```js -function euler120() { +function squareRemainders() { return true; } -euler120(); +squareRemainders(); ``` # --solutions-- From b921c74ba64031adaf168258f433d282d56e2b14 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 30 Jun 2021 18:25:59 +0530 Subject: [PATCH 007/344] chore(deps): update dependency mocha to v9 (#42678) Co-authored-by: Renovate Bot --- curriculum/package-lock.json | 66 ++++++++++++++++++++++++++---------- curriculum/package.json | 2 +- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/curriculum/package-lock.json b/curriculum/package-lock.json index ff88d9b534..45ebea088c 100644 --- a/curriculum/package-lock.json +++ b/curriculum/package-lock.json @@ -5326,6 +5326,12 @@ "unc-path-regex": "^0.1.2" } }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true + }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -5598,12 +5604,13 @@ "dev": true }, "log-symbols": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", - "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, "requires": { - "chalk": "^4.0.0" + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" }, "dependencies": { "ansi-styles": { @@ -5835,9 +5842,9 @@ } }, "mocha": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.4.0.tgz", - "integrity": "sha512-hJaO0mwDXmZS4ghXsvPVriOhsxQ7ofcpQdm8dE+jISUOKopitvnXFQmpRR7jd2K6VBG6E26gU3IAbXXGIbu4sQ==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.0.1.tgz", + "integrity": "sha512-9zwsavlRO+5csZu6iRtl3GHImAbhERoDsZwdRkdJ/bE+eVplmoxNKE901ZJ9LdSchYBjSCPbjKc5XvcAri2ylw==", "dev": true, "requires": { "@ungap/promise-all-settled": "1.1.2", @@ -5848,20 +5855,20 @@ "diff": "5.0.0", "escape-string-regexp": "4.0.0", "find-up": "5.0.0", - "glob": "7.1.6", + "glob": "7.1.7", "growl": "1.10.5", "he": "1.2.0", - "js-yaml": "4.0.0", - "log-symbols": "4.0.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", "minimatch": "3.0.4", "ms": "2.1.3", - "nanoid": "3.1.20", + "nanoid": "3.1.23", "serialize-javascript": "5.0.1", "strip-json-comments": "3.1.1", "supports-color": "8.1.1", "which": "2.0.2", "wide-align": "1.1.3", - "workerpool": "6.1.0", + "workerpool": "6.1.4", "yargs": "16.2.0", "yargs-parser": "20.2.4", "yargs-unparser": "2.0.0" @@ -5993,6 +6000,20 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, + "glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, "glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -6029,6 +6050,15 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, "locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -6226,9 +6256,9 @@ "optional": true }, "nanoid": { - "version": "3.1.20", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", - "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", + "version": "3.1.23", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", + "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", "dev": true }, "nanomatch": { @@ -8475,9 +8505,9 @@ "dev": true }, "workerpool": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz", - "integrity": "sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==", + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.4.tgz", + "integrity": "sha512-jGWPzsUqzkow8HoAvqaPWTUPCrlPJaJ5tY8Iz7n1uCz3tTp6s3CDG0FF1NsX42WNlkRSW6Mr+CDZGnNoSsKa7g==", "dev": true }, "wrap-ansi": { diff --git a/curriculum/package.json b/curriculum/package.json index 64ef885813..606e49d406 100644 --- a/curriculum/package.json +++ b/curriculum/package.json @@ -54,7 +54,7 @@ "jsdom": "16.6.0", "live-server": "1.2.1", "lodash": "4.17.21", - "mocha": "8.4.0", + "mocha": "9.0.1", "mock-require": "3.0.3", "puppeteer": "10.1.0", "readdirp": "3.6.0", From 0ccc02b15bcf291b04fe4bd6b5325da4b069148c Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 30 Jun 2021 13:10:46 +0000 Subject: [PATCH 008/344] chore(deps): update storybook monorepo to v6.3.2 --- tools/ui-components/package-lock.json | 602 +++++++++++--------------- tools/ui-components/package.json | 8 +- 2 files changed, 264 insertions(+), 346 deletions(-) diff --git a/tools/ui-components/package-lock.json b/tools/ui-components/package-lock.json index 3baa1bbff8..2d1b261f63 100644 --- a/tools/ui-components/package-lock.json +++ b/tools/ui-components/package-lock.json @@ -5078,17 +5078,17 @@ } }, "@storybook/addon-actions": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/addon-actions/-/addon-actions-6.3.1.tgz", - "integrity": "sha512-85gJI6Rl9Ig236pAD3e/315VN3htD8YJEBL8b6EI6Npi6ga4vtjvXPKh7wsXW6QI6am5msN/lhnHDSlJWWAvGg==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/addon-actions/-/addon-actions-6.3.2.tgz", + "integrity": "sha512-kGengy5+RrBFjRaBmtlblltLaS4GtQEDnXV3g3Geeg9+PYSVKOvh2AgdPdQrjHSJFzpOBwUr3zMhXhdWrizyiQ==", "dev": true, "requires": { - "@storybook/addons": "6.3.1", - "@storybook/api": "6.3.1", - "@storybook/client-api": "6.3.1", - "@storybook/components": "6.3.1", - "@storybook/core-events": "6.3.1", - "@storybook/theming": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/api": "6.3.2", + "@storybook/client-api": "6.3.2", + "@storybook/components": "6.3.2", + "@storybook/core-events": "6.3.2", + "@storybook/theming": "6.3.2", "core-js": "^3.8.2", "fast-deep-equal": "^3.1.3", "global": "^4.4.0", @@ -5103,17 +5103,17 @@ } }, "@storybook/addon-backgrounds": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/addon-backgrounds/-/addon-backgrounds-6.3.1.tgz", - "integrity": "sha512-bgH2yX5Uc2T0CXu+X9/x67gFjYgyn3OHvJ0CmmUOwT/Up3guGqsv4AiAaDoC+MFiBDw/UP8cRtXPgNUVA4vAaA==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/addon-backgrounds/-/addon-backgrounds-6.3.2.tgz", + "integrity": "sha512-phn9kx/rmw6fD3Xqew31YPrAEQqUernQthKghSMgqNTR13ZMQ3NPzmcWOsnRq+ngqxB4XTSFya/BtgV7Od0XQQ==", "dev": true, "requires": { - "@storybook/addons": "6.3.1", - "@storybook/api": "6.3.1", - "@storybook/client-logger": "6.3.1", - "@storybook/components": "6.3.1", - "@storybook/core-events": "6.3.1", - "@storybook/theming": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/api": "6.3.2", + "@storybook/client-logger": "6.3.2", + "@storybook/components": "6.3.2", + "@storybook/core-events": "6.3.2", + "@storybook/theming": "6.3.2", "core-js": "^3.8.2", "global": "^4.4.0", "memoizerific": "^1.11.3", @@ -5123,25 +5123,25 @@ } }, "@storybook/addon-controls": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/addon-controls/-/addon-controls-6.3.1.tgz", - "integrity": "sha512-mrE+EqKGQ8E93C6KI4E1jLnzpzK9LfnTumhRfrI99L23Q74W7otAA+Qc3PQQqc9bCSN0Ma6NPacDzwANo2HDIg==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/addon-controls/-/addon-controls-6.3.2.tgz", + "integrity": "sha512-GJzggGZVKNr1p3s/1u83JgstHEQg5+H/1LoJELiYSIrhcs+mfsRr2ULpfHRTrpUSaC3qTL7HzYkPy+FoAd+6qQ==", "dev": true, "requires": { - "@storybook/addons": "6.3.1", - "@storybook/api": "6.3.1", - "@storybook/client-api": "6.3.1", - "@storybook/components": "6.3.1", - "@storybook/node-logger": "6.3.1", - "@storybook/theming": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/api": "6.3.2", + "@storybook/client-api": "6.3.2", + "@storybook/components": "6.3.2", + "@storybook/node-logger": "6.3.2", + "@storybook/theming": "6.3.2", "core-js": "^3.8.2", "ts-dedent": "^2.0.0" }, "dependencies": { "@storybook/node-logger": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.1.tgz", - "integrity": "sha512-1nyevS5a/B5zoYfMYFh98ll7mWTjHOLy8YZIfF6TEg3F4IIZDu3R0NoRMuXW3qCPmhVrHA1Rts0G5jzi157IUw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.2.tgz", + "integrity": "sha512-TJvJpysIIP3EWoyfFDmXCRC/yTReu0jIFUPdldh4FjhADjQU+JTbLwJmtcJyHoMSqfIHgUc1TB6D/B4PjYqElA==", "dev": true, "requires": { "@types/npmlog": "^4.1.2", @@ -5203,9 +5203,9 @@ } }, "@storybook/addon-docs": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/addon-docs/-/addon-docs-6.3.1.tgz", - "integrity": "sha512-JXElpjq7f67deSTXXwkp3NWJ9ybuCHuHOh6muHy8PPoo5h2gfhJRtp/b8+KV8Zj0bTVZL+ihZ0/EHz2D0bIs6w==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/addon-docs/-/addon-docs-6.3.2.tgz", + "integrity": "sha512-y9+umLi22ow3qAivxqkDeCtqzkIhlDIFOA7HH3Wd2yDo96UAzUiGozelCycijtfcyFuzwL8cvoKB6nIiVyuWsw==", "dev": true, "requires": { "@babel/core": "^7.12.10", @@ -5217,20 +5217,20 @@ "@mdx-js/loader": "^1.6.22", "@mdx-js/mdx": "^1.6.22", "@mdx-js/react": "^1.6.22", - "@storybook/addons": "6.3.1", - "@storybook/api": "6.3.1", - "@storybook/builder-webpack4": "6.3.1", - "@storybook/client-api": "6.3.1", - "@storybook/client-logger": "6.3.1", - "@storybook/components": "6.3.1", - "@storybook/core": "6.3.1", - "@storybook/core-events": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/api": "6.3.2", + "@storybook/builder-webpack4": "6.3.2", + "@storybook/client-api": "6.3.2", + "@storybook/client-logger": "6.3.2", + "@storybook/components": "6.3.2", + "@storybook/core": "6.3.2", + "@storybook/core-events": "6.3.2", "@storybook/csf": "0.0.1", - "@storybook/csf-tools": "6.3.1", - "@storybook/node-logger": "6.3.1", - "@storybook/postinstall": "6.3.1", - "@storybook/source-loader": "6.3.1", - "@storybook/theming": "6.3.1", + "@storybook/csf-tools": "6.3.2", + "@storybook/node-logger": "6.3.2", + "@storybook/postinstall": "6.3.2", + "@storybook/source-loader": "6.3.2", + "@storybook/theming": "6.3.2", "acorn": "^7.4.1", "acorn-jsx": "^5.3.1", "acorn-walk": "^7.2.0", @@ -5255,9 +5255,9 @@ }, "dependencies": { "@storybook/node-logger": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.1.tgz", - "integrity": "sha512-1nyevS5a/B5zoYfMYFh98ll7mWTjHOLy8YZIfF6TEg3F4IIZDu3R0NoRMuXW3qCPmhVrHA1Rts0G5jzi157IUw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.2.tgz", + "integrity": "sha512-TJvJpysIIP3EWoyfFDmXCRC/yTReu0jIFUPdldh4FjhADjQU+JTbLwJmtcJyHoMSqfIHgUc1TB6D/B4PjYqElA==", "dev": true, "requires": { "@types/npmlog": "^4.1.2", @@ -5328,31 +5328,31 @@ } }, "@storybook/addon-essentials": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/addon-essentials/-/addon-essentials-6.3.1.tgz", - "integrity": "sha512-p3InmICgqDevdoETir0zv+f3j5pIO2x1LhZOWVdguGxe0oh72m9I3RrfqO43z9jjZLXvw9t47XvwoMDle83Qow==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/addon-essentials/-/addon-essentials-6.3.2.tgz", + "integrity": "sha512-upOMqx/66aAhr262L4oe5JS1wG2W7ZHIKQBgxMDfzrY26KcRRZVCm+omOlLJ2l4b0Gc7iZmUHkfmOhI9SPMNbw==", "dev": true, "requires": { - "@storybook/addon-actions": "6.3.1", - "@storybook/addon-backgrounds": "6.3.1", - "@storybook/addon-controls": "6.3.1", - "@storybook/addon-docs": "6.3.1", - "@storybook/addon-measure": "^1.3.1", - "@storybook/addon-toolbars": "6.3.1", - "@storybook/addon-viewport": "6.3.1", - "@storybook/addons": "6.3.1", - "@storybook/api": "6.3.1", - "@storybook/node-logger": "6.3.1", + "@storybook/addon-actions": "6.3.2", + "@storybook/addon-backgrounds": "6.3.2", + "@storybook/addon-controls": "6.3.2", + "@storybook/addon-docs": "6.3.2", + "@storybook/addon-measure": "^2.0.0", + "@storybook/addon-toolbars": "6.3.2", + "@storybook/addon-viewport": "6.3.2", + "@storybook/addons": "6.3.2", + "@storybook/api": "6.3.2", + "@storybook/node-logger": "6.3.2", "core-js": "^3.8.2", "regenerator-runtime": "^0.13.7", - "storybook-addon-outline": "^1.4.0", + "storybook-addon-outline": "^1.4.1", "ts-dedent": "^2.0.0" }, "dependencies": { "@storybook/node-logger": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.1.tgz", - "integrity": "sha512-1nyevS5a/B5zoYfMYFh98ll7mWTjHOLy8YZIfF6TEg3F4IIZDu3R0NoRMuXW3qCPmhVrHA1Rts0G5jzi157IUw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.2.tgz", + "integrity": "sha512-TJvJpysIIP3EWoyfFDmXCRC/yTReu0jIFUPdldh4FjhADjQU+JTbLwJmtcJyHoMSqfIHgUc1TB6D/B4PjYqElA==", "dev": true, "requires": { "@types/npmlog": "^4.1.2", @@ -5414,16 +5414,16 @@ } }, "@storybook/addon-links": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/addon-links/-/addon-links-6.3.1.tgz", - "integrity": "sha512-zB8KVHSy+Ka4S87r36PMBKXZ7ZEC4td1OD2IFbdAXuhOnlR1OaRmoAhwJAsK3rjhS4uJvvtVj4CD3XTJ9qXEIw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/addon-links/-/addon-links-6.3.2.tgz", + "integrity": "sha512-JT7HLIZRvUJ0dDkhz4daL/GdpS/JPhuRaKPonRbtLW6RFAbBjLolqALVfxRJzOsYMwStUMtnxzzgKmeLOjtPIA==", "dev": true, "requires": { - "@storybook/addons": "6.3.1", - "@storybook/client-logger": "6.3.1", - "@storybook/core-events": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/client-logger": "6.3.2", + "@storybook/core-events": "6.3.2", "@storybook/csf": "0.0.1", - "@storybook/router": "6.3.1", + "@storybook/router": "6.3.2", "@types/qs": "^6.9.5", "core-js": "^3.8.2", "global": "^4.4.0", @@ -5434,9 +5434,9 @@ } }, "@storybook/addon-measure": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@storybook/addon-measure/-/addon-measure-1.3.1.tgz", - "integrity": "sha512-OTTbVOs/85zP5MzAMAAs/IyS3MNegSMvvGOzBRsX/7GBxhtjkrryamDkVr9py3JqPwRSndwwB7y0ZwWmf/9KJw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@storybook/addon-measure/-/addon-measure-2.0.0.tgz", + "integrity": "sha512-ZhdT++cX+L9LwjhGYggvYUUVQH/MGn2rwbrAwCMzA/f2QTFvkjxzX8nDgMxIhaLCDC+gHIxfJG2wrWN0jkBr3g==", "dev": true }, "@storybook/addon-postcss": { @@ -5481,32 +5481,32 @@ } }, "@storybook/addon-toolbars": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/addon-toolbars/-/addon-toolbars-6.3.1.tgz", - "integrity": "sha512-2ENfirboVOzpj970JBqCa/PoeWEsc2KCZLeCABRH0fBvR29/3//YSZVOfPw470qjBYyBKtWvBLJQm/IhTdfzXQ==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/addon-toolbars/-/addon-toolbars-6.3.2.tgz", + "integrity": "sha512-Gc2nak1MaCbC5h67TSXIvg65llidHngGHQCE2Ru6cPnTFqAtLs2QdsA72ScAOSLmwSeliVxkcoOXL9wN1vlXsg==", "dev": true, "requires": { - "@storybook/addons": "6.3.1", - "@storybook/api": "6.3.1", - "@storybook/client-api": "6.3.1", - "@storybook/components": "6.3.1", - "@storybook/theming": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/api": "6.3.2", + "@storybook/client-api": "6.3.2", + "@storybook/components": "6.3.2", + "@storybook/theming": "6.3.2", "core-js": "^3.8.2", "regenerator-runtime": "^0.13.7" } }, "@storybook/addon-viewport": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/addon-viewport/-/addon-viewport-6.3.1.tgz", - "integrity": "sha512-qrEFkfyoR4jnMRvzGt/n81AkaIDABxrguiGON5SKkXKnZ1DvpxeLjqkskrsVzCsMFKdiX8Cvv2SDB/bbKXbmqQ==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/addon-viewport/-/addon-viewport-6.3.2.tgz", + "integrity": "sha512-npmD2kpXyc7zPFgxOu2JBg8U702P4c2B+OvFa53jQJIKyUdjXNzGatG2FSshQmY+UpiDJyKScPJ7W/9oU7HAfw==", "dev": true, "requires": { - "@storybook/addons": "6.3.1", - "@storybook/api": "6.3.1", - "@storybook/client-logger": "6.3.1", - "@storybook/components": "6.3.1", - "@storybook/core-events": "6.3.1", - "@storybook/theming": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/api": "6.3.2", + "@storybook/client-logger": "6.3.2", + "@storybook/components": "6.3.2", + "@storybook/core-events": "6.3.2", + "@storybook/theming": "6.3.2", "core-js": "^3.8.2", "global": "^4.4.0", "memoizerific": "^1.11.3", @@ -5515,36 +5515,36 @@ } }, "@storybook/addons": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/addons/-/addons-6.3.1.tgz", - "integrity": "sha512-wDDqhd/jOXo752LQmNFdWlQOdzk/ZcsnOELXUpGY8QWzS9uasR1rZzCR78sFzsUTRyyMDAeiVHmKUlD2n4EL0g==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/addons/-/addons-6.3.2.tgz", + "integrity": "sha512-fzpTLKyweD0yPXnfjaOrLpKRm4AVHdGRmfJb1p6KyUTXoNRWGYHsXN3EvAdsWjTamhbL2JoQy38kvu7SmkTEug==", "dev": true, "requires": { - "@storybook/api": "6.3.1", - "@storybook/channels": "6.3.1", - "@storybook/client-logger": "6.3.1", - "@storybook/core-events": "6.3.1", - "@storybook/router": "6.3.1", - "@storybook/theming": "6.3.1", + "@storybook/api": "6.3.2", + "@storybook/channels": "6.3.2", + "@storybook/client-logger": "6.3.2", + "@storybook/core-events": "6.3.2", + "@storybook/router": "6.3.2", + "@storybook/theming": "6.3.2", "core-js": "^3.8.2", "global": "^4.4.0", "regenerator-runtime": "^0.13.7" } }, "@storybook/api": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/api/-/api-6.3.1.tgz", - "integrity": "sha512-70T9xaKWMP9xE4zOLLQiqmmWbsYk3nAFfwSnCu8oGb2Iq5bwfGDnm///n1/84OkObYv4OzVoRbIyLD+Xsx1Fnw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/api/-/api-6.3.2.tgz", + "integrity": "sha512-rXe7l8mwNEvk3cqHYJ4H2XQWWY8oeezJezgt1ZBq4GvNVzVUPjASi1meXQwAYm39SdCL5+lP/hLpAZvobB1Tag==", "dev": true, "requires": { "@reach/router": "^1.3.4", - "@storybook/channels": "6.3.1", - "@storybook/client-logger": "6.3.1", - "@storybook/core-events": "6.3.1", + "@storybook/channels": "6.3.2", + "@storybook/client-logger": "6.3.2", + "@storybook/core-events": "6.3.2", "@storybook/csf": "0.0.1", - "@storybook/router": "6.3.1", + "@storybook/router": "6.3.2", "@storybook/semver": "^7.3.2", - "@storybook/theming": "6.3.1", + "@storybook/theming": "6.3.2", "@types/reach__router": "^1.3.7", "core-js": "^3.8.2", "fast-deep-equal": "^3.1.3", @@ -5560,9 +5560,9 @@ } }, "@storybook/builder-webpack4": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/builder-webpack4/-/builder-webpack4-6.3.1.tgz", - "integrity": "sha512-G0McjY59svyarwCTaS1T2O00s4iFollm/85z62IrM5+HcshJLkMZ4gNcgo3EiHpYkiAvBIJXAHXlDxkf8E9V0w==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/builder-webpack4/-/builder-webpack4-6.3.2.tgz", + "integrity": "sha512-0xKMy/9Zp+Z1EK9R2Oq4kmd2Za9OlzXoLNBHdGuwe3lqoCsXvEQHsrGdc7V5uT4HwP1KBEhn9Yl+Y7yuMDZJ0Q==", "dev": true, "requires": { "@babel/core": "^7.12.10", @@ -5586,20 +5586,20 @@ "@babel/preset-env": "^7.12.11", "@babel/preset-react": "^7.12.10", "@babel/preset-typescript": "^7.12.7", - "@storybook/addons": "6.3.1", - "@storybook/api": "6.3.1", - "@storybook/channel-postmessage": "6.3.1", - "@storybook/channels": "6.3.1", - "@storybook/client-api": "6.3.1", - "@storybook/client-logger": "6.3.1", - "@storybook/components": "6.3.1", - "@storybook/core-common": "6.3.1", - "@storybook/core-events": "6.3.1", - "@storybook/node-logger": "6.3.1", - "@storybook/router": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/api": "6.3.2", + "@storybook/channel-postmessage": "6.3.2", + "@storybook/channels": "6.3.2", + "@storybook/client-api": "6.3.2", + "@storybook/client-logger": "6.3.2", + "@storybook/components": "6.3.2", + "@storybook/core-common": "6.3.2", + "@storybook/core-events": "6.3.2", + "@storybook/node-logger": "6.3.2", + "@storybook/router": "6.3.2", "@storybook/semver": "^7.3.2", - "@storybook/theming": "6.3.1", - "@storybook/ui": "6.3.1", + "@storybook/theming": "6.3.2", + "@storybook/ui": "6.3.2", "@types/node": "^14.0.10", "@types/webpack": "^4.41.26", "autoprefixer": "^9.8.6", @@ -5654,9 +5654,9 @@ } }, "@storybook/node-logger": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.1.tgz", - "integrity": "sha512-1nyevS5a/B5zoYfMYFh98ll7mWTjHOLy8YZIfF6TEg3F4IIZDu3R0NoRMuXW3qCPmhVrHA1Rts0G5jzi157IUw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.2.tgz", + "integrity": "sha512-TJvJpysIIP3EWoyfFDmXCRC/yTReu0jIFUPdldh4FjhADjQU+JTbLwJmtcJyHoMSqfIHgUc1TB6D/B4PjYqElA==", "dev": true, "requires": { "@types/npmlog": "^4.1.2", @@ -5866,14 +5866,14 @@ } }, "@storybook/channel-postmessage": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/channel-postmessage/-/channel-postmessage-6.3.1.tgz", - "integrity": "sha512-6+luEe2H/84ZYCfcNgH5WCYtUbSIJiMjKFsV17iRVLECRxX8PtxxH5zB3kzhpAngp9WwKDEAS0T1+lEZoHh2Yw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/channel-postmessage/-/channel-postmessage-6.3.2.tgz", + "integrity": "sha512-6ne51RmZ7Ye9TDhPy/y5NuyQGNJ6VJcEch5E8D0nrFfNwJ5djKzkg1xatADjdhlCfQ9zPfseQVPM5IovEzEb/A==", "dev": true, "requires": { - "@storybook/channels": "6.3.1", - "@storybook/client-logger": "6.3.1", - "@storybook/core-events": "6.3.1", + "@storybook/channels": "6.3.2", + "@storybook/client-logger": "6.3.2", + "@storybook/core-events": "6.3.2", "core-js": "^3.8.2", "global": "^4.4.0", "qs": "^6.10.0", @@ -5881,9 +5881,9 @@ } }, "@storybook/channels": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-6.3.1.tgz", - "integrity": "sha512-mMOQmXylE9yTHNp2uOdEg70Wb5KsPxV5mEHcYzYE54UM8HsYzeFu5UwG/CSA7FAkCHgCZfNiCW0LhikRN4bNbQ==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-6.3.2.tgz", + "integrity": "sha512-fkyX0vn7KkN7p515Knm4Cfo8Z2xyO9hMPK4IReZiGz8o9vOziXHeYvdFZ07aTfcUb9ZG3ur3C7rmaEDMNfwCWA==", "dev": true, "requires": { "core-js": "^3.8.2", @@ -5892,16 +5892,16 @@ } }, "@storybook/client-api": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/client-api/-/client-api-6.3.1.tgz", - "integrity": "sha512-LZrJ5zUT88n2VIf4c+3IkWXWmBzpz5DMc9ly2KOPywzgAPkTOwRzaNY6lg2ozMhN262N5meRAST86kYRYG3DKw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/client-api/-/client-api-6.3.2.tgz", + "integrity": "sha512-vYPTaROdmBtzKckGAbZAi8gpD2OgDB0FlsjTTe7rz8jcN1ecGRBBXlb/CJndLlAKgZqF+sramtIY3GZp0wdpPA==", "dev": true, "requires": { - "@storybook/addons": "6.3.1", - "@storybook/channel-postmessage": "6.3.1", - "@storybook/channels": "6.3.1", - "@storybook/client-logger": "6.3.1", - "@storybook/core-events": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/channel-postmessage": "6.3.2", + "@storybook/channels": "6.3.2", + "@storybook/client-logger": "6.3.2", + "@storybook/core-events": "6.3.2", "@storybook/csf": "0.0.1", "@types/qs": "^6.9.5", "@types/webpack-env": "^1.16.0", @@ -5918,9 +5918,9 @@ } }, "@storybook/client-logger": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-6.3.1.tgz", - "integrity": "sha512-S43DOYVHyb7KXx+UZh/3Rl5NroG+sTkE+JAu7/DWUQ3B1H1rPacOcZUiclfxrh7uaCtJXmYVsa1ud3UEEnzxtA==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-6.3.2.tgz", + "integrity": "sha512-1V70P4ARRHSvkAUZP/mgU3hUl7BN9kpNujbBNRcVCCv+DgsnryF+CH9xJ8nxrpOZxlj4sIG68OcMqRaV1HL/3w==", "dev": true, "requires": { "core-js": "^3.8.2", @@ -5928,15 +5928,15 @@ } }, "@storybook/components": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/components/-/components-6.3.1.tgz", - "integrity": "sha512-sCNalGXSMzVCoElRUYKS+EuIJQr5zNbPepFVzZWXGj2cKd7z6LtHNyEN/3eTnR7Ivdpaf43IZc9pIBmBvSmIFQ==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/components/-/components-6.3.2.tgz", + "integrity": "sha512-lwzqY7CLbo+4PxBiN9DMwtMRPG1jN9Ih6SAdB4fJdCj3bZQ7ef9peme70RvpDEIOD3MX6vu/9AKQj2wxAaHrDA==", "dev": true, "requires": { "@popperjs/core": "^2.6.0", - "@storybook/client-logger": "6.3.1", + "@storybook/client-logger": "6.3.2", "@storybook/csf": "0.0.1", - "@storybook/theming": "6.3.1", + "@storybook/theming": "6.3.2", "@types/color-convert": "^2.0.0", "@types/overlayscrollbars": "^1.12.0", "@types/react-syntax-highlighter": "11.0.5", @@ -5977,28 +5977,28 @@ } }, "@storybook/core": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/core/-/core-6.3.1.tgz", - "integrity": "sha512-H1CMPwiFJlJNEKqQ9+PxNCiUcuwzRKCE3Ecg29d9KoW0r8lnfHRsW4XUL8JavFAWvlg5CBjMOc/E7obmStsOIA==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/core/-/core-6.3.2.tgz", + "integrity": "sha512-EPyGqTu2f2184FfZ7o1IMWbVKWkdhbIeLSnNfl5CA5ZVMFQwV8XhEJXpzWI0VopZK0hE0+ooU4M+if8JeSWulQ==", "dev": true, "requires": { - "@storybook/core-client": "6.3.1", - "@storybook/core-server": "6.3.1" + "@storybook/core-client": "6.3.2", + "@storybook/core-server": "6.3.2" } }, "@storybook/core-client": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/core-client/-/core-client-6.3.1.tgz", - "integrity": "sha512-CQWSMhmxqNYS10zvyaCYbwgaznKr30kus1Ri/wEjf5NTvX8+6vj3oo9fx2ZlVHwmKrXcFVMDp5+zJEZ6PtoLNg==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/core-client/-/core-client-6.3.2.tgz", + "integrity": "sha512-A354DrsBQgtfKRSNVM0WpepNZwZfb8QxBKB86LR5crfbLIAs9fxJnYmAVBF1ju1EasrIxX6kGDryH4pQYaJPXw==", "dev": true, "requires": { - "@storybook/addons": "6.3.1", - "@storybook/channel-postmessage": "6.3.1", - "@storybook/client-api": "6.3.1", - "@storybook/client-logger": "6.3.1", - "@storybook/core-events": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/channel-postmessage": "6.3.2", + "@storybook/client-api": "6.3.2", + "@storybook/client-logger": "6.3.2", + "@storybook/core-events": "6.3.2", "@storybook/csf": "0.0.1", - "@storybook/ui": "6.3.1", + "@storybook/ui": "6.3.2", "airbnb-js-shims": "^2.2.1", "ansi-to-html": "^0.6.11", "core-js": "^3.8.2", @@ -6012,9 +6012,9 @@ } }, "@storybook/core-common": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/core-common/-/core-common-6.3.1.tgz", - "integrity": "sha512-c0ZvZo52SwzL3xI+C7ux+wCpq0uDIXiau4S9LoeKHjRUc1vFyrQKgkQ0UeKXk43DhhlpVYdxw88ZyFHkeNCaEg==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/core-common/-/core-common-6.3.2.tgz", + "integrity": "sha512-draeHXXWTn1u3YzLMZdtCOy1UOXsPBQz6q5f64o8Qjkr8Htqf2IiFYPmswOq7eo9yPQZu7+nsfRcx7M1GNAQlg==", "dev": true, "requires": { "@babel/core": "^7.12.10", @@ -6038,7 +6038,7 @@ "@babel/preset-react": "^7.12.10", "@babel/preset-typescript": "^7.12.7", "@babel/register": "^7.12.1", - "@storybook/node-logger": "6.3.1", + "@storybook/node-logger": "6.3.2", "@storybook/semver": "^7.3.2", "@types/glob-base": "^0.3.0", "@types/micromatch": "^4.0.1", @@ -6084,9 +6084,9 @@ } }, "@storybook/node-logger": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.1.tgz", - "integrity": "sha512-1nyevS5a/B5zoYfMYFh98ll7mWTjHOLy8YZIfF6TEg3F4IIZDu3R0NoRMuXW3qCPmhVrHA1Rts0G5jzi157IUw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.2.tgz", + "integrity": "sha512-TJvJpysIIP3EWoyfFDmXCRC/yTReu0jIFUPdldh4FjhADjQU+JTbLwJmtcJyHoMSqfIHgUc1TB6D/B4PjYqElA==", "dev": true, "requires": { "@types/npmlog": "^4.1.2", @@ -6281,26 +6281,26 @@ } }, "@storybook/core-events": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-6.3.1.tgz", - "integrity": "sha512-W+0eRG955kd0HlD+8gGNeXogEnxEugfjDr9g316vawYlz9qnPoBxad8LoLPys5RawboK+1erOEfI2owGqDiKHw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-6.3.2.tgz", + "integrity": "sha512-Mqxp2au4djPC9j8Wc97oM1iJQLAS8ZsW8CqcPxDmhl38cMfcMQiQXTk+2GDQbMxD2An2b73EU5hMMBAvNzYjog==", "dev": true, "requires": { "core-js": "^3.8.2" } }, "@storybook/core-server": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/core-server/-/core-server-6.3.1.tgz", - "integrity": "sha512-MlDGjo3DFUMTva6d+T7YuQRqZ2YxziiEdQAH9Na3TRuuhNoIrl6g04y7ys0W3MjYaoKjVXQMYBKYXayot939Cw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/core-server/-/core-server-6.3.2.tgz", + "integrity": "sha512-ceBKdLYlhKygBOJyIWR+9i4bLVOOadsLxM9ITAIzaSqSfZiuFxoP+irnEZrZUfFA0zcLYFEW5MH2vtCCPH+fhg==", "dev": true, "requires": { - "@storybook/builder-webpack4": "6.3.1", - "@storybook/core-client": "6.3.1", - "@storybook/core-common": "6.3.1", - "@storybook/csf-tools": "6.3.1", - "@storybook/manager-webpack4": "6.3.1", - "@storybook/node-logger": "6.3.1", + "@storybook/builder-webpack4": "6.3.2", + "@storybook/core-client": "6.3.2", + "@storybook/core-common": "6.3.2", + "@storybook/csf-tools": "6.3.2", + "@storybook/manager-webpack4": "6.3.2", + "@storybook/node-logger": "6.3.2", "@storybook/semver": "^7.3.2", "@types/node": "^14.0.10", "@types/node-fetch": "^2.5.7", @@ -6331,9 +6331,9 @@ }, "dependencies": { "@storybook/node-logger": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.1.tgz", - "integrity": "sha512-1nyevS5a/B5zoYfMYFh98ll7mWTjHOLy8YZIfF6TEg3F4IIZDu3R0NoRMuXW3qCPmhVrHA1Rts0G5jzi157IUw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.2.tgz", + "integrity": "sha512-TJvJpysIIP3EWoyfFDmXCRC/yTReu0jIFUPdldh4FjhADjQU+JTbLwJmtcJyHoMSqfIHgUc1TB6D/B4PjYqElA==", "dev": true, "requires": { "@types/npmlog": "^4.1.2", @@ -6455,9 +6455,9 @@ } }, "@storybook/csf-tools": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/csf-tools/-/csf-tools-6.3.1.tgz", - "integrity": "sha512-lq/8XnWQ9OBWwbag8Nk3tSSRDaGd4lBhXDV32L0xC0e8NH3ZRddiEYavi6H9nUpE4ZEdJ+1ITL2+jwfIZF79wQ==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/csf-tools/-/csf-tools-6.3.2.tgz", + "integrity": "sha512-CGj4HsKwYBwp2zWmrG1RJedwrnakfxkptp/4HQ0mE9ajw28GndNZus2+IgnBsxdbzv8LYwz/rHpXRbvfDbgPFg==", "dev": true, "requires": { "@babel/generator": "^7.12.11", @@ -6477,20 +6477,20 @@ } }, "@storybook/manager-webpack4": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/manager-webpack4/-/manager-webpack4-6.3.1.tgz", - "integrity": "sha512-KMFSp2gWdGhIH4sKPeJNcju9w3nfyhCBtNv9bugLoUapv7eAix6zwk2x91SeswhBQT6NBPUusNtT5CpkgEcDAw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/manager-webpack4/-/manager-webpack4-6.3.2.tgz", + "integrity": "sha512-MeYXK2H65y08meKM477PT0ygMMiHYGo9e8vl8oIXY3pp/24iiE5W+yCHH3HP5PEsKCXMml6gWM7ba44lpkuutQ==", "dev": true, "requires": { "@babel/core": "^7.12.10", "@babel/plugin-transform-template-literals": "^7.12.1", "@babel/preset-react": "^7.12.10", - "@storybook/addons": "6.3.1", - "@storybook/core-client": "6.3.1", - "@storybook/core-common": "6.3.1", - "@storybook/node-logger": "6.3.1", - "@storybook/theming": "6.3.1", - "@storybook/ui": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/core-client": "6.3.2", + "@storybook/core-common": "6.3.2", + "@storybook/node-logger": "6.3.2", + "@storybook/theming": "6.3.2", + "@storybook/ui": "6.3.2", "@types/node": "^14.0.10", "@types/webpack": "^4.41.26", "babel-loader": "^8.2.2", @@ -6522,9 +6522,9 @@ }, "dependencies": { "@storybook/node-logger": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.1.tgz", - "integrity": "sha512-1nyevS5a/B5zoYfMYFh98ll7mWTjHOLy8YZIfF6TEg3F4IIZDu3R0NoRMuXW3qCPmhVrHA1Rts0G5jzi157IUw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.2.tgz", + "integrity": "sha512-TJvJpysIIP3EWoyfFDmXCRC/yTReu0jIFUPdldh4FjhADjQU+JTbLwJmtcJyHoMSqfIHgUc1TB6D/B4PjYqElA==", "dev": true, "requires": { "@types/npmlog": "^4.1.2", @@ -6693,28 +6693,28 @@ } }, "@storybook/postinstall": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/postinstall/-/postinstall-6.3.1.tgz", - "integrity": "sha512-xmDYJ7dcdc5zKNOvPbtIVgde5bM+advFzOFdstU1NRPojfGK8J6/RbJ1QD07fNb3eD6p2S8rTlXZ0wBvOlrP9g==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/postinstall/-/postinstall-6.3.2.tgz", + "integrity": "sha512-RkzrEr5GyBKFEPwOJw6JFRqkCtexvqZbyQeDuQ8K5AxRoJOcdXfxtb2Qkq06wfUnexxhZ9R0ktzepdtzk89ALw==", "dev": true, "requires": { "core-js": "^3.8.2" } }, "@storybook/react": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/react/-/react-6.3.1.tgz", - "integrity": "sha512-P3neN04YWpIyJ0kLq5UWo390wwM9HG6hVOJUi1uw9lMFbZoy/oVM77ot+77Mtfq3S58Rv51iohFF9DAkxPFNzA==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/react/-/react-6.3.2.tgz", + "integrity": "sha512-AwuXzvu6zKSZnWFgYWxvP1QumnJ/8VChZJ1/pCEW3IGqxtSBd7KAF7EjlmS6CqAnWP+zp9jUr7It1P9631CwNQ==", "dev": true, "requires": { "@babel/preset-flow": "^7.12.1", "@babel/preset-react": "^7.12.10", "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3", - "@storybook/addons": "6.3.1", - "@storybook/core": "6.3.1", - "@storybook/core-common": "6.3.1", - "@storybook/node-logger": "6.3.1", - "@storybook/react-docgen-typescript-plugin": "1.0.2-canary.3c70e01.0", + "@storybook/addons": "6.3.2", + "@storybook/core": "6.3.2", + "@storybook/core-common": "6.3.2", + "@storybook/node-logger": "6.3.2", + "@storybook/react-docgen-typescript-plugin": "1.0.2-canary.253f8c1.0", "@storybook/semver": "^7.3.2", "@types/webpack-env": "^1.16.0", "babel-plugin-add-react-displayname": "^0.0.5", @@ -6733,9 +6733,9 @@ }, "dependencies": { "@storybook/node-logger": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.1.tgz", - "integrity": "sha512-1nyevS5a/B5zoYfMYFh98ll7mWTjHOLy8YZIfF6TEg3F4IIZDu3R0NoRMuXW3qCPmhVrHA1Rts0G5jzi157IUw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-6.3.2.tgz", + "integrity": "sha512-TJvJpysIIP3EWoyfFDmXCRC/yTReu0jIFUPdldh4FjhADjQU+JTbLwJmtcJyHoMSqfIHgUc1TB6D/B4PjYqElA==", "dev": true, "requires": { "@types/npmlog": "^4.1.2", @@ -6797,9 +6797,9 @@ } }, "@storybook/react-docgen-typescript-plugin": { - "version": "1.0.2-canary.3c70e01.0", - "resolved": "https://registry.npmjs.org/@storybook/react-docgen-typescript-plugin/-/react-docgen-typescript-plugin-1.0.2-canary.3c70e01.0.tgz", - "integrity": "sha512-go1LO+iM6qLGhgqvEoEpw339/kf2YBX86aG2JewWwlHCO0YyyYdlsdZd3KkB5MVtudyK7mtrcNDq0k/EIaB2JA==", + "version": "1.0.2-canary.253f8c1.0", + "resolved": "https://registry.npmjs.org/@storybook/react-docgen-typescript-plugin/-/react-docgen-typescript-plugin-1.0.2-canary.253f8c1.0.tgz", + "integrity": "sha512-mmoRG/rNzAiTbh+vGP8d57dfcR2aP+5/Ll03KKFyfy5FqWFm/Gh7u27ikx1I3LmVMI8n6jh5SdWMkMKon7/tDw==", "dev": true, "requires": { "debug": "^4.1.1", @@ -6843,13 +6843,13 @@ } }, "@storybook/router": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/router/-/router-6.3.1.tgz", - "integrity": "sha512-7YZlXdkWTttvK5OvqCjP8V8KdYx3FfTG0aKIo0koTsq1O09pPvM8aoNUZ0bNeEq9yE+1CLPiickaBtA9A29q2Q==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/router/-/router-6.3.2.tgz", + "integrity": "sha512-2oe2w1h4ucKhVub2NjKqwvJ6E6b57rA0fr8EOElPXdQXDi2fD3hFjUIXL4OdWG+GMVEqfkoje0eRCDRdjbu+yg==", "dev": true, "requires": { "@reach/router": "^1.3.4", - "@storybook/client-logger": "6.3.1", + "@storybook/client-logger": "6.3.2", "@types/reach__router": "^1.3.7", "core-js": "^3.8.2", "fast-deep-equal": "^3.1.3", @@ -6871,13 +6871,13 @@ } }, "@storybook/source-loader": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/source-loader/-/source-loader-6.3.1.tgz", - "integrity": "sha512-eYB8UoUV235B/Fq2Ydg7sZ1/nntDQxB3UihmDEHfXo2qhwVt2qokR74MbTQdMIA+iDXHTFNMHicMj49Wb4FpAw==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/source-loader/-/source-loader-6.3.2.tgz", + "integrity": "sha512-tg8VDBoVRrazDdvFJBtAp0ChztaF3cxmXsbWCOxYkP8u4sYDXBikJCllSGzkuSx6GUuU0kyQ0JV94Bd2ECTdOw==", "dev": true, "requires": { - "@storybook/addons": "6.3.1", - "@storybook/client-logger": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/client-logger": "6.3.2", "@storybook/csf": "0.0.1", "core-js": "^3.8.2", "estraverse": "^5.2.0", @@ -6897,15 +6897,15 @@ } }, "@storybook/theming": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/theming/-/theming-6.3.1.tgz", - "integrity": "sha512-YDXv7QFMqfl/S2TVlvvUzO0CtNPbA/Pf1uHb9aUxcmUPvh/uZsuTXvahWqaRDF4hv+NjxEPPXK6ofd0fBTKEjQ==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/theming/-/theming-6.3.2.tgz", + "integrity": "sha512-XICs67cuEGQxnzJ2SYPRZiIELaUCFQsYhtBTXycJIpBUbcbysdBE7GH+3aG8PpDMaSgHWJ7qaiYEoPlhFbAv1w==", "dev": true, "requires": { "@emotion/core": "^10.1.1", "@emotion/is-prop-valid": "^0.8.6", "@emotion/styled": "^10.0.27", - "@storybook/client-logger": "6.3.1", + "@storybook/client-logger": "6.3.2", "core-js": "^3.8.2", "deep-object-diff": "^1.1.0", "emotion-theming": "^10.0.27", @@ -6917,21 +6917,21 @@ } }, "@storybook/ui": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@storybook/ui/-/ui-6.3.1.tgz", - "integrity": "sha512-ax5fIM9wDRmthNtKjlozmakC5T8ansH5yeJHP8PnBazDu4Fcxuz563r455K9U303HaXceITIw41KvhHfa1BmaA==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@storybook/ui/-/ui-6.3.2.tgz", + "integrity": "sha512-Aqzr5vQsr67iDwg41CmHr/NlcNayld8PPGWqtxJ/+/fSScnKZ8KdwGoqpj64dizowoggpCCeYVZCanHhxS47Vg==", "dev": true, "requires": { "@emotion/core": "^10.1.1", - "@storybook/addons": "6.3.1", - "@storybook/api": "6.3.1", - "@storybook/channels": "6.3.1", - "@storybook/client-logger": "6.3.1", - "@storybook/components": "6.3.1", - "@storybook/core-events": "6.3.1", - "@storybook/router": "6.3.1", + "@storybook/addons": "6.3.2", + "@storybook/api": "6.3.2", + "@storybook/channels": "6.3.2", + "@storybook/client-logger": "6.3.2", + "@storybook/components": "6.3.2", + "@storybook/core-events": "6.3.2", + "@storybook/router": "6.3.2", "@storybook/semver": "^7.3.2", - "@storybook/theming": "6.3.1", + "@storybook/theming": "6.3.2", "@types/markdown-to-jsx": "^6.11.3", "copy-to-clipboard": "^3.3.1", "core-js": "^3.8.2", @@ -8372,16 +8372,6 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -9156,18 +9146,6 @@ } } }, - "clipboard": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.8.tgz", - "integrity": "sha512-Y6WO0unAIQp5bLmk1zdThRhgJt/x3ks6f30s3oE3H1mgIEU33XyQjEf8gsf6DxC7NPX8Y1SsNWjUjL/ywLnnbQ==", - "dev": true, - "optional": true, - "requires": { - "good-listener": "^1.2.2", - "select": "^1.1.2", - "tiny-emitter": "^2.0.0" - } - }, "cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -9533,9 +9511,9 @@ "dev": true }, "core-js-compat": { - "version": "3.15.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.15.1.tgz", - "integrity": "sha512-xGhzYMX6y7oEGQGAJmP2TmtBLvR4nZmRGEcFa3ubHOq5YEp51gGN9AovVa0AoujGZIq+Wm6dISiYyGNfdflYww==", + "version": "3.15.2", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.15.2.tgz", + "integrity": "sha512-Wp+BJVvwopjI+A1EFqm2dwUmWYXrvucmtIB2LgXn/Rb+gWPKYxtmb4GKHGKG/KGF1eK9jfjzT38DITbTOCX/SQ==", "dev": true, "requires": { "browserslist": "^4.16.6", @@ -9551,9 +9529,9 @@ } }, "core-js-pure": { - "version": "3.11.1", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.11.1.tgz", - "integrity": "sha512-2JukQi8HgAOCD5CSimxWWXVrUBoA9Br796uIA5Z06bIjt7PBBI19ircFaAxplgE1mJf3x2BY6MkT/HWA/UryPg==", + "version": "3.15.2", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.15.2.tgz", + "integrity": "sha512-D42L7RYh1J2grW8ttxoY1+17Y4wXZeKe7uyplAI3FkNQyI5OgBIAjUfFiTPfL1rs0qLpxaabITNbjKl1Sp82tA==", "dev": true }, "core-util-is": { @@ -10504,13 +10482,6 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, - "delegate": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz", - "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==", - "dev": true, - "optional": true - }, "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -11523,13 +11494,6 @@ } } }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true - }, "filesize": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.1.0.tgz", @@ -12255,16 +12219,6 @@ "slash": "^3.0.0" } }, - "good-listener": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz", - "integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=", - "dev": true, - "optional": true, - "requires": { - "delegate": "^3.1.2" - } - }, "graceful-fs": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", @@ -14220,13 +14174,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "nan": { - "version": "2.14.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", - "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", - "dev": true, - "optional": true - }, "nanoid": { "version": "3.1.23", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", @@ -17506,25 +17453,14 @@ } }, "refractor": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/refractor/-/refractor-3.3.1.tgz", - "integrity": "sha512-vaN6R56kLMuBszHSWlwTpcZ8KTMG6aUCok4GrxYDT20UIOXxOc5o6oDc8tNTzSlH3m2sI+Eu9Jo2kVdDcUTWYw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/refractor/-/refractor-3.4.0.tgz", + "integrity": "sha512-dBeD02lC5eytm9Gld2Mx0cMcnR+zhSnsTfPpWqFaMgUMJfC9A6bcN3Br/NaXrnBJcuxnLFR90k1jrkaSyV8umg==", "dev": true, "requires": { "hastscript": "^6.0.0", "parse-entities": "^2.0.0", - "prismjs": "~1.23.0" - }, - "dependencies": { - "prismjs": { - "version": "1.23.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.23.0.tgz", - "integrity": "sha512-c29LVsqOaLbBHuIbsTxaKENh1N2EQBOHaWv7gkHN4dgRbxSREqDnDbtFJYdpPauS4YCplMSNCABQ6Eeor69bAA==", - "dev": true, - "requires": { - "clipboard": "^2.0.0" - } - } + "prismjs": "~1.24.0" } }, "regenerate": { @@ -18257,13 +18193,6 @@ "ajv-keywords": "^3.5.2" } }, - "select": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", - "integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=", - "dev": true, - "optional": true - }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", @@ -19506,9 +19435,9 @@ } }, "terser": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.7.0.tgz", - "integrity": "sha512-HP5/9hp2UaZt5fYkuhNBR8YyRcT8juw8+uFbAme53iN9hblvKnLUTKkmwJG6ocWpIKf8UK4DoeWG4ty0J6S6/g==", + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.7.1.tgz", + "integrity": "sha512-b3e+d5JbHAe/JSjwsC3Zn55wsBIM7AsHLjKxT31kGCldgbpFePaFo+PiddtO6uwRZWRw7sPXmAN8dTW61xmnSg==", "dev": true, "requires": { "commander": "^2.20.0", @@ -19574,13 +19503,6 @@ "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=", "dev": true }, - "tiny-emitter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", - "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==", - "dev": true, - "optional": true - }, "tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", @@ -20391,11 +20313,7 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - } + "optional": true }, "glob-parent": { "version": "3.1.0", diff --git a/tools/ui-components/package.json b/tools/ui-components/package.json index 74ae250b26..1fd5cafe1e 100644 --- a/tools/ui-components/package.json +++ b/tools/ui-components/package.json @@ -28,11 +28,11 @@ "@rollup/plugin-babel": "5.3.0", "@rollup/plugin-commonjs": "19.0.0", "@rollup/plugin-node-resolve": "13.0.0", - "@storybook/addon-actions": "6.3.1", - "@storybook/addon-essentials": "6.3.1", - "@storybook/addon-links": "6.3.1", + "@storybook/addon-actions": "6.3.2", + "@storybook/addon-essentials": "6.3.2", + "@storybook/addon-links": "6.3.2", "@storybook/addon-postcss": "2.0.0", - "@storybook/react": "6.3.1", + "@storybook/react": "6.3.2", "@testing-library/react": "12.0.0", "autoprefixer": "10.2.6", "babel-loader": "8.2.2", From 2e346b1082e0d91c0db6f0a425564d997db16078 Mon Sep 17 00:00:00 2001 From: camperbot Date: Wed, 30 Jun 2021 20:47:19 +0530 Subject: [PATCH 009/344] chore(i18n,curriculum): update translations (#42684) --- .../use-the-u-tag-to-underline-text.md | 4 +-- ...g-strings-with-the-plus-equals-operator.md | 4 +-- .../use-the-conditional-ternary-operator.md | 2 +- ...t-default-parameters-for-your-functions.md | 2 +- ...ap-method-to-extract-data-from-an-array.md | 2 +- .../palindrome-checker.md | 2 +- ...haracters-that-occur-zero-or-more-times.md | 4 +-- .../react/render-conditionally-from-props.md | 2 +- .../use-the-u-tag-to-underline-text.md | 4 +-- ...g-strings-with-the-plus-equals-operator.md | 4 +-- .../use-the-conditional-ternary-operator.md | 2 +- ...t-default-parameters-for-your-functions.md | 2 +- ...ap-method-to-extract-data-from-an-array.md | 2 +- .../palindrome-checker.md | 2 +- ...haracters-that-occur-zero-or-more-times.md | 4 +-- .../react/render-conditionally-from-props.md | 2 +- .../use-the-u-tag-to-underline-text.md | 4 +-- ...ap-method-to-extract-data-from-an-array.md | 2 +- ...haracters-that-occur-zero-or-more-times.md | 4 +-- ...ap-method-to-extract-data-from-an-array.md | 2 +- .../search-and-replace.md | 2 +- ...haracters-that-occur-zero-or-more-times.md | 4 +-- .../react/render-conditionally-from-props.md | 2 +- .../use--for-a-more-concise-conditional.md | 2 +- .../add-a-hover-effect-to-a-d3-element.md | 10 +++---- .../access-the-json-data-from-an-api.md | 26 +++++++++---------- .../change-text-with-click-events.md | 12 ++++----- .../convert-json-data-to-html.md | 24 ++++++++--------- ...on-data-to-find-a-users-gps-coordinates.md | 24 ++++++++--------- 29 files changed, 81 insertions(+), 81 deletions(-) diff --git a/curriculum/challenges/chinese-traditional/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md b/curriculum/challenges/chinese-traditional/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md index fe935b6852..c2b9f69460 100644 --- a/curriculum/challenges/chinese-traditional/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md +++ b/curriculum/challenges/chinese-traditional/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md @@ -13,7 +13,7 @@ dashedName: use-the-u-tag-to-underline-text # --instructions-- -`u` 標籤包裹的文本內容應爲 `Ph.D. students`。 +給文本 `Ph.D. students` 添加 `u` 標籤。 **注意:** 如果使用 `u` 標籤添加下劃線,可能混淆文本和鏈接,則應避免使用它。 錨標籤也有默認的下劃線格式。 @@ -25,7 +25,7 @@ dashedName: use-the-u-tag-to-underline-text assert($('u').length === 1); ``` -`u` 標籤的文本內容應爲 `Ph.D. students`。 +`u` 標籤的內容文本應爲 `Ph.D. students`。 ```js assert($('u').text() === 'Ph.D. students'); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index 6435e028a8..6dbbe18f7a 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -20,7 +20,7 @@ var ourStr = "I come first. "; ourStr += "I come second."; ``` -`ourStr` 現在內容爲字符串 `I come first. I come second.` +`ourStr` 的值爲字符串 `I come first. I come second.` # --instructions-- @@ -28,7 +28,7 @@ ourStr += "I come second."; # --hints-- -`myStr` 的值應該是 `This is the first sentence. This is the second sentence.` +`myStr` 的值應該是字符串 `This is the first sentence. This is the second sentence.` ```js assert(myStr === 'This is the first sentence. This is the second sentence.'); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index f21c47bfed..cfbc2d661f 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -10,7 +10,7 @@ dashedName: use-the-conditional-ternary-operator 條件運算符( conditional operator,)(也稱爲三元運算符( ternary operator))的就像寫成一行的 if-else 表達式 -語法是 `a ? b: c`,其中 `a` 是條件,`b` 是條件返回 `true` 時要運行的代碼,`c` 是條件返回 `false` 時要運行的代碼。 +語法是:`a ? b : c`, where `a` 是條件,當條件返回 `true` 的時候運行代碼 `b`,當條件返回 `false` 的時候運行代碼 `c`。 以下函數使用 `if/else` 語句來檢查條件: diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index e02bc73736..52502e247c 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -25,7 +25,7 @@ console.log(greeting()); # --instructions-- -給函數 `increment` 加上默認參數,使得在 `value` 沒有被賦值的時候,默認給 `number` 加上 1。 +給函數 `increment` 傳入默認參數,使得在 `value` 沒有被賦值的時候,默認給 `number` 加上 1。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 0ad1d55612..0c36d08a20 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -37,7 +37,7 @@ console.log(names); # --instructions-- -`watchList` 數組保存了包含一些電影信息的對象。 使用 `map` 從 `watchList` 中提取標題(`title`)和評分(`rating`),並將新數組保存在 `ratings` 變量裏。 目前編輯器中的代碼是使用 `for` 循環實現,使用 `map` 表達式替換循環功能。 +`watchList` 數組保存了包含一些電影信息的對象。 在 `watchList` 上使用 `map`,將一個新的對象數組賦值給 `ratings` 變量。 新數組中的每個電影都只能有一個值爲電影名稱的 `title` 鍵,和一個值爲 IMDB 評級的 `rating` 鍵。 目前編輯器中的代碼是使用 `for` 循環實現,你應該使用 `map` 表達式替換循環功能。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md index fc5a19b8e7..75fbd433a3 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md @@ -50,7 +50,7 @@ assert(palindrome('race car') === true); assert(palindrome('not a palindrome') === false); ``` -`palindrome("A man, a plan, a canal. Panama")` 應返回 `true`。 +`palindrome("A man, a plan, a canal. Panama")` 應該返回 `true`。 ```js assert(palindrome('A man, a plan, a canal. Panama') === true); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md index 55842b0cb5..cfeeccf21a 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md @@ -54,7 +54,7 @@ assert(result[0] === 'Aaaaaaaaaaaaaaaa'); assert(result[0].length === 16); ``` -你的正則表達式不應該有任何匹配,在字符 `He made a fair move. Screaming about it can't help you.` +你的正則表達式不應該匹配字符串 `He made a fair move. Screaming about it can't help you.` 中的任何字符。 ```js assert( @@ -62,7 +62,7 @@ assert( ); ``` -你的正則表達式不應該有任何匹配,在字符 `Let him have it. It's not wise to upset a Wookiee.` +你的正則表達式不應該匹配字符串 `Let him have it. It's not wise to upset a Wookiee.` 中的任何字符。 ```js assert( diff --git a/curriculum/challenges/chinese-traditional/03-front-end-libraries/react/render-conditionally-from-props.md b/curriculum/challenges/chinese-traditional/03-front-end-libraries/react/render-conditionally-from-props.md index 2afa16d83a..5ae10a6372 100644 --- a/curriculum/challenges/chinese-traditional/03-front-end-libraries/react/render-conditionally-from-props.md +++ b/curriculum/challenges/chinese-traditional/03-front-end-libraries/react/render-conditionally-from-props.md @@ -8,7 +8,7 @@ dashedName: render-conditionally-from-props # --description-- -到目前爲止,已經看到了如何使用 `if/else`、`&&`和三元運算符(`condition ? expressionIfTrue : expressionIfFalse`)對渲染什麼和何時渲染做出有條件的判定。 然而,還有一個重要的話題需要討論,將這些概念中的任何一個或所有概念與另一個強大的 React 功能結合起來:props。 使用 props 有條件地渲染代碼在 React 開發人員中很常見 -- 也就是說:他們使用給定 prop 的值來自動決定渲染什麼。 +到目前爲止,你已經看到如何使用 `if/else`、`&&` 以及三元運算符(`condition ? expressionIfTrue : expressionIfFalse`)在不同條件下運行不同的代碼。 然而,還有一個重要的話題需要討論,將這些概念中的任何一個或所有概念與另一個強大的 React 功能 props 結合起來。 使用 props 有條件地渲染代碼在 React 開發人員中很常見——也就是說:他們使用給定 prop 的值來自動決定渲染什麼。 在這個挑戰中,將設置一個子組件來根據 props 做出渲染決定。 可以使用三元運算符,但是可以看到過去幾個挑戰中涵蓋的其他幾個概念在這種情況下可能同樣有用。 diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md index 35e8401994..3e1360b387 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md @@ -13,7 +13,7 @@ dashedName: use-the-u-tag-to-underline-text # --instructions-- -`u` 标签包裹的文本内容应为 `Ph.D. students`。 +给文本 `Ph.D. students` 添加 `u` 标签。 **注意:** 如果使用 `u` 标签添加下划线,可能混淆文本和链接,则应避免使用它。 锚标签也有默认的下划线格式。 @@ -25,7 +25,7 @@ dashedName: use-the-u-tag-to-underline-text assert($('u').length === 1); ``` -`u` 标签的文本内容应为 `Ph.D. students`。 +`u` 标签的内容文本应为 `Ph.D. students`。 ```js assert($('u').text() === 'Ph.D. students'); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index f570dcc435..bed5941a94 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -20,7 +20,7 @@ var ourStr = "I come first. "; ourStr += "I come second."; ``` -`ourStr` 现在内容为字符串 `I come first. I come second.` +`ourStr` 的值为字符串 `I come first. I come second.` # --instructions-- @@ -28,7 +28,7 @@ ourStr += "I come second."; # --hints-- -`myStr` 的值应该是 `This is the first sentence. This is the second sentence.` +`myStr` 的值应该是字符串 `This is the first sentence. This is the second sentence.` ```js assert(myStr === 'This is the first sentence. This is the second sentence.'); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index eedbb0fc48..fe7bc08602 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -10,7 +10,7 @@ dashedName: use-the-conditional-ternary-operator 条件运算符( conditional operator,)(也称为三元运算符( ternary operator))的就像写成一行的 if-else 表达式 -语法是 `a ? b: c`,其中 `a` 是条件,`b` 是条件返回 `true` 时要运行的代码,`c` 是条件返回 `false` 时要运行的代码。 +语法是:`a ? b : c`, where `a` 是条件,当条件返回 `true` 的时候运行代码 `b`,当条件返回 `false` 的时候运行代码 `c`。 以下函数使用 `if/else` 语句来检查条件: diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index 753d97b180..078cfc8341 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -25,7 +25,7 @@ console.log(greeting()); # --instructions-- -给函数 `increment` 加上默认参数,使得在 `value` 没有被赋值的时候,默认给 `number` 加上 1。 +给函数 `increment` 传入默认参数,使得在 `value` 没有被赋值的时候,默认给 `number` 加上 1。 # --hints-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 2e512ac302..d4ae65a8ee 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -37,7 +37,7 @@ console.log(names); # --instructions-- -`watchList` 数组保存了包含一些电影信息的对象。 使用 `map` 从 `watchList` 中提取标题(`title`)和评分(`rating`),并将新数组保存在 `ratings` 变量里。 目前编辑器中的代码是使用 `for` 循环实现,使用 `map` 表达式替换循环功能。 +`watchList` 数组保存了包含一些电影信息的对象。 在 `watchList` 上使用 `map`,将一个新的对象数组赋值给 `ratings` 变量。 新数组中的每个电影都只能有一个值为电影名称的 `title` 键,和一个值为 IMDB 评级的 `rating` 键。 目前编辑器中的代码是使用 `for` 循环实现,你应该使用 `map` 表达式替换循环功能。 # --hints-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md index bac2fbf13c..5443a90f4b 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md @@ -50,7 +50,7 @@ assert(palindrome('race car') === true); assert(palindrome('not a palindrome') === false); ``` -`palindrome("A man, a plan, a canal. Panama")` 应返回 `true`。 +`palindrome("A man, a plan, a canal. Panama")` 应该返回 `true`。 ```js assert(palindrome('A man, a plan, a canal. Panama') === true); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md index 08199ee77e..d89ca8de61 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md @@ -54,7 +54,7 @@ assert(result[0] === 'Aaaaaaaaaaaaaaaa'); assert(result[0].length === 16); ``` -你的正则表达式不应该有任何匹配,在字符 `He made a fair move. Screaming about it can't help you.` +你的正则表达式不应该匹配字符串 `He made a fair move. Screaming about it can't help you.` 中的任何字符。 ```js assert( @@ -62,7 +62,7 @@ assert( ); ``` -你的正则表达式不应该有任何匹配,在字符 `Let him have it. It's not wise to upset a Wookiee.` +你的正则表达式不应该匹配字符串 `Let him have it. It's not wise to upset a Wookiee.` 中的任何字符。 ```js assert( diff --git a/curriculum/challenges/chinese/03-front-end-libraries/react/render-conditionally-from-props.md b/curriculum/challenges/chinese/03-front-end-libraries/react/render-conditionally-from-props.md index 28cc87511d..bcd87fcf88 100644 --- a/curriculum/challenges/chinese/03-front-end-libraries/react/render-conditionally-from-props.md +++ b/curriculum/challenges/chinese/03-front-end-libraries/react/render-conditionally-from-props.md @@ -8,7 +8,7 @@ dashedName: render-conditionally-from-props # --description-- -到目前为止,已经看到了如何使用 `if/else`、`&&`和三元运算符(`condition ? expressionIfTrue : expressionIfFalse`)对渲染什么和何时渲染做出有条件的判定。 然而,还有一个重要的话题需要讨论,将这些概念中的任何一个或所有概念与另一个强大的 React 功能结合起来:props。 使用 props 有条件地渲染代码在 React 开发人员中很常见 -- 也就是说:他们使用给定 prop 的值来自动决定渲染什么。 +到目前为止,你已经看到如何使用 `if/else`、`&&` 以及三元运算符(`condition ? expressionIfTrue : expressionIfFalse`)在不同条件下运行不同的代码。 然而,还有一个重要的话题需要讨论,将这些概念中的任何一个或所有概念与另一个强大的 React 功能 props 结合起来。 使用 props 有条件地渲染代码在 React 开发人员中很常见——也就是说:他们使用给定 prop 的值来自动决定渲染什么。 在这个挑战中,将设置一个子组件来根据 props 做出渲染决定。 可以使用三元运算符,但是可以看到过去几个挑战中涵盖的其他几个概念在这种情况下可能同样有用。 diff --git a/curriculum/challenges/espanol/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md b/curriculum/challenges/espanol/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md index 744030e235..18817c8008 100644 --- a/curriculum/challenges/espanol/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md +++ b/curriculum/challenges/espanol/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md @@ -13,7 +13,7 @@ Para subrayar texto, puedes usar la etiqueta `u`. Esto se utiliza a menudo para # --instructions-- -Envuelve la etiqueta `u` solo alrededor del texto `Ph.D. students `. +Envuelve la etiqueta `u` solo alrededor del texto `Ph.D. students`. **Nota:** Trata de evitar el uso de la etiqueta `u`, puesto que podría confundirse con un enlace. Las etiquetas de enlaces tienen un formato subrayado por defecto. @@ -25,7 +25,7 @@ Tu código debe agregar una etiqueta `u` al lenguaje de marcado. assert($('u').length === 1); ``` -Envuelve la etiqueta `u` solo alrededor del texto `Ph.D. students` . +La etiqueta `u` debe envolver alrededor del texto `Ph.D. students`. ```js assert($('u').text() === 'Ph.D. students'); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 1b0c9a5508..d587f42847 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -37,7 +37,7 @@ La consola mostraría el valor `[ 'John', 'Amy', 'camperCat' ]`. # --instructions-- -El arreglo `watchList` contiene objetos con información sobre varias películas. Usa `map` en `watchList` para asignar un nuevo arreglo de objetos con solo `title` y `rating` claves a la variable `ratings`. El código en el editor utiliza actualmente un bucle `for` para hacer esto, por lo que debería reemplazar la funcionalidad del bucle con su expresión `map`. +El arreglo `watchList` contiene objetos con información sobre varias películas. Usa `map` en `watchList` para asignar un nuevo arreglo de objetos a la variable `ratings`. Cada película en el nuevo arreglo debe tener solo una tecla `title` con el nombre de la película, y una tecla `rating` con la calificación IMDB. El código en el editor utiliza actualmente un bucle `for` para hacer esto, por lo que debes reemplazar la funcionalidad del bucle con tu expresión `map`. # --hints-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md index 5a2a7dc7c7..b80d07aac2 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md @@ -54,7 +54,7 @@ Tu expresión regular `chewieRegex` debe coincidir con 16 caracteres en `chewieQ assert(result[0].length === 16); ``` -Tu expresión regular no debe coincidir con ningún carácter con la cadena `He made a fair move. Screaming about it can't help you.` +Tu regex no debe coincidir con ningún carácter en la cadena `He made a fair move. Screaming about it can't help you.` ```js assert( @@ -62,7 +62,7 @@ assert( ); ``` -Tu expresión regular no debe coincidir con ningún carácter con la cadena `Let him have it. It's not wise to upset a Wookiee.` +Tu regex no debe coincidir con ningún carácter en la cadena `Let him have it. It's not wise to upset a Wookiee.` ```js assert( diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 77c0cb7e9d..4560004153 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -37,7 +37,7 @@ La console visualizzerà il valore `[ 'John', 'Amy', 'camperCat' ]`. # --instructions-- -L'array `watchList` contiene oggetti con informazioni su diversi film. Usa `map` su `watchList` per assegnare un nuovo array di oggetti con le sole chiavi `title` e `rating` alla variabile `ratings`. Il codice nell'editor al momento utilizza un ciclo `for` per farlo, quindi dovresti sostituire il ciclo con la tua espressione `map`. +L'array `watchList` contiene oggetti con informazioni su diversi film. Usa `map` su `watchList` per assegnare un nuovo array di oggetti alla variabile `ratings`. Ogni film nel nuovo array dovrebbe avere una key `title` con il nome del fil, e una key `rating` con il voto da IMDB. Il codice nell'editor al momento utilizza un ciclo `for` per farlo, quindi dovresti sostituire il ciclo con la tua espressione `map`. # --hints-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace.md index d9ef5fceff..35c3330861 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace.md @@ -47,7 +47,7 @@ assert.deepEqual( ); ``` -`myReplace("This has a spellngi error", "spellngi", "spelling")` should return the string `This has a spelling error`. +`myReplace("This has a spellngi error", "spellngi", "spelling")` dovrebbe restituire `This has a spelling error`. ```js assert.deepEqual( diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md index 6d7ed9e20a..bd55a9c407 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.md @@ -54,7 +54,7 @@ La tua espressione regolare `chewieRegex` dovrebbe riconoscere 16 caratteri in ` assert(result[0].length === 16); ``` -La tua espressione regolare non dovrebbe riconoscere nessun carattere nella stringa `He made a fair move. Screaming about it can't help you.` +Il tuo regex non dovrebbe trovare nessun carattere nella stringa `He made a fair move. Screaming about it can't help you.` ```js assert( @@ -62,7 +62,7 @@ assert( ); ``` -La tua espressione regolare non dovrebbe riconoscere nessun carattere nella stringa `Let him have it. It's not wise to upset a Wookiee.` +Il tuo regex non dovrebbe corrispondere a nessun carattere nella stringa `Let him have it. It's not wise to upset a Wookiee.` ```js assert( diff --git a/curriculum/challenges/italian/03-front-end-libraries/react/render-conditionally-from-props.md b/curriculum/challenges/italian/03-front-end-libraries/react/render-conditionally-from-props.md index 2d30baa034..da6aaa7193 100644 --- a/curriculum/challenges/italian/03-front-end-libraries/react/render-conditionally-from-props.md +++ b/curriculum/challenges/italian/03-front-end-libraries/react/render-conditionally-from-props.md @@ -8,7 +8,7 @@ dashedName: render-conditionally-from-props # --description-- -Finora, hai visto come usare `if/else`, `&&`, e l'operatore ternario (`condition ? expressionIfTrue : expressionIfFalse`) per prendere decisioni condizionali su cosa presentare e quando. Tuttavia, c'è ancora un argomento importante da discutere che consente di combinare uno o tutti questi concetti con un'altra potente funzionalità di React: le props. Usare le proprietà (props) per presentare il codice condizionalmente è molto comune tra gli sviluppatori di React — cioè essi usano il valore di una determinata proprietà per prendere automaticamente delle decisioni su cosa presentare. +Fino ad ora hai visto come usare `if/else`, `&&`, e l'operatore ternario (`condition ? expressionIfTrue : expressionIfFalse`) per fare decisioni condizionali su cosa e quando presentare. Tuttavia, c'è ancora un argomento importante da discutere che consente di combinare uno o tutti questi concetti con un'altra potente funzionalità di React: le props. Usare le proprietà (props) per presentare il codice condizionalmente è molto comune tra gli sviluppatori di React — cioè essi usano il valore di una determinata proprietà per prendere automaticamente delle decisioni su cosa presentare. In questa sfida, configurerai un componente figlio per prendere decisioni di rendering basate sulle props. Utilizzerai anche l'operatore ternario, ma puoi vedere come molti degli altri concetti che sono stati trattati nelle ultime sfide potrebbero essere altrettanto utili in questo contesto. diff --git a/curriculum/challenges/italian/03-front-end-libraries/react/use--for-a-more-concise-conditional.md b/curriculum/challenges/italian/03-front-end-libraries/react/use--for-a-more-concise-conditional.md index 9f939453d3..03123b23b7 100644 --- a/curriculum/challenges/italian/03-front-end-libraries/react/use--for-a-more-concise-conditional.md +++ b/curriculum/challenges/italian/03-front-end-libraries/react/use--for-a-more-concise-conditional.md @@ -1,6 +1,6 @@ --- id: 5a24c314108439a4d4036185 -title: Use && for a More Concise Conditional +title: Usare && per un condizionale più conciso challengeType: 6 forumTopicId: 301413 dashedName: use--for-a-more-concise-conditional diff --git a/curriculum/challenges/italian/04-data-visualization/data-visualization-with-d3/add-a-hover-effect-to-a-d3-element.md b/curriculum/challenges/italian/04-data-visualization/data-visualization-with-d3/add-a-hover-effect-to-a-d3-element.md index beb4f34992..e9d4cf8cc1 100644 --- a/curriculum/challenges/italian/04-data-visualization/data-visualization-with-d3/add-a-hover-effect-to-a-d3-element.md +++ b/curriculum/challenges/italian/04-data-visualization/data-visualization-with-d3/add-a-hover-effect-to-a-d3-element.md @@ -1,6 +1,6 @@ --- id: 587d7faa367417b2b2512bd4 -title: Add a Hover Effect to a D3 Element +title: Aggiungere un effetto hover a un elemento D3 challengeType: 6 forumTopicId: 301469 dashedName: add-a-hover-effect-to-a-d3-element @@ -8,17 +8,17 @@ dashedName: add-a-hover-effect-to-a-d3-element # --description-- -It's possible to add effects that highlight a bar when the user hovers over it with the mouse. So far, the styling for the rectangles is applied with the built-in D3 and SVG methods, but you can use CSS as well. +È possibile aggiungere effetti che evidenziano una barra quando l'utente le passa sopra con il mouse. Finora, lo stile per i rettangoli viene applicato con i metodi D3 e SVG integrati, ma è possibile utilizzare anche CSS. -You set the CSS class on the SVG elements with the `attr()` method. Then the `:hover` pseudo-class for your new class holds the style rules for any hover effects. +Hai impostato la classe CSS sugli elementi SVG con il metodo `attr()`. Quindi la pseudo-classe `:hover` per la tua nuova classe contiene le regole di stile per qualsiasi effetto hover. # --instructions-- -Use the `attr()` method to add a class of `bar` to all the `rect` elements. This changes the `fill` color of the bar to brown when you mouse over it. +Usa il metodo `attr()` per aggiungere una classe `bar` a tutti gli elementi `rect`. Questo cambia il colore di riempimento (`fill`) della barra in marrone quando le si passa sopra con il mouse. # --hints-- -Your `rect` elements should have a class of `bar`. +I tuoi elementi `rect` dovrebbero essere di classe `bar`. ```js assert($('rect').attr('class').trim().split(/\s+/g).includes('bar')); diff --git a/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/access-the-json-data-from-an-api.md b/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/access-the-json-data-from-an-api.md index 50b0ee7a2f..69d8f89b9a 100644 --- a/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/access-the-json-data-from-an-api.md +++ b/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/access-the-json-data-from-an-api.md @@ -1,6 +1,6 @@ --- id: 587d7fae367417b2b2512be4 -title: Access the JSON Data from an API +title: Accedere ai dati JSON da un'API challengeType: 6 forumTopicId: 301499 dashedName: access-the-json-data-from-an-api @@ -8,37 +8,37 @@ dashedName: access-the-json-data-from-an-api # --description-- -In the previous challenge, you saw how to get JSON data from the freeCodeCamp Cat Photo API. +Nella sfida precedente, hai visto come ottenere i dati JSON dall'API Cat Photo di freeCodeCamp. -Now you'll take a closer look at the returned data to better understand the JSON format. Recall some notation in JavaScript: +Ora daremo un'occhiata più da vicino ai dati restituiti per comprendere meglio il formato JSON. Ricorda alcune notazioni in JavaScript: -
[ ] -> Square brackets represent an array
{ } -> Curly brackets represent an object
" " -> Double quotes represent a string. They are also used for key names in JSON
+
[ ] -> Le parentesi quadre rappresentano un array
{ } -> Le parentesi graffe rappresentano un oggetto
" " -> Le virgolette doppie rappresentano una stringa. Vengono utilizzati anche per i nomi delle chiavi in JSON
-Understanding the structure of the data that an API returns is important because it influences how you retrieve the values you need. +Capire la struttura dei dati che un'API restituisce è importante perché influisce su come recuperare i valori di cui hai bisogno. -On the right, click the `Get Message` button to load the freeCodeCamp Cat Photo API JSON into the HTML. +Sulla destra, fai click sul pulsante `Get Message` per caricare il JSON dell'API Cat Photo di freeCodeCamp nell'HTML. -The first and last character you see in the JSON data are square brackets `[ ]`. This means that the returned data is an array. The second character in the JSON data is a curly `{` bracket, which starts an object. Looking closely, you can see that there are three separate objects. The JSON data is an array of three objects, where each object contains information about a cat photo. +Il primo e l'ultimo carattere che vedi nei dati JSON sono parentesi quadre `[ ]`. Ciò significa che i dati restituiti sono un array. Il secondo carattere dei dati JSON è una parentesi graffa `{`, che dà inizio a un oggetto. Guardando da vicino, si può vedere che ci sono tre oggetti separati. I dati JSON sono una serie di tre oggetti, in cui ogni oggetto contiene informazioni su una foto di un gatto. -You learned earlier that objects contain "key-value pairs" that are separated by commas. In the Cat Photo example, the first object has `"id":0` where `id` is a key and `0` is its corresponding value. Similarly, there are keys for `imageLink`, `altText`, and `codeNames`. Each cat photo object has these same keys, but with different values. +Hai imparato in precedenza che gli oggetti contengono "coppie chiave-valore" separate da virgole. Nell'esempio della Cat Photo, il primo oggetto ha `"id":0` dove `id` è una chiave e `0` è il suo valore corrispondente. Allo stesso modo, ci sono chiavi per `imageLink`, `altText` e `codeNames`. Ogni oggetto relativo alla foto di un gatto ha queste stesse chiavi, ma con valori diversi. -Another interesting "key-value pair" in the first object is `"codeNames":["Juggernaut","Mrs. Wallace","ButterCup"]`. Here `codeNames` is the key and its value is an array of three strings. It's possible to have arrays of objects as well as a key with an array as a value. +Un'altra interessante "coppia chiave-valore" nel primo oggetto è `"codeNames":["Juggernaut","Mrs. Wallace","ButterCup"]`. Qui `codeNames` è la chiave e il suo valore è un array di tre stringhe. È possibile avere array di oggetti, così come una chiave con un array come valore. -Remember how to access data in arrays and objects. Arrays use bracket notation to access a specific index of an item. Objects use either bracket or dot notation to access the value of a given property. Here's an example that prints the `altText` property of the first cat photo - note that the parsed JSON data in the editor is saved in a variable called `json`: +Ricorda come accedere ai dati in array e oggetti. Gli array utilizzano la notazione tra parentesi per accedere a un indice specifico di un elemento. Gli oggetti utilizzano la notazione tra parentesi o con il punto per accedere al valore di una data proprietà. Ecco un esempio che stampa la proprietà `altText` della prima foto di gatto - nota che i dati JSON analizzati nell'editor sono salvati in una variabile chiamata `json`: ```js console.log(json[0].altText); ``` -The console would display the string `A white cat wearing a green helmet shaped melon on its head.`. +La console mostrerà la stringa `A white cat wearing a green helmet shaped melon on its head.`. # --instructions-- -For the cat with the `id` of 2, print to the console the second value in the `codeNames` array. You should use bracket and dot notation on the object (which is saved in the variable `json`) to access the value. +Per il gatto con l'`id` di 2, stampa sulla console il secondo valore nell'array `codeNames`. Per accedere al valore dovresti usare sull'oggetto la notazione tra parentesi e con il punto (che viene salvata nella variabile `json`). # --hints-- -Your code should use bracket and dot notation to access the proper code name, and print `Loki` to the console. +Il tuo codice dovrebbe utilizzare la notazione tra parentesi e con il punto per accedere al codeName corretto e stampare `Loki` sulla console. ```js assert( diff --git a/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/change-text-with-click-events.md b/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/change-text-with-click-events.md index 4550322262..c65d773e25 100644 --- a/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/change-text-with-click-events.md +++ b/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/change-text-with-click-events.md @@ -1,6 +1,6 @@ --- id: 587d7fad367417b2b2512be2 -title: Change Text with click Events +title: Cambiare il testo con un evento click challengeType: 6 forumTopicId: 301500 dashedName: change-text-with-click-events @@ -8,11 +8,11 @@ dashedName: change-text-with-click-events # --description-- -When the click event happens, you can use JavaScript to update an HTML element. +Quando l'evento click accade, puoi usare JavaScript per cambiare un elemento HTML. -For example, when a user clicks the `Get Message` button, it changes the text of the element with the class `message` to say `Here is the message`. +Per esempio, quando un utente clicca il pulsante `Get Message`, il testo dell'elemento con classe `message` cambia per dire `Here is the message`. -This works by adding the following code within the click event: +Perché questo accada bisogna aggiungere il seguente codice all'evento click: ```js document.getElementsByClassName('message')[0].textContent="Here is the message"; @@ -20,11 +20,11 @@ document.getElementsByClassName('message')[0].textContent="Here is the message"; # --instructions-- -Add code inside the `onclick` event handler to change the text inside the `message` element to say `Here is the message`. +Aggiungi codice dentro il gestore di eventi `onclick` per cambiare il testo dentro l'elemento `message` per dire `Here is the message`. # --hints-- -Your code should use the `document.getElementsByClassName` method to select the element with class `message` and set its `textContent` to the given string. +Il tuo codice dovrebbe usare il metodo `document.getElementsByClassName` per selezionare l'elemento con classe `message` e cambiare il suo `textContent` alla stringa data. ```js assert( diff --git a/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/convert-json-data-to-html.md b/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/convert-json-data-to-html.md index 8678469f29..8f99e9702c 100644 --- a/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/convert-json-data-to-html.md +++ b/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/convert-json-data-to-html.md @@ -1,6 +1,6 @@ --- id: 587d7fae367417b2b2512be5 -title: Convert JSON Data to HTML +title: Convertire dati JSON ad HTML challengeType: 6 forumTopicId: 16807 dashedName: convert-json-data-to-html @@ -8,15 +8,15 @@ dashedName: convert-json-data-to-html # --description-- -Now that you're getting data from a JSON API, you can display it in the HTML. +Ora che stai ricevendo dati da un'API JSON, puoi mostrarlo nell'HTML. -You can use a `forEach` method to loop through the data since the cat photo objects are held in an array. As you get to each item, you can modify the HTML elements. +Puoi usare un metodo `forEach` per iterare sui dati visto che gli oggetti di foto per gatti sono immagazzinati in un array. Iterando su ogni elemento, puoi modificare gli elementi HTML. -First, declare an html variable with `let html = "";`. +Come prima cosa, dichiara una variabile html con `let html = "";`. -Then, loop through the JSON, adding HTML to the variable that wraps the key names in `strong` tags, followed by the value. When the loop is finished, you render it. +Poi, itera sul JSON, aggiungendo HTML alla variabile con le chiavi degli oggetti racchiuse in tag `strong`, seguite dal valore. Quando il ciclo ha finito, lo presenti. -Here's the code that does this: +Ecco il codice che lo fa: ```js let html = ""; @@ -30,13 +30,13 @@ json.forEach(function(val) { }); ``` -**Note:** For this challenge, you need to add new HTML elements to the page, so you cannot rely on `textContent`. Instead, you need to use `innerHTML`, which can make a site vulnerable to cross-site scripting attacks. +**Nota:** per questa sfida devi aggiungere nuovi elementi HTML alla pagina quindi non puoi usare `textContent`. Invece, devi usare `innerHTML`, il quale può rendere i siti vulnerabili ad attacchi di cross-site scripting. # --instructions-- -Add a `forEach` method to loop over the JSON data and create the HTML elements to display it. +Aggiungi un metodo `forEach` per iterare sui dati JSON e creare gli elementi HTML per mostrarli. -Here is some example JSON: +Ecco alcuni esempi di JSON: ```json [ @@ -52,19 +52,19 @@ Here is some example JSON: # --hints-- -Your code should store the data in the `html` variable +Il tuo codice dovrebbe salvare i dati nella variabile `html` ```js assert(__helpers.removeWhiteSpace(code).match(/html(\+=|=html\+)/g)) ``` -Your code should use a `forEach` method to loop over the JSON data from the API. +Il tuo codice dovrebbe usare un metodo `forEach` per iterare sui dati JSON ricevuti dalla API. ```js assert(code.match(/json\.forEach/g)); ``` -Your code should wrap the key names in `strong` tags. +Il tuo codice dovrebbe racchiudere i nomi delle proprietà in tag `strong`. ```js assert(code.match(/.+<\/strong>/g)); diff --git a/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/get-geolocation-data-to-find-a-users-gps-coordinates.md b/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/get-geolocation-data-to-find-a-users-gps-coordinates.md index bed1c43e98..98709f803e 100644 --- a/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/get-geolocation-data-to-find-a-users-gps-coordinates.md +++ b/curriculum/challenges/italian/04-data-visualization/json-apis-and-ajax/get-geolocation-data-to-find-a-users-gps-coordinates.md @@ -1,6 +1,6 @@ --- id: 587d7faf367417b2b2512be8 -title: Get Geolocation Data to Find A User's GPS Coordinates +title: Ottenere dati di geolocazione per trovare le coordinate GPS di un utente challengeType: 6 forumTopicId: 18188 dashedName: get-geolocation-data-to-find-a-users-gps-coordinates @@ -8,15 +8,15 @@ dashedName: get-geolocation-data-to-find-a-users-gps-coordinates # --description-- -Another cool thing you can do is access your user's current location. Every browser has a built in navigator that can give you this information. +Un'altra cosa speciale che puoi fare è accedere alla posizione attuale del tuo utente. Ogni browser ha integrato un navigatore che può dare questa informazione. -The navigator will get the user's current longitude and latitude. +Il navigatore ottiene la longitudine e latitudine attuali. -You will see a prompt to allow or block this site from knowing your current location. The challenge can be completed either way, as long as the code is correct. +Vedrai un prompt per permettere o negare l'accesso di un sito alla tua posizione. La sfida può essere completata con entrambe le opzioni, se il codice è corretto. -By selecting allow, you will see the text on the output phone change to your latitude and longitude. +Se lo permetti, vedrai il testo del telefono nell'output cambiare con la tua latitudine e longitudine. -Here's code that does this: +Ecco il codice che lo fa: ```js if (navigator.geolocation){ @@ -26,33 +26,33 @@ if (navigator.geolocation){ } ``` -First, it checks if the `navigator.geolocation` object exists. If it does, the `getCurrentPosition` method on that object is called, which initiates an asynchronous request for the user's position. If the request is successful, the callback function in the method runs. This function accesses the `position` object's values for latitude and longitude using dot notation and updates the HTML. +Come prima cosa, controlla che l'oggetto `navigator.geolocation` esista. Se esiste, il metodo `getCurrentPosition` è chiamato su quell'oggetto, iniziando la richiesta asincrona per la posizione dell'utente. Se la richiesta ha successo, la funzione callback nel metodo viene eseguita. La funzione ha accesso ai valori di latitudine e longitutine nell'oggetto `position` usando la notazione a punto, e aggiorna l'HTML. # --instructions-- -Add the example code inside the `script` tags to check a user's current location and insert it into the HTML. +Aggiungi il codice di esempio nel tag `script` per controllare la posizione attuale dell'utente e inserirla nell'HTML. # --hints-- -Your code should use `navigator.geolocation` to access the user's current location. +Il tuo codice dovrebbe usare `navigator.geolocation` per accedere alla posizione attuale dell'utente. ```js assert(code.match(/navigator\.geolocation\.getCurrentPosition/g)); ``` -Your code should use `position.coords.latitude` to display the user's latitudinal location. +Il tuo codice dovrebbe usare `position.coords.latitude` per mostrare la latitudine della posizione dell'utente. ```js assert(code.match(/position\.coords\.latitude/g)); ``` -Your code should use `position.coords.longitude` to display the user's longitudinal location. +Il tuo codice dovrebbe usare `position.coords.longitude` per mostrare la longitudine della posizione dell'utente. ```js assert(code.match(/position\.coords\.longitude/g)); ``` -You should display the user's position within the `div` element with `id="data"`. +Dovresti mostrare la posizione dell'utente all'interno dell'elemento `div` con `id="data"`. ```js assert( From 2c3cd39c8de8fe23859210e3490ba7903b4a172a Mon Sep 17 00:00:00 2001 From: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com> Date: Wed, 30 Jun 2021 20:47:41 +0530 Subject: [PATCH 010/344] fix(docs): update paths to requirements (#42679) --- docs/how-to-setup-freecodecamp-locally.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/how-to-setup-freecodecamp-locally.md b/docs/how-to-setup-freecodecamp-locally.md index 1642706f87..41e60577a5 100644 --- a/docs/how-to-setup-freecodecamp-locally.md +++ b/docs/how-to-setup-freecodecamp-locally.md @@ -21,11 +21,11 @@ Some community members also develop on Windows 10 natively with Git for Windows **Prerequisites:** -| Prerequisite | Version | Notes | -| --------------------------------------------------------------------------------------------- | ------- | -------------------------------------------------------------------- | -| [Node.js](http://nodejs.org) | `14.x` | [LTS Schedule](https://github.com/nodejs/Release#release-schedule) | -| npm (comes bundled with Node) | `6.x` | Does not have LTS releases, we use the version bundled with Node LTS | -| [MongoDB Community Server](https://docs.mongodb.com/manual/administration/install-community/) | `4.0.x` | [Release Notes](https://docs.mongodb.com/v4.0/release-notes/) | +| Prerequisite | Version | Notes | +| --------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------- | +| [Node.js](http://nodejs.org) | `14.x` | We use the "Active LTS" version, See [LTS Schedule](https://nodejs.org/en/about/releases/). | +| npm (comes bundled with Node) | `6.x` | `npm` does not have LTS releases, we use the version bundled with Node.js Active LTS. | +| [MongoDB Community Server](https://docs.mongodb.com/manual/administration/install-community/) | `4.0.x` | - | > [!ATTENTION] > If you have a different version, please install the recommended version. We can only support installation issues for recommended versions. See [troubleshooting](#troubleshooting) for details. From 660c3b34402c6044160c3839a1a8978e381ae989 Mon Sep 17 00:00:00 2001 From: Shaun Hamilton Date: Thu, 24 Jun 2021 19:19:50 +0100 Subject: [PATCH 011/344] chore(client): add package types for migration (#42623) --- client/package-lock.json | 163 ++++++++++++++++++++++++++++++++++++++- client/package.json | 14 ++++ client/tsconfig.json | 4 +- 3 files changed, 179 insertions(+), 2 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index adf7eebeac..f0c23540bb 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -3965,6 +3965,16 @@ "@types/unist": "*" } }, + "@types/hoist-non-react-statics": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", + "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", + "dev": true, + "requires": { + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0" + } + }, "@types/http-proxy": { "version": "1.17.6", "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.6.tgz", @@ -4020,11 +4030,29 @@ "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=" }, + "@types/loadable__component": { + "version": "5.13.3", + "resolved": "https://registry.npmjs.org/@types/loadable__component/-/loadable__component-5.13.3.tgz", + "integrity": "sha512-nkRRYpKxspH9yiYGSvyfM7GX1m57B9AVMrVEWY7Hlv9ueK2XCu39M5QyBTDHXcj5qixdD+MyAmNgoy2dEDxGLQ==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, "@types/lodash": { "version": "4.14.170", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.170.tgz", "integrity": "sha512-bpcvu/MKHHeYX+qeEN8GE7DIravODWdACVA1ctevD8CN24RhPZIKMn9ntfAsrvLfSX3cR5RrBKAbYm9bGs0A+Q==" }, + "@types/lodash-es": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.4.tgz", + "integrity": "sha512-BBz79DCJbD2CVYZH67MBeHZRX++HF+5p8Mo5MzjZi64Wac39S3diedJYHZtScbRVf4DjZyN6LzA0SB0zy+HSSQ==", + "dev": true, + "requires": { + "@types/lodash": "*" + } + }, "@types/mdast": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.3.tgz", @@ -4112,6 +4140,93 @@ } } }, + "@types/react-dom": { + "version": "17.0.8", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.8.tgz", + "integrity": "sha512-0ohAiJAx1DAUEcY9UopnfwCE9sSMDGnY/oXjWMax6g3RpzmTt2GMyMVAXcbn0mo8XAff0SbQJl2/SBU+hjSZ1A==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, + "@types/react-helmet": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@types/react-helmet/-/react-helmet-6.1.1.tgz", + "integrity": "sha512-VmSCMz6jp/06DABoY60vQa++h1YFt0PfAI23llxBJHbowqFgLUL0dhS1AQeVPNqYfRp9LAfokrfWACTNeobOrg==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, + "@types/react-instantsearch-core": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/@types/react-instantsearch-core/-/react-instantsearch-core-6.10.2.tgz", + "integrity": "sha512-dG/XHdrPWjVvQTTOg4Q5somVfE6xePOEFJXVeVsRNB+Pj8tzfFR6niFOStf791wGM9BKVBmmy2rCAMhcbfROnw==", + "dev": true, + "requires": { + "@types/react": "*", + "algoliasearch": ">=4", + "algoliasearch-helper": ">=3" + } + }, + "@types/react-instantsearch-dom": { + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/@types/react-instantsearch-dom/-/react-instantsearch-dom-6.10.0.tgz", + "integrity": "sha512-C9djgcxuRmHKPYuuv83vikLtpH033eQEZ/u8blyoaDrfszaDsJnBfstXDYV+8tfkLFNS5z/YDWr+bl5MocBIMA==", + "dev": true, + "requires": { + "@types/react": "*", + "@types/react-instantsearch-core": "*" + } + }, + "@types/react-monaco-editor": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/@types/react-monaco-editor/-/react-monaco-editor-0.16.0.tgz", + "integrity": "sha512-3YxNIyZ+mlU6WN9UfQ/T66LYjHH3ZWOK4csfefkkXdDmUbHDbuDpfmVSYyJt1W0wlwhcfu4zc7BMwYrimN/GUg==", + "dev": true, + "requires": { + "react-monaco-editor": "*" + } + }, + "@types/react-redux": { + "version": "7.1.16", + "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.16.tgz", + "integrity": "sha512-f/FKzIrZwZk7YEO9E1yoxIuDNRiDducxkFlkw/GNMGEnK9n4K8wJzlJBghpSuOVDgEUHoDkDF7Gi9lHNQR4siw==", + "dev": true, + "requires": { + "@types/hoist-non-react-statics": "^3.3.0", + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0", + "redux": "^4.0.0" + } + }, + "@types/react-responsive": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@types/react-responsive/-/react-responsive-8.0.2.tgz", + "integrity": "sha512-DTvm3Hb77v0hme7L4GYzRjLQqlZP+zNImFBzdKbSH7CsQ5c7QebGnSQX2Xf3BaA0rm/TQE57eFMhMGLcMe/A9w==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, + "@types/react-spinkit": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/react-spinkit/-/react-spinkit-3.0.6.tgz", + "integrity": "sha512-iGgzwQcwU93PSue8U5eYwXEf2yF7ji1vraqB1op6ZuSRvdYg/keFP+7pEuIt454XSQgc/aI4XyLZfO1TdoT0Bw==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, + "@types/react-test-renderer": { + "version": "17.0.1", + "resolved": "https://registry.npmjs.org/@types/react-test-renderer/-/react-test-renderer-17.0.1.tgz", + "integrity": "sha512-3Fi2O6Zzq/f3QR9dRnlnHso9bMl7weKCviFmfF6B4LS1Uat6Hkm15k0ZAQuDz+UBq6B3+g+NM6IT2nr5QgPzCw==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, "@types/react-transition-group": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.1.tgz", @@ -4145,11 +4260,26 @@ "@types/node": "*" } }, + "@types/sanitize-html": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@types/sanitize-html/-/sanitize-html-2.3.1.tgz", + "integrity": "sha512-+UT/XRluJuCunRftwO6OzG6WOBgJ+J3sROIoSJWX+7PB2FtTJTEJLrHCcNwzCQc0r60bej3WAbaigK+VZtZCGw==", + "dev": true, + "requires": { + "htmlparser2": "^6.0.0" + } + }, "@types/scheduler": { "version": "0.16.1", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.1.tgz", "integrity": "sha512-EaCxbanVeyxDRTQBkdLb3Bvl/HK7PBK6UJjsSixB0iHKoWxE5uu2Q/DgtpOhPIojN0Zl1whvOd7PoHs2P0s5eA==" }, + "@types/store": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/store/-/store-2.0.2.tgz", + "integrity": "sha512-ZPHnXkzmGMfk+pHqAGzTSpA9CbsHmJLgkvOl5w52LZ0XTxB1ZIHWZzQ7lEtjTNWScBbsQekg8TjApMXkMe4nkw==", + "dev": true + }, "@types/testing-library__jest-dom": { "version": "5.14.0", "resolved": "https://registry.npmjs.org/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.0.tgz", @@ -4169,6 +4299,12 @@ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.3.tgz", "integrity": "sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ==" }, + "@types/validator": { + "version": "13.1.4", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.1.4.tgz", + "integrity": "sha512-19C02B8mr53HufY7S+HO/EHBD7a/R22IwEwyqiHaR19iwL37dN3o0M8RianVInfSSqP7InVSg/o0mUATM4JWsQ==", + "dev": true + }, "@types/websocket": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@types/websocket/-/websocket-1.0.2.tgz", @@ -5453,6 +5589,15 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==" }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -9385,6 +9530,12 @@ "token-types": "^2.0.0" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "optional": true + }, "filesize": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.1.0.tgz", @@ -14745,6 +14896,12 @@ "resolved": "https://registry.npmjs.org/name-all-modules-plugin/-/name-all-modules-plugin-1.0.1.tgz", "integrity": "sha1-Cr+2rYNXGLn7Te8GdOBmV6lUN1w=" }, + "nan": { + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", + "optional": true + }, "nanoid": { "version": "3.1.23", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", @@ -20703,7 +20860,11 @@ "version": "1.2.13", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "glob-parent": { "version": "3.1.0", diff --git a/client/package.json b/client/package.json index 37576e5eee..3bde2b726e 100644 --- a/client/package.json +++ b/client/package.json @@ -132,8 +132,22 @@ "@codesee/tracker": "0.43.1", "@testing-library/jest-dom": "5.14.1", "@testing-library/react": "12.0.0", + "@types/jest": "^26.0.23", + "@types/loadable__component": "^5.13.3", + "@types/lodash-es": "^4.17.4", + "@types/react-dom": "^17.0.8", + "@types/react-helmet": "^6.1.1", + "@types/react-instantsearch-dom": "^6.10.0", + "@types/react-monaco-editor": "^0.16.0", + "@types/react-redux": "^7.1.16", + "@types/react-responsive": "^8.0.2", + "@types/react-spinkit": "^3.0.6", + "@types/react-test-renderer": "^17.0.1", "@types/react-transition-group": "4.4.1", "@types/redux-actions": "2.6.1", + "@types/sanitize-html": "^2.3.1", + "@types/store": "^2.0.2", + "@types/validator": "^13.1.4", "autoprefixer": "10.2.6", "babel-plugin-transform-imports": "2.0.0", "chokidar": "3.5.2", diff --git a/client/tsconfig.json b/client/tsconfig.json index a1bf75d789..d6d0f9671d 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -11,6 +11,8 @@ "experimentalDecorators": true, "emitDecoratorMetadata": true, "noEmit": true, - "skipLibCheck": true + "resolveJsonModule": true, + "skipLibCheck": true, + "types": ["node", "jest", "@testing-library/jest-dom"] } } From 4b44bb37d9e65e3932041d6cdbeb7e768ed7d8c9 Mon Sep 17 00:00:00 2001 From: Marlon Johnson Date: Fri, 25 Jun 2021 07:23:52 -0700 Subject: [PATCH 012/344] feat(client): ts-migrate client/src/components/helpers/** (#42593) * refactor(client): convert toggle-button to TypeScript * chore: rename Space to tsx * refactor(client): convert space to TypeScript * chore: rename SlimWidthRow to tsx * refactor(client): slim-width-row to TypeScript * chore: rename SkeletonSprite to ts * fix: fixed typos and resolved paths * chore: resolve path inconsistencies * refactor(client): skelton-sprite to TypeScript * chore: rename loader.test to tsx * chore: add types for react-spinkit * refactor(client): loader to TypeScript * refactor(client): link to TypeScript * refactor(client): image-loader to TypeScript * refactor(client): full-width-row to TypeScript * refactor(client): current-challenge-link to TypeScript * refactor(client): button to TypeScript * refactor(client): border-color-picker to TypeScript * refactor(client): avatar-renderer to TypeScript * chore: changed loadertest(snap) to ts * chore: optional types added and cleaned files * fix: args are now optional * push small updates for Spacer component merge * update snapshot * remove type defs from deps * Revert "remove type defs from deps" This reverts commit 9f58bf35549d12512bb415dbf57891b7753f3c7f. * correctly remove client type deps * final push to remove from deps Co-authored-by: Shaun Hamilton --- .../ShowProfileOrFourOhFour.js | 2 +- .../client-only-routes/ShowUnsubscribed.js | 2 +- client/src/components/Donation/DonateForm.js | 2 +- client/src/components/Footer/index.js | 2 +- client/src/components/Intro/index.js | 2 +- client/src/components/helpers/Spacer.js | 22 -------------- ...ader.test.js.snap => loader.test.tsx.snap} | 0 ...{AvatarRenderer.js => avatar-renderer.tsx} | 27 +++++++++-------- ...rColorPicker.js => border-color-picker.ts} | 5 +++- .../{ButtonSpacer.js => button-spacer.tsx} | 2 +- ...engeLink.js => current-challenge-link.tsx} | 21 ++++++++------ .../{FullWidthRow.js => full-width-row.tsx} | 13 +++++---- .../{ImageLoader.js => image-loader.tsx} | 29 ++++++++++--------- client/src/components/helpers/index.js | 22 +++++++------- .../helpers/{Link.test.js => link.test.tsx} | 10 ++++--- .../components/helpers/{Link.js => link.tsx} | 22 ++++++++------ .../{Loader.test.js => loader.test.tsx} | 2 +- .../helpers/{Loader.js => loader.tsx} | 13 ++++----- ...{SkeletonSprite.js => skeleton-sprite.tsx} | 7 +++-- .../{skeletonStyles.js => skeleton-styles.ts} | 0 .../{SlimWidthRow.js => slim-width-row.tsx} | 12 ++++---- client/src/components/helpers/spacer.tsx | 24 +++++++++++++++ .../{ToggleButton.js => toggle-button.tsx} | 23 ++++++++------- client/src/components/profile/Profile.js | 2 +- .../components/profile/components/Camper.js | 2 +- .../components/profile/components/HeatMap.js | 4 +-- client/src/components/settings/Email.js | 4 +-- client/src/components/settings/Privacy.js | 4 +-- .../src/components/settings/SectionHeader.js | 2 +- .../src/components/settings/ToggleSetting.js | 2 +- client/src/components/settings/Username.js | 2 +- .../Challenges/projects/backend/Show.js | 2 +- .../Challenges/projects/frontend/Show.js | 2 +- client/src/templates/Challenges/video/Show.js | 4 +-- client/src/templates/Introduction/Intro.js | 4 +-- client/tsconfig.json | 15 ++++++++-- 36 files changed, 173 insertions(+), 140 deletions(-) delete mode 100644 client/src/components/helpers/Spacer.js rename client/src/components/helpers/__snapshots__/{Loader.test.js.snap => loader.test.tsx.snap} (100%) rename client/src/components/helpers/{AvatarRenderer.js => avatar-renderer.tsx} (63%) rename client/src/components/helpers/{borderColorPicker.js => border-color-picker.ts} (64%) rename client/src/components/helpers/{ButtonSpacer.js => button-spacer.tsx} (81%) rename client/src/components/helpers/{CurrentChallengeLink.js => current-challenge-link.tsx} (67%) rename client/src/components/helpers/{FullWidthRow.js => full-width-row.tsx} (63%) rename client/src/components/helpers/{ImageLoader.js => image-loader.tsx} (69%) rename client/src/components/helpers/{Link.test.js => link.test.tsx} (64%) rename client/src/components/helpers/{Link.js => link.tsx} (63%) rename client/src/components/helpers/{Loader.test.js => loader.test.tsx} (96%) rename client/src/components/helpers/{Loader.js => loader.tsx} (76%) rename client/src/components/helpers/{SkeletonSprite.js => skeleton-sprite.tsx} (73%) rename client/src/components/helpers/{skeletonStyles.js => skeleton-styles.ts} (100%) rename client/src/components/helpers/{SlimWidthRow.js => slim-width-row.tsx} (63%) create mode 100644 client/src/components/helpers/spacer.tsx rename client/src/components/helpers/{ToggleButton.js => toggle-button.tsx} (82%) diff --git a/client/src/client-only-routes/ShowProfileOrFourOhFour.js b/client/src/client-only-routes/ShowProfileOrFourOhFour.js index 0b6b49cbe0..e164c727e4 100644 --- a/client/src/client-only-routes/ShowProfileOrFourOhFour.js +++ b/client/src/client-only-routes/ShowProfileOrFourOhFour.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { isEmpty } from 'lodash-es'; -import Loader from '../components/helpers/Loader'; +import Loader from '../components/helpers/loader'; import { userByNameSelector, userProfileFetchStateSelector, diff --git a/client/src/client-only-routes/ShowUnsubscribed.js b/client/src/client-only-routes/ShowUnsubscribed.js index 9bfcf9788e..e0cf948ab0 100644 --- a/client/src/client-only-routes/ShowUnsubscribed.js +++ b/client/src/client-only-routes/ShowUnsubscribed.js @@ -5,7 +5,7 @@ import Helmet from 'react-helmet'; import { useTranslation } from 'react-i18next'; import envData from '../../../config/env.json'; -import FullWidthRow from '../components/helpers/FullWidthRow'; +import FullWidthRow from '../components/helpers/full-width-row'; import { Spacer } from '../components/helpers'; const { apiLocation } = envData; diff --git a/client/src/components/Donation/DonateForm.js b/client/src/components/Donation/DonateForm.js index 4b78137620..295bff1365 100644 --- a/client/src/components/Donation/DonateForm.js +++ b/client/src/components/Donation/DonateForm.js @@ -20,7 +20,7 @@ import { defaultDonation, modalDefaultDonation } from '../../../../config/donation-settings'; -import Spacer from '../helpers/Spacer'; +import Spacer from '../helpers/spacer'; import PaypalButton from './PaypalButton'; import DonateCompletion from './DonateCompletion'; import { diff --git a/client/src/components/Footer/index.js b/client/src/components/Footer/index.js index 32ed7e099a..79117fb496 100644 --- a/client/src/components/Footer/index.js +++ b/client/src/components/Footer/index.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { useTranslation } from 'react-i18next'; -import Link from '../helpers/Link'; +import Link from '../helpers/link'; import './footer.css'; const propTypes = { diff --git a/client/src/components/Intro/index.js b/client/src/components/Intro/index.js index 69c2934ba5..1eb4bb88df 100644 --- a/client/src/components/Intro/index.js +++ b/client/src/components/Intro/index.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Link, Spacer, Loader, FullWidthRow } from '../helpers'; import { randomQuote } from '../../utils/get-words'; -import CurrentChallengeLink from '../helpers/CurrentChallengeLink'; +import CurrentChallengeLink from '../helpers/current-challenge-link'; import IntroDescription from './components/IntroDescription'; import { Trans, useTranslation } from 'react-i18next'; diff --git a/client/src/components/helpers/Spacer.js b/client/src/components/helpers/Spacer.js deleted file mode 100644 index 385b819937..0000000000 --- a/client/src/components/helpers/Spacer.js +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -const styles = { padding: '15px 0', height: '1px' }; - -const Comp = props =>
; - -const Spacer = ({ size = 1 }) => - size === 1 ? ( - - ) : ( - '#' - .repeat(size) - .split('') - .map((_, i) => ) - ); - -Spacer.propTypes = { - size: PropTypes.number -}; - -export default Spacer; diff --git a/client/src/components/helpers/__snapshots__/Loader.test.js.snap b/client/src/components/helpers/__snapshots__/loader.test.tsx.snap similarity index 100% rename from client/src/components/helpers/__snapshots__/Loader.test.js.snap rename to client/src/components/helpers/__snapshots__/loader.test.tsx.snap diff --git a/client/src/components/helpers/AvatarRenderer.js b/client/src/components/helpers/avatar-renderer.tsx similarity index 63% rename from client/src/components/helpers/AvatarRenderer.js rename to client/src/components/helpers/avatar-renderer.tsx index 21246ee786..ad40555154 100644 --- a/client/src/components/helpers/AvatarRenderer.js +++ b/client/src/components/helpers/avatar-renderer.tsx @@ -1,22 +1,26 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Image } from '@freecodecamp/react-bootstrap'; import DefaultAvatar from '../../assets/icons/DefaultAvatar'; import { defaultUserImage } from '../../../../config/misc'; -import { borderColorPicker } from '../helpers'; +import { borderColorPicker } from '.'; import { useTranslation } from 'react-i18next'; -const propTypes = { - isDonating: PropTypes.bool, - isTopContributor: PropTypes.bool, - picture: PropTypes.any.isRequired, - userName: PropTypes.string.isRequired -}; +interface AvatarRendererProps { + isDonating?: boolean; + isTopContributor?: boolean; + picture: string; + userName: string; +} -function AvatarRenderer({ picture, userName, isDonating, isTopContributor }) { +function AvatarRenderer({ + picture, + userName, + isDonating, + isTopContributor +}: AvatarRendererProps): JSX.Element { const { t } = useTranslation(); - let borderColor = borderColorPicker(isDonating, isTopContributor); - let isPlaceHolderImage = + const borderColor: string = borderColorPicker(isDonating, isTopContributor); + const isPlaceHolderImage = /example.com|identicon.org/.test(picture) || picture === defaultUserImage; return ( @@ -35,6 +39,5 @@ function AvatarRenderer({ picture, userName, isDonating, isTopContributor }) { ); } -AvatarRenderer.propTypes = propTypes; AvatarRenderer.displayName = 'AvatarRenderer'; export default AvatarRenderer; diff --git a/client/src/components/helpers/borderColorPicker.js b/client/src/components/helpers/border-color-picker.ts similarity index 64% rename from client/src/components/helpers/borderColorPicker.js rename to client/src/components/helpers/border-color-picker.ts index 4a36376509..a225a36136 100644 --- a/client/src/components/helpers/borderColorPicker.js +++ b/client/src/components/helpers/border-color-picker.ts @@ -1,4 +1,7 @@ -export default function borderColorPicker(isDonating, isTopContributor) { +export default function borderColorPicker( + isDonating?: boolean, + isTopContributor?: boolean +): string { if (isDonating && isTopContributor) return 'purple-border'; else if (isTopContributor) return 'blue-border'; else if (isDonating) return 'gold-border'; diff --git a/client/src/components/helpers/ButtonSpacer.js b/client/src/components/helpers/button-spacer.tsx similarity index 81% rename from client/src/components/helpers/ButtonSpacer.js rename to client/src/components/helpers/button-spacer.tsx index 8ac663d857..9813d0b823 100644 --- a/client/src/components/helpers/ButtonSpacer.js +++ b/client/src/components/helpers/button-spacer.tsx @@ -1,6 +1,6 @@ import React from 'react'; -function ButtonSpacer() { +function ButtonSpacer(): JSX.Element { return
; } diff --git a/client/src/components/helpers/CurrentChallengeLink.js b/client/src/components/helpers/current-challenge-link.tsx similarity index 67% rename from client/src/components/helpers/CurrentChallengeLink.js rename to client/src/components/helpers/current-challenge-link.tsx index 279ab66056..176bfcceda 100644 --- a/client/src/components/helpers/CurrentChallengeLink.js +++ b/client/src/components/helpers/current-challenge-link.tsx @@ -1,18 +1,22 @@ import React from 'react'; -import PropTypes from 'prop-types'; import envData from '../../../../config/env.json'; -const { apiLocation } = envData; +interface EnvData { + apiLocation: string; +} + +const { apiLocation } = envData as EnvData; const currentChallengeApi = '/challenges/current-challenge'; -const propTypes = { - children: PropTypes.any, - isLargeBtn: PropTypes.bool -}; - -function CurrentChallengeLink({ children, isLargeBtn }) { +function CurrentChallengeLink({ + children, + isLargeBtn +}: { + children?: JSX.ElementChildrenAttribute; + isLargeBtn?: boolean; +}): JSX.Element { let classNames; if (isLargeBtn) { classNames = 'btn btn-lg btn-primary btn-block'; @@ -27,6 +31,5 @@ function CurrentChallengeLink({ children, isLargeBtn }) { } CurrentChallengeLink.displayName = 'CurrentChallengeLink'; -CurrentChallengeLink.propTypes = propTypes; export default CurrentChallengeLink; diff --git a/client/src/components/helpers/FullWidthRow.js b/client/src/components/helpers/full-width-row.tsx similarity index 63% rename from client/src/components/helpers/FullWidthRow.js rename to client/src/components/helpers/full-width-row.tsx index b55d3fdbf0..f7201a4b39 100644 --- a/client/src/components/helpers/FullWidthRow.js +++ b/client/src/components/helpers/full-width-row.tsx @@ -1,8 +1,13 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Row, Col } from '@freecodecamp/react-bootstrap'; -function FullWidthRow({ children, className }) { +function FullWidthRow({ + children, + className +}: { + children?: JSX.ElementChildrenAttribute; + className?: string; +}): JSX.Element { return ( @@ -13,9 +18,5 @@ function FullWidthRow({ children, className }) { } FullWidthRow.displayName = 'FullWidthRow'; -FullWidthRow.propTypes = { - children: PropTypes.any, - className: PropTypes.string -}; export default FullWidthRow; diff --git a/client/src/components/helpers/ImageLoader.js b/client/src/components/helpers/image-loader.tsx similarity index 69% rename from client/src/components/helpers/ImageLoader.js rename to client/src/components/helpers/image-loader.tsx index fcc8fe1ddd..53ec38b38f 100644 --- a/client/src/components/helpers/ImageLoader.js +++ b/client/src/components/helpers/image-loader.tsx @@ -1,20 +1,21 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ import React, { useState } from 'react'; import './image-loader.css'; +// @ts-ignore import LazyLoad from 'react-lazy-load'; -import PropTypes from 'prop-types'; -const propTypes = { - alt: PropTypes.string, - className: PropTypes.string, - height: PropTypes.number, - loadedClassName: PropTypes.string, - loadingClassName: PropTypes.string, - offsetVertical: PropTypes.number, - src: PropTypes.string, - style: PropTypes.object, - width: PropTypes.number -}; +interface ImageLoaderProps { + alt?: string; + className?: string; + height?: number; + loadedClassName?: string; + loadingClassName?: string; + offsetVertical?: number; + src?: string; + style?: React.CSSProperties; + width?: number; +} const ImageLoader = ({ className = '', @@ -26,7 +27,7 @@ const ImageLoader = ({ style, width, height -}) => { +}: ImageLoaderProps): JSX.Element => { const [loaded, setLoaded] = useState(false); const fullClassName = `${className} ${ loaded ? loadedClassName : loadingClassName @@ -49,5 +50,5 @@ const ImageLoader = ({ ); }; -ImageLoader.propTypes = propTypes; + export default ImageLoader; diff --git a/client/src/components/helpers/index.js b/client/src/components/helpers/index.js index f59bba1524..a501903a0b 100644 --- a/client/src/components/helpers/index.js +++ b/client/src/components/helpers/index.js @@ -1,11 +1,11 @@ -export { default as ButtonSpacer } from './ButtonSpacer'; -export { default as FullWidthRow } from './FullWidthRow'; -export { default as SlimWidthRow } from './SlimWidthRow'; -export { default as Loader } from './Loader'; -export { default as SkeletonSprite } from './SkeletonSprite'; -export { default as Spacer } from './Spacer'; -export { default as Link } from './Link'; -export { default as CurrentChallengeLink } from './CurrentChallengeLink'; -export { default as ImageLoader } from './ImageLoader'; -export { default as AvatarRenderer } from './AvatarRenderer'; -export { default as borderColorPicker } from './borderColorPicker'; +export { default as ButtonSpacer } from './button-spacer'; +export { default as FullWidthRow } from './full-width-row'; +export { default as SlimWidthRow } from './slim-width-row'; +export { default as Loader } from './loader'; +export { default as SkeletonSprite } from './skeleton-sprite'; +export { default as Spacer } from './spacer'; +export { default as Link } from './link'; +export { default as CurrentChallengeLink } from './current-challenge-link'; +export { default as ImageLoader } from './image-loader'; +export { default as AvatarRenderer } from './avatar-renderer'; +export { default as borderColorPicker } from './border-color-picker'; diff --git a/client/src/components/helpers/Link.test.js b/client/src/components/helpers/link.test.tsx similarity index 64% rename from client/src/components/helpers/Link.test.js rename to client/src/components/helpers/link.test.tsx index 13a2f2cc44..92dc93bde3 100644 --- a/client/src/components/helpers/Link.test.js +++ b/client/src/components/helpers/link.test.tsx @@ -1,13 +1,15 @@ import React from 'react'; -import renderer from 'react-test-renderer'; +import renderer, { ReactTestRendererJSON } from 'react-test-renderer'; -import Link from './Link'; +import Link from './link'; describe('', () => { const externalLink = renderer .create() - .toJSON(); - const gatsbyLink = renderer.create().toJSON(); + .toJSON() as ReactTestRendererJSON; + const gatsbyLink = renderer + .create() + .toJSON() as ReactTestRendererJSON; it('renders to the DOM', () => { expect(gatsbyLink).toBeTruthy(); diff --git a/client/src/components/helpers/Link.js b/client/src/components/helpers/link.tsx similarity index 63% rename from client/src/components/helpers/Link.js rename to client/src/components/helpers/link.tsx index f5f9988ae9..91739a7acb 100644 --- a/client/src/components/helpers/Link.js +++ b/client/src/components/helpers/link.tsx @@ -1,15 +1,20 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Link as GatsbyLink } from 'gatsby'; -const propTypes = { - children: PropTypes.any, - external: PropTypes.bool, - sameTab: PropTypes.bool, - to: PropTypes.string.isRequired -}; +interface LinkProps { + children?: JSX.ElementChildrenAttribute; + external?: boolean; + sameTab?: boolean; + to: string; +} -const Link = ({ children, to, external, sameTab, ...other }) => { +const Link = ({ + children, + to, + external, + sameTab, + ...other +}: LinkProps): JSX.Element => { if (!external && /^\/(?!\/)/.test(to)) { return ( @@ -30,6 +35,5 @@ const Link = ({ children, to, external, sameTab, ...other }) => { ); }; -Link.propTypes = propTypes; export default Link; diff --git a/client/src/components/helpers/Loader.test.js b/client/src/components/helpers/loader.test.tsx similarity index 96% rename from client/src/components/helpers/Loader.test.js rename to client/src/components/helpers/loader.test.tsx index 21bf667513..f57a42b4db 100644 --- a/client/src/components/helpers/Loader.test.js +++ b/client/src/components/helpers/loader.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { render, cleanup } from '@testing-library/react'; -import Loader from './Loader'; +import Loader from './loader'; describe('', () => { afterEach(cleanup); diff --git a/client/src/components/helpers/Loader.js b/client/src/components/helpers/loader.tsx similarity index 76% rename from client/src/components/helpers/Loader.js rename to client/src/components/helpers/loader.tsx index 8bd5a55f3a..e39561e7d9 100644 --- a/client/src/components/helpers/Loader.js +++ b/client/src/components/helpers/loader.tsx @@ -1,13 +1,16 @@ import React, { useState, useEffect } from 'react'; -import PropTypes from 'prop-types'; import Spinner from 'react-spinkit'; import './loader.css'; -function Loader({ fullScreen, timeout }) { +interface LoaderProps { + fullScreen?: boolean; + timeout?: number; +} +function Loader({ fullScreen, timeout }: LoaderProps): JSX.Element { const [showSpinner, setShowSpinner] = useState(!timeout); useEffect(() => { - let timerId; + let timerId: ReturnType; if (!showSpinner) { timerId = setTimeout(() => setShowSpinner(true), timeout); } @@ -21,9 +24,5 @@ function Loader({ fullScreen, timeout }) { } Loader.displayName = 'Loader'; -Loader.propTypes = { - fullScreen: PropTypes.bool, - timeout: PropTypes.number -}; export default Loader; diff --git a/client/src/components/helpers/SkeletonSprite.js b/client/src/components/helpers/skeleton-sprite.tsx similarity index 73% rename from client/src/components/helpers/SkeletonSprite.js rename to client/src/components/helpers/skeleton-sprite.tsx index 7415e8d834..d7401b2d2f 100644 --- a/client/src/components/helpers/SkeletonSprite.js +++ b/client/src/components/helpers/skeleton-sprite.tsx @@ -1,8 +1,11 @@ import React from 'react'; -import styles from './skeletonStyles'; +import styles from './skeleton-styles'; -function SkeletonSprite() { +// TODO: unsure about parameter typing +function SkeletonSprite({}: React.FC< + React.ComponentPropsWithoutRef<'svg'> +>): JSX.Element { return (
- - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
# --instructions-- diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/date-format.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/date-format.md index b3d9c7c590..7db6dbebb1 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/date-format.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/date-format.md @@ -8,14 +8,20 @@ dashedName: date-format # --description-- -Return an array with the current date in the formats: +Return an array with two date strings of the current date with the following specifications: -
    -
  • 2007-11-23
  • -
  • Friday, November 23, 2007
  • -
+- The first string's date order should be the year number, month number, and day number separated by dashes (`-`). +- The first string's year should be four digits in length. +- The first string's month and day should not contain any leading zeros. +- The second string's weekday and month names should not be abbreviated. +- The second string's day should not contain any leading zeros. -Example output: `['2007-11-23', 'Friday, November 23, 2007']` +Example outputs: + +```js +['2007-11-23', 'Friday, November 23, 2007'] +['2021-3-2', 'Tuesday, March 2, 2021'] +``` # --hints-- diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/emirp-primes.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/emirp-primes.md index f8a6d22105..564476da7a 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/emirp-primes.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/emirp-primes.md @@ -82,7 +82,7 @@ assert.deepEqual(emirps([7700, 8000], true), [ ]); ``` -`emirps([7700,8000],true)` should return `11` +`emirps([7700,8000],false)` should return `11` ```js assert.deepEqual(emirps([7700, 8000], false), 11); diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md index 499a48f0a6..cdc024dab4 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md @@ -40,13 +40,7 @@ the shop -> my brother a never used -> .terminating rule -Sample text of: - -`I bought a B of As from T S.` - -Should generate the output: - -`I bought a bag of apples from my brother.` +Sample text of `I bought a B of As from T S.` should generate the output `I bought a bag of apples from my brother.` **Ruleset 2:** @@ -61,13 +55,7 @@ the shop -> my brother a never used -> .terminating rule -Sample text of: - -`I bought a B of As from T S.` - -Should generate: - -`I bought a bag of apples from T shop.` +Sample text of `I bought a B of As from T S.` should generate `I bought a bag of apples from T shop.` **Ruleset 3:** @@ -86,13 +74,7 @@ the shop -> my brother a never used -> .terminating rule -Sample text of: - -`I bought a B of As W my Bgage from T S.` - -Should generate: - -`I bought a bag of apples with my money from T shop.` +Sample text of `I bought a B of As W my Bgage from T S.` should generate `I bought a bag of apples with my money from T shop.` **Ruleset 4:** @@ -128,13 +110,7 @@ _1 -> 1 _+_ -> -Sample text of: - -`_1111*11111_` - -should generate the output: - -`11111111111111111111` +Sample text of `_1111*11111_` should generate the output `11111111111111111111` **Ruleset 5:** @@ -164,13 +140,7 @@ B1 -> 1B 1C1 -> H11 -This ruleset should turn - -`000000A000000` - -into - -`00011H1111000` +This ruleset should turn `000000A000000` into `00011H1111000` # --hints-- diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md index f450b13ddb..0e5a414555 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md @@ -54,7 +54,7 @@ As in other trial division algorithms, the algorithm stops when `2kP+1 > sqrt(N) # --instructions-- -Using the above method find a factor of 2929-1 (aka M929) +Using the above method find a factor of 2p-1. # --hints-- @@ -70,19 +70,19 @@ assert(typeof check_mersenne === 'function'); assert(typeof check_mersenne(3) == 'string'); ``` -`check_mersenne(3)` should return "M3 = 2^3-1 is prime". +`check_mersenne(3)` should return the string `M3 = 2^3-1 is prime`. ```js assert.equal(check_mersenne(3), 'M3 = 2^3-1 is prime'); ``` -`check_mersenne(23)` should return "M23 = 2^23-1 is composite with factor 47". +`check_mersenne(23)` should return the string `M23 = 2^23-1 is composite with factor 47`. ```js assert.equal(check_mersenne(23), 'M23 = 2^23-1 is composite with factor 47'); ``` -`check_mersenne(929)` should return "M929 = 2^929-1 is composite with factor 13007 +`check_mersenne(929)` should return the string `M929 = 2^929-1 is composite with factor 13007`. ```js assert.equal( diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/hailstone-sequence.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/hailstone-sequence.md index e7587e2f99..37768d8cd3 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/hailstone-sequence.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/hailstone-sequence.md @@ -10,29 +10,18 @@ dashedName: hailstone-sequence The Hailstone sequence of numbers can be generated from a starting positive integer, `n` by: -
    -
  • If n is 1 then the sequence ends
  • -
  • If n is even then the next n of the sequence = n/2
  • -
  • If n is odd then the next n of the sequence = (3 * n) + 1
  • -
+- If `n` is `1` then the sequence ends +- If `n` is `even` then the next `n` of the sequence `= n/2` +- If `n` is `odd` then the next `n` of the sequence `= (3 * n) + 1` -The (unproven) [Collatz conjecture](https://en.wikipedia.org/wiki/Collatz conjecture "wp: Collatz conjecture") is that the hailstone sequence for any starting number always terminates. +The (unproven) Collatz conjecture is that the hailstone sequence for any starting number always terminates. The hailstone sequence is also known as hailstone numbers (because the values are usually subject to multiple descents and ascents like hailstones in a cloud), or as the Collatz sequence. # --instructions-- -
    -
  1. Create a routine to generate the hailstone sequence for a number
  2. -
  3. Use the routine to show that the hailstone sequence for the number 27 has 112 elements starting with 27, 82, 41, 124 and ending with 8, 4, 2, 1
  4. -
  5. Show the number less than 100,000 which has the longest hailstone sequence together with that sequence's length. (But don't show the actual sequence!)
  6. -
- -**See also:** - -
    -
  • xkcd (humourous).
  • -
+1. Create a routine to generate the hailstone sequence for a number +2. Your function should return an array with the number less than `limit` which has the longest hailstone sequence and that sequence's length. (But don't show the actual sequence!) # --hints-- @@ -42,24 +31,36 @@ The hailstone sequence is also known as hailstone numbers (because the values ar assert(typeof hailstoneSequence === 'function'); ``` -`hailstoneSequence()` should return `[[27,82,41,124,8,4,2,1], [351, 77031]]` +`hailstoneSequence(30)` should return an array. ```js -assert.deepEqual(hailstoneSequence(), res); +assert(Array.isArray(hailstoneSequence(30))); +``` + +`hailstoneSequence(30)` should return `[27, 112]`. + +```js +assert.deepEqual(hailstoneSequence(30), [27, 112]); +``` + +`hailstoneSequence(50000)` should return `[35655, 324]`. + +```js +assert.deepEqual(hailstoneSequence(50000), [35655, 324]); +``` + +`hailstoneSequence(100000)` should return `[77031, 351]`. + +```js +assert.deepEqual(hailstoneSequence(100000), [77031, 351]); ``` # --seed-- -## --after-user-code-- - -```js -const res = [[27, 82, 41, 124, 8, 4, 2, 1], [351, 77031]]; -``` - ## --seed-contents-- ```js -function hailstoneSequence() { +function hailstoneSequence(limit) { const res = []; @@ -70,9 +71,7 @@ function hailstoneSequence() { # --solutions-- ```js -function hailstoneSequence () { - const res = []; - +function hailstoneSequence (limit) { function hailstone(n) { const seq = [n]; while (n > 1) { @@ -82,13 +81,9 @@ function hailstoneSequence () { return seq; } - const h = hailstone(27); - const hLen = h.length; - res.push([...h.slice(0, 4), ...h.slice(hLen - 4, hLen)]); - let n = 0; let max = 0; - for (let i = 100000; --i;) { + for (let i = limit; --i;) { const seq = hailstone(i); const sLen = seq.length; @@ -97,8 +92,7 @@ function hailstoneSequence () { max = sLen; } } - res.push([max, n]); - return res; + return [n, max]; } ``` diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/happy-numbers.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/happy-numbers.md index 6eb4988539..6cb33dbcaf 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/happy-numbers.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/happy-numbers.md @@ -30,67 +30,67 @@ assert(typeof happy === 'function'); assert(typeof happy(1) === 'boolean'); ``` -`happy(1)` should return true. +`happy(1)` should return `true`. ```js assert(happy(1)); ``` -`happy(2)` should return false. +`happy(2)` should return `false`. ```js assert(!happy(2)); ``` -`happy(7)` should return true. +`happy(7)` should return `true`. ```js assert(happy(7)); ``` -`happy(10)` should return true. +`happy(10)` should return `true`. ```js assert(happy(10)); ``` -`happy(13)` should return true. +`happy(13)` should return `true`. ```js assert(happy(13)); ``` -`happy(19)` should return true. +`happy(19)` should return `true`. ```js assert(happy(19)); ``` -`happy(23)` should return true. +`happy(23)` should return `true`. ```js assert(happy(23)); ``` -`happy(28)` should return true. +`happy(28)` should return `true`. ```js assert(happy(28)); ``` -`happy(31)` should return true. +`happy(31)` should return `true`. ```js assert(happy(31)); ``` -`happy(32)` should return true:. +`happy(32)` should return `true`. ```js assert(happy(32)); ``` -`happy(33)` should return false. +`happy(33)` should return `false`. ```js assert(!happy(33)); diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/harshad-or-niven-series.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/harshad-or-niven-series.md index 383989816a..400e951334 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/harshad-or-niven-series.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/harshad-or-niven-series.md @@ -10,7 +10,7 @@ dashedName: harshad-or-niven-series The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits. -For example, `42` is a [Harshad number](https://rosettacode.org/wiki/Harshad_or_Niven_series "Harshad or Niven series") as `42` is divisible by `(4 + 2)` without remainder. +For example, `42` is a Harshad number as `42` is divisible by `(4 + 2)` without remainder. Assume that the series is defined as the numbers in increasing order. @@ -18,7 +18,7 @@ Assume that the series is defined as the numbers in increasing order. Implement a function to generate successive members of the Harshad sequence. -Use it to list the first twenty members of the sequence and list the first Harshad number greater than 1000. +Use it to return an array with ten members of the sequence, starting with first Harshad number greater than `n`. # --hints-- @@ -28,32 +28,31 @@ Use it to list the first twenty members of the sequence and list the first Harsh assert(typeof isHarshadOrNiven === 'function'); ``` -`isHarshadOrNiven()` should return `{"firstTwenty": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42],"firstOver1000": 1002}` +`isHarshadOrNiven(10)` should return `[12, 18, 20, 21, 24, 27, 30, 36, 40, 42]` ```js -assert.deepEqual(isHarshadOrNiven(), res); +assert.deepEqual(isHarshadOrNiven(10), [12, 18, 20, 21, 24, 27, 30, 36, 40, 42]); +``` + +`isHarshadOrNiven(400)` should return `[402, 405, 407, 408, 410, 414, 420, 423, 432, 440]` + +```js +assert.deepEqual(isHarshadOrNiven(400), [402, 405, 407, 408, 410, 414, 420, 423, 432, 440]); +``` + +`isHarshadOrNiven(1000)` should return `[1002, 1008, 1010, 1011, 1012, 1014, 1015, 1016, 1017, 1020]` + +```js +assert.deepEqual(isHarshadOrNiven(1000), [1002, 1008, 1010, 1011, 1012, 1014, 1015, 1016, 1017, 1020]); ``` # --seed-- -## --after-user-code-- - -```js -const res = { - firstTwenty: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42], - firstOver1000: 1002 -}; -``` - ## --seed-contents-- ```js -function isHarshadOrNiven() { - const res = { - firstTwenty: [], - firstOver1000: undefined - }; - // Only change code below this line +function isHarshadOrNiven(n) { + const res = []; return res; } @@ -62,37 +61,27 @@ function isHarshadOrNiven() { # --solutions-- ```js -function isHarshadOrNiven() { - const res = { - firstTwenty: [], - firstOver1000: undefined - }; - - function isHarshad(n) { +function isHarshadOrNiven(n) { + function isHarshad(num) { let s = 0; - const nStr = n.toString(); + const nStr = num.toString(); for (let i = 0; i < nStr.length; ++i) { s += parseInt(nStr.charAt(i), 10); } return n % s === 0; } + const res = []; let count = 0; - const harshads = []; - for (let n = 1; count < 20; ++n) { + while (count < 10) { + n++; if (isHarshad(n)) { count++; - harshads.push(n); + res.push(n); } } - res.firstTwenty = harshads; - - let h = 1000; - while (!isHarshad(++h)); - res.firstOver1000 = h; - return res; } ``` diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/josephus-problem.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/josephus-problem.md index 93d7f7876b..6e8314e204 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/josephus-problem.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/josephus-problem.md @@ -42,34 +42,34 @@ assert(typeof josephus == 'function'); assert(typeof josephus(30, 3) == 'number'); ``` -`josephus(30,3)` should return `29`. +`josephus(30,3)` should return `28`. ```js -assert.equal(josephus(30, 3), 29); +assert.equal(josephus(30, 3), 28); ``` -`josephus(30,5)` should return `3`. +`josephus(30,5)` should return `2`. ```js -assert.equal(josephus(30, 5), 3); +assert.equal(josephus(30, 5), 2); ``` -`josephus(20,2)` should return `9`. +`josephus(20,2)` should return `8`. ```js -assert.equal(josephus(20, 2), 9); +assert.equal(josephus(20, 2), 8); ``` -`josephus(17,6)` should return `2`. +`josephus(17,6)` should return `1`. ```js -assert.equal(josephus(17, 6), 2); +assert.equal(josephus(17, 6), 1); ``` -`josephus(29,4)` should return `2`. +`josephus(29,4)` should return `1`. ```js -assert.equal(josephus(29, 4), 2); +assert.equal(josephus(29, 4), 1); ``` # --seed-- @@ -86,36 +86,13 @@ function josephus(init, kill) { ```js function josephus(init, kill) { - var Josephus = { - init: function(n) { - this.head = {}; - var current = this.head; - for (var i = 0; i < n - 1; i++) { - current.label = i + 1; - current.next = { - prev: current - }; - current = current.next; - } - current.label = n; - current.next = this.head; - this.head.prev = current; - return this; - }, - kill: function(spacing) { - var current = this.head; - while (current.next !== current) { - for (var i = 0; i < spacing - 1; i++) { - current = current.next; - } - current.prev.next = current.next; - current.next.prev = current.prev; - current = current.next; - } - return current.label; - } + const arr = Array.from(Array(init).keys()); + let curr = -1 + while (arr.length > 1) { + curr = (curr + kill) % arr.length; + arr.splice(curr, 1); + curr--; } - - return Josephus.init(init).kill(kill) + return arr[0]; } ``` diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/knapsack-problem-unbounded.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/knapsack-problem-unbounded.md index 8cf4a2a372..74e1ad8916 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/knapsack-problem-unbounded.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/knapsack-problem-unbounded.md @@ -73,7 +73,7 @@ assert.equal( ); ``` -`knapsackUnbounded([{ name:"panacea", value:3000, weight:0.3, volume:0.025 }, { name:"ichor", value:1800, weight:0.2, volume:0.015 }, { name:"gold", value:2500, weight:2, volume:0.002 }], 35, 0.35)` should return `75300`. +`knapsackUnbounded([{ name:"panacea", value:3000, weight:0.3, volume:0.025 }, { name:"ichor", value:1800, weight:0.2, volume:0.015 }, { name:"gold", value:2500, weight:2, volume:0.002 }], 35, 0.35)` should return `75900`. ```js assert.equal( @@ -86,7 +86,7 @@ assert.equal( 35, 0.35 ), - 75300 + 75900 ); ``` @@ -120,36 +120,66 @@ function knapsackUnbounded(items, maxweight, maxvolume) { # --solutions-- ```js -function knapsackUnbounded(items, maxweight, maxvolume) { - var n = items.length; - var best_value = 0; - var count = new Array(n); - var best = new Array(n); - function recurseKnapsack(i, value, weight, volume) { - var j, m1, m2, m; - if (i == n) { - if (value > best_value) { - best_value = value; - for (j = 0; j < n; j++) { - best[j] = count[j]; - } - } - return; +function knapsackUnbounded(items, maxWeight, maxVolume) { + function getPickTotals(items, pick) { + let totalValue = 0; + let totalWeight = 0; + let totalVolume = 0; + for (let i = 0; i < items.length; i++) { + totalValue += pick[i] * items[i].value; + totalWeight += pick[i] * items[i].weight; + totalVolume += pick[i] * items[i].volume; } - m1 = Math.floor(weight / items[i].weight); - m2 = Math.floor(volume / items[i].volume); - m = m1 < m2 ? m1 : m2; - for (count[i] = m; count[i] >= 0; count[i]--) { - recurseKnapsack( - i + 1, - value + count[i] * items[i].value, - weight - count[i] * items[i].weight, - volume - count[i] * items[i].volume - ); + return [totalValue, totalWeight, totalVolume]; + } + + function getMaxes(items, maxWeight, maxVolume) { + const maxes = []; + for (let i = 0; i < items.length; i++) { + const maxUnitsInWeight = Math.floor(maxWeight / items[i].weight); + const maxUnitsInVolume = Math.floor(maxVolume / items[i].volume); + const maxUnitsInLimit = Math.min(maxUnitsInWeight, maxUnitsInVolume); + maxes.push(maxUnitsInLimit); + } + return maxes; + } + + function isInLimit(value, limit) { + return value <= limit; + } + + function getCombinations(maxValues, curPicks, combinations) { + if (maxValues.length === 0) { + combinations.push(curPicks); + } + + const curMax = maxValues[0]; + const leftMaxValues = maxValues.slice(1); + for (let i = 0; i <= curMax; i++) { + getCombinations(leftMaxValues, curPicks.concat(i), combinations); + } + return combinations; + } + + let bestValue = 0; + let bestPick = []; + const maxes = getMaxes(items, maxWeight, maxVolume); + const combinations = getCombinations(maxes, [], []); + for (let i = 0; i < combinations.length; i++) { + const curPick = combinations[i]; + const [curValue, curWeight, curVolume] = getPickTotals(items, curPick); + if (!isInLimit(curWeight, maxWeight) || !isInLimit(curVolume, maxVolume)) { + continue; + } + + if (curValue > bestValue) { + bestValue = curValue; + bestPick = [curPick]; + } else if (curValue === bestValue) { + bestPick.push(curPick); } } - recurseKnapsack(0, 0, maxweight, maxvolume); - return best_value; + return bestValue; } ``` diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/knights-tour.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/knights-tour.md index 8551529445..c7a4b0693d 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/knights-tour.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/knights-tour.md @@ -8,7 +8,7 @@ dashedName: knights-tour # --description-- -[Knight's Tour](https://en.wikipedia.org/wiki/Knight%27s_tour)Problem: You have an empty `w` \* `h` chessboard, but for a single knight on some square. The knight must perform a sequence of legal moves that result in the knight visiting every square on the chessboard exactly once. Note that it is *not* a requirement that the tour be "closed"; that is, the knight need not end within a single move of its start position. +[Knight's Tour](https://en.wikipedia.org/wiki/Knight%27s_tour) Problem: You have an empty `w` \* `h` chessboard, but for a single knight on some square. The knight must perform a sequence of legal moves that result in the knight visiting every square on the chessboard exactly once. Note that it is *not* a requirement that the tour be "closed"; that is, the knight need not end within a single move of its start position. # --instructions-- @@ -28,34 +28,34 @@ assert(typeof knightTour == 'function'); assert(typeof knightTour(6, 6) == 'number'); ``` -`knightTour(6, 6)` should return `35`. +`knightTour(6, 6)` should return `36`. ```js -assert.equal(knightTour(6, 6), 35); +assert.equal(knightTour(6, 6), 36); ``` -`knightTour(5, 6)` should return `20`. +`knightTour(5, 6)` should return `30`. ```js -assert.equal(knightTour(5, 6), 20); +assert.equal(knightTour(5, 6), 30); ``` -`knightTour(4, 6)` should return `10`. +`knightTour(4, 6)` should return `12`. ```js -assert.equal(knightTour(4, 6), 10); +assert.equal(knightTour(4, 6), 12); ``` -`knightTour(7, 3)` should return `4`. +`knightTour(7, 3)` should return `10`. ```js -assert.equal(knightTour(7, 3), 4); +assert.equal(knightTour(7, 3), 10); ``` -`knightTour(8, 6)` should return `47`. +`knightTour(8, 6)` should return `48`. ```js -assert.equal(knightTour(8, 6), 47); +assert.equal(knightTour(8, 6), 48); ``` # --seed-- @@ -72,83 +72,154 @@ function knightTour(w, h) { ```js function knightTour(w, h) { - var b, - cnt = 0; - - var dx = [-2, -2, -1, 1, 2, 2, 1, -1]; - var dy = [-1, 1, 2, 2, 1, -1, -2, -2]; - - function init_board() { - var i, j, k, x, y; - // * b is board; a is board with 2 rows padded at each side - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - b[i][j] = 255; - } + function createBoards(rows, columns) { + const board = []; + const visited = []; + for (let i = 0; i < rows; i++) { + board.push(new Array(columns).fill(-1)); + visited.push(new Array(columns).fill(false)); } + return [board, visited]; + } - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - for (k = 0; k < 8; k++) { - (x = j + dx[k]), (y = i + dy[k]); - if (b[i][j] == 255) b[i][j] = 0; - if (x >= 0 && x < w && y >= 0 && y < h) b[i][j]++; - } + function copyBoard(board) { + const copied = []; + for (let i = 0; i < board.length; i++) { + copied.push([...board[i]]); + } + return copied; + } + + function isOnBoard(value, limit) { + return value >= 0 && value < limit; + } + + function markVisited(board, visited, row, column) { + visited[row][column] = true; + board[row][column] = -1; + } + + function areAllVisited(visited) { + return ( + visited.filter(row => row.filter(column => column === false).length !== 0) + .length === 0 + ); + } + + function getMovesFrom(board, row, column) { + const possibleMoves = []; + for (let i = 0; i < moves.length; i++) { + const [rowChange, colChange] = moves[i]; + const [rowN, colN] = [row + rowChange, column + colChange]; + if (!isOnBoard(rowN, board.length) || !isOnBoard(colN, board[0].length)) { + continue; + } + possibleMoves.push([rowN, colN]); + } + return possibleMoves; + } + + function fillAllowedMovesCounts(board) { + for (let row = 0; row < board.length; row++) { + for (let column = 0; column < board[0].length; column++) { + board[row][column] = getMovesFrom(board, row, column).length; } } } - function walk_board(x, y) { - var i, nx, ny, least; - var steps = 0; - // printf(E"H"E"J"E"%d;%dH"E"32m[]"E"m", y + 1, 1 + 2 * x); - - while (1) { - // * occupy cell - b[y][x] = 255; - - // * reduce all neighbors' neighbor count - for (i = 0; i < 8; i++) - if (y + dy[i] >= 0 && x + dx[i] >= 0 && y + dy[i] < h && x + dx[i] < w) - b[y + dy[i]][x + dx[i]]--; - - // find neighbor with lowest neighbor count - least = 255; - for (i = 0; i < 8; i++) { - if (y + dy[i] >= 0 && x + dx[i] >= 0 && y + dy[i] < h && x + dx[i] < w) - if (b[y + dy[i]][x + dx[i]] < least) { - nx = x + dx[i]; - ny = y + dy[i]; - least = b[ny][nx]; - } + function updateAllowedMovesCounts(board, possibleMoves) { + for (let i = 0; i < possibleMoves.length; i++) { + const [row, column] = possibleMoves[i]; + if (board[row][column] > 0) { + board[row][column]--; } + } + } - if (least > 7) { - return steps == w * h - 1; + function getBestNextMoves(board, allowedMoves) { + let bestMoves = []; + let fewestNextMoves = Infinity; + let zeroMove = []; + for (let i = 0; i < allowedMoves.length; i++) { + const [moveRow, moveCol] = allowedMoves[i]; + const numMoves = board[moveRow][moveCol]; + if (numMoves === -1) { + continue; + } + if (numMoves === 0) { + zeroMove.push(allowedMoves[i]); + } + if (numMoves < fewestNextMoves) { + bestMoves = [allowedMoves[i]]; + fewestNextMoves = numMoves; + } else if (numMoves === fewestNextMoves) { + bestMoves.push(allowedMoves[i]); } - - steps++; - (x = nx), (y = ny); } + + if (bestMoves.length > 0) { + return bestMoves; + } + return zeroMove; } - function solve(x, y) { - b = new Array(h); - for (var i = 0; i < h; i++) b[i] = new Array(w); - - init_board(); - if (walk_board(x, y)) { - cnt++; + function solve(board, visited, lastRow, lastColumn) { + if (areAllVisited(visited)) { + return true; } + const nextMoves = getMovesFrom(board, lastRow, lastColumn); + updateAllowedMovesCounts(board, nextMoves); + const allowedMoves = nextMoves.filter( + ([row, column]) => !visited[row][column] + ); + + const bestMoves = getBestNextMoves(board, allowedMoves); + const restMoves = allowedMoves.filter( + move => bestMoves.indexOf(move) === -1 + ); + const possibleMoves = [...bestMoves]; + possibleMoves.push(...getBestNextMoves(board, restMoves)); + + for (let i = 0; i < possibleMoves.length; i++) { + const [moveRow, moveCol] = possibleMoves[i]; + const newBoard = copyBoard(board); + const newVisited = copyBoard(visited); + markVisited(newBoard, newVisited, moveRow, moveCol); + if (solve(newBoard, newVisited, moveRow, moveCol)) { + return true; + } + } + return false; } - for (var i = 0; i < h; i++) { - for (var j = 0; j < w; j++) { - solve(j, i); - } + function solveStart(board, visited, startRow, startColumn) { + const newBoard = copyBoard(board); + const newVisited = copyBoard(visited); + markVisited(newBoard, newVisited, startRow, startColumn); + return solve(newBoard, newVisited, startRow, startColumn); } - return cnt; + const moves = [ + [-1, -2], + [-2, -1], + [-2, 1], + [-1, 2], + [1, 2], + [2, 1], + [2, -1], + [1, -2] + ]; + + const [baseBoard, baseVisited] = createBoards(h, w); + fillAllowedMovesCounts(baseBoard); + let solvedCount = 0; + for (let row = 0; row < h; row++) { + for (let column = 0; column < w; column++) { + if (solveStart(baseBoard, baseVisited, row, column)) { + solvedCount++; + } + } + } + return solvedCount; } ``` diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/letter-frequency.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/letter-frequency.md index a141607477..d7c0a30349 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/letter-frequency.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/letter-frequency.md @@ -34,7 +34,7 @@ assert(typeof letterFrequency == 'function'); assert(Array.isArray(letterFrequency('Not all that Mrs. Bennet, however'))); ``` -`letterFrequency("Not all that Mrs. Bennet, however")` should return `[[" ", 5], [", ", 1], [".", 1], ["B", 1], ["M", 1], ["N", 1], ["a", 2], ["e", 4], ["h", 2], ["l", 2], ["n", 2], ["o", 2], ["r", 2], ["s", 1], ["t", 4], ["v", 1], ["w", 1]]`. +`letterFrequency("Not all that Mrs. Bennet, however")` should return `[[" ", 5], [",", 1], [".", 1], ["B", 1], ["M", 1], ["N", 1], ["a", 2], ["e", 4], ["h", 2], ["l", 2], ["n", 2], ["o", 2], ["r", 2], ["s", 1], ["t", 4], ["v", 1], ["w", 1]]`. ```js assert.deepEqual(letterFrequency('Not all that Mrs. Bennet, however'), [ @@ -58,7 +58,7 @@ assert.deepEqual(letterFrequency('Not all that Mrs. Bennet, however'), [ ]); ``` -`letterFrequency("daughters, could ask on the ")` should return `[[' ',5],[',',1],['a',2],['c',1],['d',2],['e',2],['g',1],['h',2],['k',1],['l',1],['n',1],['o',2],['r',1],['s',2],['t',2],['u',2]]`. +`letterFrequency("daughters, could ask on the ")` should return `[[" ", 5],[",", 1],["a", 2],["c", 1],["d", 2],["e", 2],["g", 1],["h", 2],["k", 1],["l", 1],["n", 1],["o", 2],["r", 1],["s", 2],["t", 2],["u", 2]]`. ```js assert.deepEqual(letterFrequency('daughters, could ask on the '), [ @@ -131,7 +131,7 @@ assert.deepEqual(letterFrequency('in various ways--with barefaced'), [ ]); ``` -`letterFrequency("distant surmises; but he eluded")` should return `[[" ", 4], ["; ", 1], ["a", 1], ["b", 1], ["d", 3], ["e", 4], ["h", 1], ["i", 2], ["l", 1], ["m", 1], ["n", 1], ["r", 1], ["s", 4], ["t", 3], ["u", 3]]`. +`letterFrequency("distant surmises; but he eluded")` should return `[[" ", 4], [";", 1], ["a", 1], ["b", 1], ["d", 3], ["e", 4], ["h", 1], ["i", 2], ["l", 1], ["m", 1], ["n", 1], ["r", 1], ["s", 4], ["t", 3], ["u", 3]]`. ```js assert.deepEqual(letterFrequency('distant surmises; but he eluded'), [ @@ -153,7 +153,7 @@ assert.deepEqual(letterFrequency('distant surmises; but he eluded'), [ ]); ``` -`letterFrequency("last obliged to accept the second-hand,")` should return `[[" ", 5], [", ", 1], ["-", 1], ["a", 3], ["b", 1], ["c", 3], ["d", 3], ["e", 4], ["g", 1], ["h", 2], ["i", 1], ["l", 2], ["n", 2], ["o", 3], ["p", 1], ["s", 2], ["t", 4]]`. +`letterFrequency("last obliged to accept the second-hand,")` should return `[[" ", 5], [",", 1], ["-", 1], ["a", 3], ["b", 1], ["c", 3], ["d", 3], ["e", 4], ["g", 1], ["h", 2], ["i", 1], ["l", 2], ["n", 2], ["o", 3], ["p", 1], ["s", 2], ["t", 4]]`. ```js assert.deepEqual(letterFrequency('last obliged to accept the second-hand,'), [ diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/loop-over-multiple-arrays-simultaneously.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/loop-over-multiple-arrays-simultaneously.md index 7d168a3673..e8924ccd28 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/loop-over-multiple-arrays-simultaneously.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/loop-over-multiple-arrays-simultaneously.md @@ -12,11 +12,15 @@ Loop over multiple arrays and create a new array whose $i^{th}$ element is the c For this example, if you are given this array of arrays: -`[ ["a", "b", "c"], ["A", "B", "C"], [1, 2, 3] ]` +```js +[ ["a", "b", "c"], ["A", "B", "C"], [1, 2, 3] ] +``` the output should be: -`["aA1","bB2","cC3"]` +```js +["aA1","bB2","cC3"] +``` # --instructions-- diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/s-expressions.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/s-expressions.md index e7ed94741c..19304897ae 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/s-expressions.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/s-expressions.md @@ -22,9 +22,9 @@ Newlines and other whitespace may be ignored unless contained within a quoted st Handling escaped quotes inside a string is optional; thus "`(foo"bar)`" may be treated as a string "`foo"bar`", or as an error. -For this, the reader need not recognize "\\" for escaping, but should, in addition, recognize numbers if the language has appropriate data types. +For this, the reader need not recognize `\` for escaping, but should, in addition, recognize numbers if the language has appropriate data types. -Note that with the exception of "`()"`" ("\\" if escaping is supported) and whitespace there are no special characters. Anything else is allowed without quotes. +Note that with the exception of `()"` (`\` if escaping is supported) and whitespace, there are no special characters. Anything else is allowed without quotes. The reader should be able to read the following input @@ -48,7 +48,7 @@ assert(typeof parseSexpr === 'function'); assert.deepEqual(parseSexpr(simpleSExpr), simpleSolution); ``` -`parseSexpr('(data1 data2 data3)')` should return an array with 3 elements. +`parseSexpr('((data "quoted data" 123 4.5) (data (!@# (4.5) "(more" "data)")))')` should return `[['data', '"quoted data"', 123, 4.5], ['data', ['!@#', [4.5], '"(more"', '"data)"']]]`. ```js assert.deepEqual(parseSexpr(basicSExpr), basicSolution); diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sha-256.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sha-256.md index 83c7fccde3..9ce0ca4260 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sha-256.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sha-256.md @@ -8,11 +8,11 @@ dashedName: sha-256 # --description-- -**[SHA-256](https://en.wikipedia.org/wiki/SHA-256)** is the recommended stronger alternative to [SHA-1](https://rosettacode.org/wiki/SHA-1). +The `SHA-2` family is a stronger alternative to `SHA-1`. The main difference between them is the length of the hash. Meaning `SHA-1` provides a shorter code with fewer possibilities for unique combinations. `SHA-2` or `SHA-256` creates a longer and thus more complex hash with more possibilities. # --instructions-- -Write a function that takes a string as a parameter and returns its SHA-256 digest. +Research implemenation details and write a function that takes a string as the parameter and returns a hash using `SHA-256` # --hints-- diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sort-disjoint-sublist.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sort-disjoint-sublist.md index 60e2ee0923..b6647f2824 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sort-disjoint-sublist.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sort-disjoint-sublist.md @@ -14,7 +14,9 @@ Make your function work with the following list of values and set of indices: values: [7, 6, 5, 4, 3, 2, 1, 0] -`indices(0-based): {6, 1, 7}` +```js +indices(0-based): {6, 1, 7} +``` Where the correct result would be: diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/split-a-character-string-based-on-change-of-character.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/split-a-character-string-based-on-change-of-character.md index 0f7bbb37b7..4bb28fba9a 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/split-a-character-string-based-on-change-of-character.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/split-a-character-string-based-on-change-of-character.md @@ -11,13 +11,13 @@ dashedName: split-a-character-string-based-on-change-of-character Split a (character) string into comma (plus a blank) delimited strings based on a change of character (left to right). Blanks should be treated as any other character (except they are problematic to display clearly). The same applies to commas. For instance, the string:
-"gHHH5YY++///\"
+"gHHH5YY++///\\"
 
should be split as:
-["g", "HHH", "5", "YY", "++", "///", "\" ];
+["g", "HHH", "5", "YY", "++", "///", "\\" ];
 
# --hints-- @@ -80,7 +80,7 @@ assert.deepEqual(split('sssmmmaaammmaaat'), [ ]); ``` -`split("gHHH5YY++///\")` should return `["g", "HHH", "5", "YY", "++", "///", "\\"]`. +`split("gHHH5YY++///\\")` should return `["g", "HHH", "5", "YY", "++", "///", "\\"]`. ```js assert.deepEqual(split('gHHH5YY++///\\'), [ diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sudoku.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sudoku.md index ccf9143f28..e0f6864a89 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sudoku.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sudoku.md @@ -8,7 +8,7 @@ dashedName: sudoku # --description-- -Write a function to solve a partially filled-in normal 9x9 [Sudoku](https://en.wikipedia.org/wiki/Sudoku) grid and return the result. The blank fields are represented by 0s. [Algorithmics of Sudoku](https://en.wikipedia.org/wiki/Algorithmics_of_sudoku) may help implement this. +Write a function to solve a partially filled-in normal 9x9 [Sudoku](https://en.wikipedia.org/wiki/Sudoku) grid and return the result. The blank fields are represented by `-1`. [Algorithmics of Sudoku](https://en.wikipedia.org/wiki/Algorithmics_of_sudoku) may help implement this. # --hints-- diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sum-of-a-series.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sum-of-a-series.md index 35fee31774..6ffa6d152f 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sum-of-a-series.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sum-of-a-series.md @@ -8,7 +8,7 @@ dashedName: sum-of-a-series # --description-- -Compute the **n**th term of a [series](https://en.wikipedia.org/wiki/Series (mathematics)), i.e. the sum of the **n** first terms of the corresponding [sequence](https://en.wikipedia.org/wiki/sequence). Informally this value, or its limit when **n** tends to infinity, is also called the *sum of the series*, thus the title of this task. For this task, use: $S*n = \\sum*{k=1}^n \\frac{1}{k^2}$ and compute $S\_{1000}$ This approximates the [zeta function](https://en.wikipedia.org/wiki/Riemann zeta function) for S=2, whose exact value $\\zeta(2) = {\\pi^2\\over 6}$ is the solution of the [Basel problem](https://en.wikipedia.org/wiki/Basel problem). +Compute the **n**th term of a [series](https://en.wikipedia.org/wiki/Series (mathematics)), i.e. the sum of the **n** first terms of the corresponding [sequence](https://en.wikipedia.org/wiki/sequence). Informally this value, or its limit when **n** tends to infinity, is also called the *sum of the series*, thus the title of this task. For this task, use: $S_n = \displaystyle\sum_{k=1}^n \frac{1}{k^2}$. # --instructions-- diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sum-to-100.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sum-to-100.md index 1cd0f58a71..f30b422ba8 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sum-to-100.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/sum-to-100.md @@ -60,16 +60,6 @@ assert.deepEqual(sumTo100(243), [ ]); ``` -`sumTo100(199)` should return `["-1+2-3+45+67+89", "123-4+5+6+78-9", "123-4+56+7+8+9"]`. - -```js -assert.deepEqual(sumTo100(199), [ - '-1+2-3+45+67+89', - '123-4+5+6+78-9', - '123-4+56+7+8+9' -]); -``` - `sumTo100(197)` should return `["1-2-3+45+67+89", "12+34-5+67+89", "123+4-5+6+78-9"]`. ```js diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/top-rank-per-group.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/top-rank-per-group.md index c9405c8f3f..56cd284379 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/top-rank-per-group.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/top-rank-per-group.md @@ -12,7 +12,8 @@ Find the top `n` ranked data in each group, where `n` is provided as a parameter Given the following data: -
[
+```js
+testData1 = [
   { name: 'Tyler Bennett', id: 'E10297', salary: 32000, dept: 'D101' },
   { name: 'John Rappl', id: 'E21437', salary: 47000, dept: 'D050' },
   { name: 'George Woltman', id: 'E00127', salary: 53500, dept: 'D101' },
@@ -27,29 +28,56 @@ Given the following data:
   { name: 'Kim Arlich', id: 'E10001', salary: 57000, dept: 'D190' },
   { name: 'Timothy Grove', id: 'E16398', salary: 29900, dept: 'D190' }
 ];
-
+``` -one could rank top 10 employees in each department by calling +One could rank top 10 employees in each department by calling: -`topRankPerGroup(10, data, 'dept', 'salary')` +```js +topRankPerGroup(10, testData1, 'dept', 'salary') +``` Given the following data: -
[
+```js
+testData2 = [
   { name: 'Friday 13th', genre: 'horror', rating: 9.9 },
   { name: "Nightmare on Elm's Street", genre: 'horror', rating: 5.7 },
   { name: 'Titanic', genre: 'drama', rating: 7.3 },
   { name: 'Maze Runner', genre: 'scifi', rating: 7.1 },
   { name: 'Blade runner', genre: 'scifi', rating: 8.9 }
 ];
-
+``` -one could rank the top-rated movie in each genre by calling +One could rank the top-rated movie in each genre by calling: -`topRankPerGroup(1, data, 'genre', 'rating')` +```js +topRankPerGroup(1, testData2, 'genre', 'rating') +``` The function should return an array with an array for each group containing the top `n` objects. +For example, given data: + +```js +[ + { name: 'Claire Buckman', id: 'E39876', salary: 27800, dept: 'D101' }, + { name: 'Rich Holcomb', id: 'E01234', salary: 49500, dept: 'D050' }, + { name: 'David Motsinger', id: 'E27002', salary: 19250, dept: 'D050' }, + { name: 'Tim Sampair', id: 'E03033', salary: 27000, dept: 'D101' }, + { name: 'Kim Arlich', id: 'E10001', salary: 57000, dept: 'D050' }, + { name: 'Timothy Grove', id: 'E16398', salary: 29900, dept: 'D101' } +]; +``` + +Top two ranking employees in each department by salary would be: + +```js +[ [ { name: 'Kim Arlich', id: 'E10001', salary: 57000, dept: 'D050' }, + { name: 'Rich Holcomb', id: 'E01234', salary: 49500, dept: 'D050' } ], + [ { name: 'Timothy Grove', id: 'E16398', salary: 29900, dept: 'D101' }, + { name: 'Claire Buckman', id: 'E39876', salary: 27800, dept: 'D101' } ] ] +``` + # --hints-- `topRankPerGroup` should be a function. @@ -64,22 +92,16 @@ assert(typeof topRankPerGroup === 'function'); assert(typeof topRankPerGroup(-1, []) === 'undefined'); ``` -First department should be D050 +For `topRankPerGroup(10, testData1, 'dept', 'salary')`, the first result in the first group should be `{ name: 'John Rappl', id: 'E21437', salary: 47000, dept: 'D050'}`. ```js -assert.equal(res1[0][0].dept, 'D050'); +assert.deepEqual(res1[0][0], { name: 'John Rappl', id: 'E21437', salary: 47000, dept: 'D050'}); ``` -First department should be D050 +For `topRankPerGroup(10, testData1, 'dept', 'salary')`, the last result in the last group should be `{ name: 'Adam Smith', id: 'E63535', salary: 18000, dept: 'D202' }`. ```js -assert.equal(res1[0][1].salary, 21900); -``` - -The last department should be D202 - -```js -assert.equal(res1[3][3].dept, 'D202'); +assert.deepEqual(res1[3][3], { name: 'Adam Smith', id: 'E63535', salary: 18000, dept: 'D202' }); ``` `topRankPerGroup(1, ...)` should return only top ranking result per group. @@ -88,7 +110,7 @@ assert.equal(res1[3][3].dept, 'D202'); assert.equal(res2[2].length, 1); ``` -`topRankPerGroup(1, ...)` should return only top ranking result per group. +`topRankPerGroup(2, ...)` should return two ranking results per group. ```js assert.equal(res3[2][1].name, 'Maze Runner'); diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/topological-sort.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/topological-sort.md index 1f091c8bf9..f57d218e66 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/topological-sort.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/topological-sort.md @@ -8,19 +8,19 @@ dashedName: topological-sort # --description-- -Given a mapping between items, and items they depend on, a [topological sort](https://en.wikipedia.org/wiki/Topological sorting "wp: Topological sorting") orders items so that no item precedes an item it depends upon. The compiling of a library in the [VHDL](https://en.wikipedia.org/wiki/VHDL "wp: VHDL") language has the constraint that a library must be compiled after any library it depends on. +Given a mapping between items, and items they depend on, a topological sort orders items so that no item precedes an item it depends upon. There are two popular algorithms for topological sorting: Kahn's (1962) topological sort and depth-first search. # --instructions-- -Write a function that will return a valid compile order of VHDL libraries from their dependencies. +Write a function that will return a list with valid compile order of libraries from their dependencies. + +- Assume library names are single words. +- Items mentioned as only dependents have no dependents of their own, but their order of compiling must be given. +- Any self dependencies should be ignored. +- Any un-orderable dependencies should be ignored. -
    -
  • Assume library names are single words.
  • -
  • Items mentioned as only dependents have no dependents of their own, but their order of compiling must be given.
  • -
  • Any self dependencies should be ignored.
  • -
  • Any un-orderable dependencies should be ignored.
  • -
Use the following data as an example: +
 LIBRARY          LIBRARY DEPENDENCIES
 =======          ====================
@@ -38,16 +38,18 @@ ramlib           std ieee
 std_cell_lib     ieee std_cell_lib
 synopsys
 
-Note: the above data would be un-orderable if, for example, dw04 is added to the list of dependencies of dw01. -C.f.: - -There are two popular algorithms for topological sorting: - + +The compiling of a library in the VHDL language has the constraint that a library must be compiled after any library it depends on. The above data would be un-orderable if, for example, `dw04` is added to the list of dependencies of `dw01`. + +The input of the function will be a multiline string, each line will consist of the name of the library, followed by its dependencies (if exist). + +For example: + +```js +const libsSimple = + `aaa bbb + bbb`; +``` # --hints-- @@ -57,28 +59,34 @@ There are two popular algorithms for topological sorting: assert(typeof topologicalSort === 'function'); ``` -`topologicalSort` should return correct library order. +`topologicalSort(libsSimple)` should return an array. + +```js +assert(Array.isArray(topologicalSort(libsSimple))); +``` + +`topologicalSort(libsSimple)` should return `['bbb', 'aaa']`. ```js assert.deepEqual(topologicalSort(libsSimple), ['bbb', 'aaa']); ``` -`topologicalSort` should return correct library order. +`topologicalSort(libsVHDL)` should return `['ieee', 'std_cell_lib', 'gtech', 'dware', 'dw07', 'dw06', 'dw05', 'dw02', 'dw01', 'dw04', 'std', 'ramlib', 'synopsys', 'dw03', 'des_system_lib']`. ```js -assert.deepEqual(topologicalSort(libsVHDL), solutionVHDL); +assert.deepEqual(topologicalSort(libsVHDL), ['ieee', 'std_cell_lib', 'gtech', 'dware', 'dw07', 'dw06', 'dw05', 'dw02', 'dw01', 'dw04', 'std', 'ramlib', 'synopsys', 'dw03', 'des_system_lib']); ``` -`topologicalSort` should return correct library order. +`topologicalSort(libsCustom)` should return `['base', 'c', 'd', 'b', 'a']`. ```js -assert.deepEqual(topologicalSort(libsCustom), solutionCustom); +assert.deepEqual(topologicalSort(libsCustom), ['base', 'c', 'd', 'b', 'a']); ``` `topologicalSort` should ignore unorderable dependencies. ```js -assert.deepEqual(topologicalSort(libsUnorderable), solutionUnorderable); +assert.deepEqual(topologicalSort(libsUnorderable), ['Base']); ``` # --seed-- @@ -105,26 +113,17 @@ const libsVHDL = std_cell_lib ieee std_cell_lib synopsys`; -const solutionVHDL = [ - 'ieee', 'std_cell_lib', 'gtech', 'dware', 'dw07', 'dw06', - 'dw05', 'dw02', 'dw01', 'dw04', 'std', 'ramlib', 'synopsys', - 'dw03', 'des_system_lib' -]; - const libsCustom = `a b c d b c d d c c base base`; -const solutionCustom = ['base', 'c', 'd', 'b', 'a']; const libsUnorderable = `TestLib Base MainLib MainLib TestLib Base`; - -const solutionUnorderable = ['Base']; ``` ## --seed-contents-- diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/vector-cross-product.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/vector-cross-product.md index b7a9d18be1..4dab99b445 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/vector-cross-product.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/vector-cross-product.md @@ -16,19 +16,19 @@ Write a function that takes two vectors (arrays) as input and computes their cro # --hints-- -dotProduct should be a function. +`crossProduct` should be a function. ```js assert.equal(typeof crossProduct, 'function'); ``` -dotProduct() should return null. +`crossProduct()` should return null. ```js assert.equal(crossProduct(), null); ``` -crossProduct([1, 2, 3], [4, 5, 6]) should return [-3, 6, -3]. +`crossProduct([1, 2, 3], [4, 5, 6])` should return `[-3, 6, -3]`. ```js assert.deepEqual(res12, exp12); diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/zeckendorf-number-representation.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/zeckendorf-number-representation.md index 35c7529bc4..7794021986 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/zeckendorf-number-representation.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/zeckendorf-number-representation.md @@ -14,42 +14,145 @@ The decimal number eleven can be written as `0*13 + 1*8 + 0*5 + 1*3 + 0*2 + 0*1` # --instructions-- -Write a function that generates and returns an array of the first `n` Zeckendorf numbers in order. +Write a function that generates and returns the Zeckendorf number representation of `n`. # --hints-- -zeckendorf should be function. +`zeckendorf` should be a function. ```js assert.equal(typeof zeckendorf, 'function'); ``` -Your `zeckendorf` function should return the correct answer. +`zeckendorf(0)` should return `0`. ```js -assert.deepEqual(answer, solution20); +assert.equal(zeckendorf(0), 0); + +``` + +`zeckendorf(1)` should return `1`. + +```js +assert.equal(zeckendorf(1), 1); +``` + +`zeckendorf(2)` should return `10`. + +```js +assert.equal(zeckendorf(2), 10); +``` + +`zeckendorf(3)` should return `100`. + +```js +assert.equal(zeckendorf(3), 100); +``` + +`zeckendorf(4)` should return `101`. + +```js +assert.equal(zeckendorf(4), 101); +``` + +`zeckendorf(5)` should return `1000`. + +```js +assert.equal(zeckendorf(5), 1000); +``` + +`zeckendorf(6)` should return `1001`. + +```js +assert.equal(zeckendorf(6), 1001); +``` + +`zeckendorf(7)` should return `1010`. + +```js +assert.equal(zeckendorf(7), 1010); +``` + +`zeckendorf(8)` should return `10000`. + +```js +assert.equal(zeckendorf(8), 10000); +``` + +`zeckendorf(9)` should return `10001`. + +```js +assert.equal(zeckendorf(9), 10001); +``` + +`zeckendorf(10)` should return `10010`. + +```js +assert.equal(zeckendorf(10), 10010); +``` + +`zeckendorf(11)` should return `10100`. + +```js +assert.equal(zeckendorf(11), 10100); +``` + +`zeckendorf(12)` should return `10101`. + +```js +assert.equal(zeckendorf(12), 10101); +``` + +`zeckendorf(13)` should return `100000`. + +```js +assert.equal(zeckendorf(13), 100000); +``` + +`zeckendorf(14)` should return `100001`. + +```js +assert.equal(zeckendorf(14), 100001); +``` + +`zeckendorf(15)` should return `100010`. + +```js +assert.equal(zeckendorf(15), 100010); +``` + +`zeckendorf(16)` should return `100100`. + +```js +assert.equal(zeckendorf(16), 100100); +``` + +`zeckendorf(17)` should return `100101`. + +```js +assert.equal(zeckendorf(17), 100101); +``` + +`zeckendorf(18)` should return `101000`. + +```js +assert.equal(zeckendorf(18), 101000); +``` + +`zeckendorf(19)` should return `101001`. + +```js +assert.equal(zeckendorf(19), 101001); +``` + +`zeckendorf(20)` should return `101010`. + +```js +assert.equal(zeckendorf(20), 101010); ``` # --seed-- -## --after-user-code-- - -```js -const range = (m, n) => ( - Array.from({ - length: Math.floor(n - m) + 1 - }, (_, i) => m + i) -); - -const solution20 = [ - '1', '10', '100', '101', '1000', '1001', '1010', '10000', '10001', - '10010', '10100', '10101', '100000', '100001', '100010', '100100', '100101', - '101000', '101001', '101010' -]; - -const answer = range(1, 20).map(zeckendorf); -``` - ## --seed-contents-- ```js @@ -61,13 +164,13 @@ function zeckendorf(n) { # --solutions-- ```js -// zeckendorf :: Int -> String +// zeckendorf :: Int -> Int function zeckendorf(n) { const f = (m, x) => (m < x ? [m, 0] : [m - x, 1]); - return (n === 0 ? ([0]) : + return parseInt((n === 0 ? ([0]) : mapAccumL(f, n, reverse( tail(fibUntil(n)) - ))[1]).join(''); + ))[1]).join('')); } // fibUntil :: Int -> [Int] diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md index bad53c8710..d3970f2f72 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md @@ -10,87 +10,68 @@ dashedName: zhang-suen-thinning-algorithm This is an algorithm used to thin a black and white i.e. one bit per pixel images. For example, with an input image of: - - -
- #################                   #############
- ##################               ################
- ###################            ##################
- ########     #######          ###################
-   ######     #######         #######       ######
-   ######     #######        #######
-   #################         #######
-   ################          #######
-   #################         #######
-   ######     #######        #######
-   ######     #######        #######
-   ######     #######         #######       ######
- ########     #######          ###################
- ########     ####### ######    ################## ######
- ########     ####### ######      ################ ######
- ########     ####### ######         ############# ######
-
+```js +const testImage1 = [ + ' ', + '######### ######## ', + '### #### #### #### ', + '### ### ### ### ', + '### #### ### ', + '######### ### ', + '### #### ### ### ', + '### #### ### #### #### ### ', + '### #### ### ######## ### ', + ' ' +]; +``` It produces the thinned output: -
+```js
+[ '                               ',
+  '########         ######        ',
+  '#      #        ##             ',
+  '#       #       #              ',
+  '#      #        #              ',
+  '###### #        #              ',
+  '#     ##        #              ',
+  '#      #    #   ##    ##   #   ',
+  '#       #         ####         ',
+  '                               ' ];
+```
 
-    # ##########                       #######
-     ##        #                   ####       #
-     #          #                 ##
-     #          #                #
-     #          #                #
-     #          #                #
-     ############               #
-     #          #               #
-     #          #                #
-     #          #                #
-     #          #                #
-     #                            ##
-     #                             ############
-                       ###                          ###
-
-
- -

Algorithm

+## Algorithm Assume black pixels are one and white pixels zero, and that the input image is a rectangular N by M array of ones and zeroes. The algorithm operates on all black pixels P1 that can have eight neighbours. The neighbours are, in order, arranged as: - - - - -
P9P2P3
P8P1P4
P7P6P5
+$$\begin{array}{|c|c|c|} \\hline P9 & P2 & P3\\\\ \\hline P8 & \boldsymbol{P1} & P4\\\\ \\hline P7 & P6 & P5\\\\ \\hline \end{array}$$ Obviously the boundary pixels of the image cannot have the full eight neighbours. -
    -
  • Define $A(P1)$ = the number of transitions from white to black, (0 -> 1) in the sequence P2, P3, P4, P5, P6, P7, P8, P9, P2. (Note the extra P2 at the end - it is circular).
  • -
  • Define $B(P1)$ = the number of black pixel neighbours of P1. ( = sum(P2 .. P9) )
  • -
+- Define $A(P1)$ = the number of transitions from white to black, ($0 \to 1$) in the sequence P2, P3, P4, P5, P6, P7, P8, P9, P2. (Note the extra P2 at the end - it is circular). +- Define $B(P1)$ = the number of black pixel neighbours of P1. ($= \\sum(P2 \ldots P9)$) **Step 1:** -All pixels are tested and pixels satisfying all the following conditions (simultaneously) are just noted at this stage.
    -
  1. The pixel is black and has eight neighbours
  2. -
  3. $2 <= B(P1) <= 6$
  4. -
  5. $A(P1) = 1$
  6. -
  7. At least one of P2, P4 and P6 is white
  8. -
  9. At least one of P4, P6 and P8 is white
  10. -
+All pixels are tested and pixels satisfying all the following conditions (simultaneously) are just noted at this stage. + +1. The pixel is black and has eight neighbours +2. $2 \le B(P1) \le 6$ +3. $A(P1) = 1$ +4. At least one of $P2$, $P4$ and $P6$ is white +5. At least one of $P4$, $P6$ and $P8$ is white After iterating over the image and collecting all the pixels satisfying all step 1 conditions, all these condition satisfying pixels are set to white. **Step 2:** -All pixels are again tested and pixels satisfying all the following conditions are just noted at this stage.
    -
  1. The pixel is black and has eight neighbours
  2. -
  3. $2 <= B(P1) <= 6$
  4. -
  5. $A(P1) = 1$
  6. -
  7. At least one of P2, P4 and P8 is white
  8. -
  9. At least one of P2, P6 and P8 is white
  10. -
+All pixels are again tested and pixels satisfying all the following conditions are just noted at this stage. + +1. The pixel is black and has eight neighbours +2. $2 \le B(P1) \le 6$ +3. $A(P1) = 1$ +4. At least one of $P2$, $P4$ and $P8$ is white +5. At least one of $P2$, $P6$ and $P8$ is white After iterating over the image and collecting all the pixels satisfying all step 2 conditions, all these condition satisfying pixels are again set to white. @@ -100,7 +81,7 @@ If any pixels were set in this round of either step 1 or step 2 then all steps a # --instructions-- -Write a routine to perform Zhang-Suen thinning on the provided image matrix. +Write a routine to perform Zhang-Suen thinning on the provided `image`, an array of strings, where each string represents single line of the image. In the string, `#` represents black pixel, and whitespace represents white pixel. Function should return thinned image, using the same representation. # --hints-- @@ -113,19 +94,25 @@ assert.equal(typeof thinImage, 'function'); `thinImage` should return an array. ```js -assert(Array.isArray(result)); +assert(Array.isArray(thinImage(_testImage1))); ``` `thinImage` should return an array of strings. ```js -assert.equal(typeof result[0], 'string'); +assert.equal(typeof thinImage(_testImage1)[0], 'string'); ``` -`thinImage` should return an array of strings. +`thinImage(testImage1)` should return a thinned image as in the example. ```js -assert.deepEqual(result, expected); +assert.deepEqual(thinImage(_testImage1), expected1); +``` + +`thinImage(testImage2)` should return a thinned image. + +```js +assert.deepEqual(thinImage(_testImage2), expected2); ``` # --seed-- @@ -133,7 +120,31 @@ assert.deepEqual(result, expected); ## --after-user-code-- ```js -const imageForTests = [ +const _testImage1 = [ + ' ', + '######### ######## ', + '### #### #### #### ', + '### ### ### ### ', + '### #### ### ', + '######### ### ', + '### #### ### ### ', + '### #### ### #### #### ### ', + '### #### ### ######## ### ', + ' ' +]; +const expected1 = [ + ' ', + '######## ###### ', + '# # ## ', + '# # # ', + '# # # ', + '###### # # ', + '# ## # ', + '# # # ## ## # ', + '# # #### ', + ' ' +]; +const _testImage2 = [ ' ', ' ################# ############# ', ' ################## ################ ', @@ -152,7 +163,7 @@ const imageForTests = [ ' ######## ####### ###### ################ ###### ', ' ######## ####### ###### ############# ###### ', ' ']; -const expected = [ +const expected2 = [ ' ', ' ', ' # ########## ####### ', @@ -172,35 +183,27 @@ const expected = [ ' ', ' ' ]; -const result = thinImage(imageForTests); ``` ## --seed-contents-- ```js -const testImage = [ - ' ', - ' ################# ############# ', - ' ################## ################ ', - ' ################### ################## ', - ' ######## ####### ################### ', - ' ###### ####### ####### ###### ', - ' ###### ####### ####### ', - ' ################# ####### ', - ' ################ ####### ', - ' ################# ####### ', - ' ###### ####### ####### ', - ' ###### ####### ####### ', - ' ###### ####### ####### ###### ', - ' ######## ####### ################### ', - ' ######## ####### ###### ################## ###### ', - ' ######## ####### ###### ################ ###### ', - ' ######## ####### ###### ############# ###### ', - ' ']; - function thinImage(image) { } + +const testImage1 = [ + ' ', + '######### ######## ', + '### #### #### #### ', + '### ### ### ### ', + '### #### ### ', + '######### ### ', + '### #### ### ### ', + '### #### ### #### #### ### ', + '### #### ### ######## ### ', + ' ' +]; ``` # --solutions-- diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/build-a-pinterest-clone.md b/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/build-a-pinterest-clone.md index 0cf1a3d2f7..bd190875b3 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/build-a-pinterest-clone.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/build-a-pinterest-clone.md @@ -8,7 +8,7 @@ dashedName: build-a-pinterest-clone # --description-- -**Objective:** Build a [Repl.it](https://repl.it/) app that is functionally similar to this: . +**Objective:** Build a [Replit](https://replit.com/) app that is functionally similar to this: . Fulfill the below [user stories](https://en.wikipedia.org/wiki/User_story). Use whichever libraries or APIs you need. Give it your own personal style. diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/build-a-simon-game.md b/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/build-a-simon-game.md index 9de29f1566..5bc458abb1 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/build-a-simon-game.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/build-a-simon-game.md @@ -8,7 +8,7 @@ dashedName: build-a-simon-game # --description-- -**Objective:** Build a [CodePen.io](https://codepen.io) app that is functionally similar to this: [https://codepen.io/freeCodeCamp/full/obYBjE](https://codepen.io/Em-Ant/full/QbRyqq/). +**Objective:** Build a [CodePen.io](https://codepen.io) app that is functionally similar to this: [https://codepen.io/freeCodeCamp/full/obYBjE](https://codepen.io/freeCodeCamp/full/obYBjE). Fulfill the below [user stories](https://en.wikipedia.org/wiki/User_story). Use whichever libraries or APIs you need. Give it your own personal style. diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/manage-a-book-trading-club.md b/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/manage-a-book-trading-club.md index 3a0f2e0cd9..5a5420d771 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/manage-a-book-trading-club.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/manage-a-book-trading-club.md @@ -8,7 +8,7 @@ dashedName: manage-a-book-trading-club # --description-- -**Objective:** Build a [Repl.it](https://repl.it/) app that is functionally similar to this: . +**Objective:** Build a [Replit](https://replit.com/) app that is functionally similar to this: . Fulfill the below [user stories](https://en.wikipedia.org/wiki/User_story). Use whichever libraries or APIs you need. Give it your own personal style. diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/p2p-video-chat-application.md b/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/p2p-video-chat-application.md index 0f7eaa434e..6070f83ea8 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/p2p-video-chat-application.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/take-home-projects/p2p-video-chat-application.md @@ -8,7 +8,7 @@ dashedName: p2p-video-chat-application # --description-- -**Objective:** Build a [Repl.it](https://repl.it/) app that is functionally similar to this: . +**Objective:** Build a [Replit](https://replit.com/) app that is functionally similar to this: . Fulfill the below [user stories](https://en.wikipedia.org/wiki/User_story). Use whichever libraries or APIs you need. Give it your own personal style. diff --git a/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md b/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md index b7c5457955..b61ec6d5d1 100644 --- a/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md +++ b/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md @@ -2,6 +2,7 @@ id: 5e46f8e3ac417301a38fb92f title: Book Recommendation Engine using KNN challengeType: 10 +forumTopicId: 462378 dashedName: book-recommendation-engine-using-knn --- diff --git a/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md b/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md index 76e92dcfb2..07288906ad 100644 --- a/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md +++ b/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md @@ -2,6 +2,7 @@ id: 5e46f8dcac417301a38fb92e title: Cat and Dog Image Classifier challengeType: 10 +forumTopicId: 462377 dashedName: cat-and-dog-image-classifier --- diff --git a/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md b/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md index d0b92385ed..56b993d65c 100644 --- a/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md +++ b/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md @@ -2,6 +2,7 @@ id: 5e46f8edac417301a38fb930 title: Linear Regression Health Costs Calculator challengeType: 10 +forumTopicId: 462379 dashedName: linear-regression-health-costs-calculator --- diff --git a/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md b/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md index f938843a59..c5919ba470 100644 --- a/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md +++ b/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md @@ -2,6 +2,7 @@ id: 5e46f8edac417301a38fb931 title: Neural Network SMS Text Classifier challengeType: 10 +forumTopicId: 462380 dashedName: neural-network-sms-text-classifier --- diff --git a/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md b/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md index 5685211ac4..d2d0410e52 100644 --- a/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md +++ b/curriculum/challenges/espanol/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md @@ -2,6 +2,7 @@ id: 5e46f8d6ac417301a38fb92d title: Rock Paper Scissors challengeType: 10 +forumTopicId: 462376 dashedName: rock-paper-scissors --- @@ -9,7 +10,7 @@ dashedName: rock-paper-scissors For this challenge, you will create a program to play Rock, Paper, Scissors. A program that picks at random will usually win 50% of the time. To pass this challenge your program must play matches against four different bots, winning at least 60% of the games in each match. -You can access [the full project description and starter code on repl.it](https://repl.it/github/freeCodeCamp/boilerplate-rock-paper-scissors). +You can access [the full project description and starter code on Replit](https://replit.com/github/freeCodeCamp/boilerplate-rock-paper-scissors). After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. diff --git a/curriculum/challenges/espanol/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-create-a-play-generator.md b/curriculum/challenges/espanol/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-create-a-play-generator.md index 9ea1c8ae2a..f3a22f813d 100644 --- a/curriculum/challenges/espanol/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-create-a-play-generator.md +++ b/curriculum/challenges/espanol/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-create-a-play-generator.md @@ -18,7 +18,7 @@ char_dataset = tf.data.__A__.__B__(text_as_int) ## --answers-- -A: `DataSet` +A: `Dataset` B: `from_tensor_slices` diff --git a/curriculum/challenges/espanol/12-certificates/relational-databases-certificate/relational-databases-certificate.yml b/curriculum/challenges/espanol/12-certificates/relational-databases-certificate/relational-databases-certificate.yml new file mode 100644 index 0000000000..1d01bf91d9 --- /dev/null +++ b/curriculum/challenges/espanol/12-certificates/relational-databases-certificate/relational-databases-certificate.yml @@ -0,0 +1,21 @@ +--- +id: 606243f50267e718b1e755f4 +title: Relational Databases Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: 5f1a4ef5d5d6b5ab580fc6ae + title: Celestial Bodies Database + - + id: 5f9771307d4d22b9d2b75a94 + title: World Cup Database + - + id: 5f87ac112ae598023a42df1a + title: Salon Appointment Scheduler + - + id: 602d9ff222201c65d2a019f2 + title: Periodic Table Database + - + id: 602da04c22201c65d2a019f4 + title: Final Boss diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/celestial-bodies-database.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/celestial-bodies-database.md new file mode 100644 index 0000000000..3dd7c343d3 --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/celestial-bodies-database.md @@ -0,0 +1,18 @@ +--- +id: 5f1a4ef5d5d6b5ab580fc6ae +title: Celestial Bodies Database +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.celestial-bodies-database +dashedName: celestial-bodies-database +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/final-boss.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/final-boss.md new file mode 100644 index 0000000000..2ba55685f4 --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/final-boss.md @@ -0,0 +1,18 @@ +--- +id: 602da04c22201c65d2a019f4 +title: Final Boss +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.final-boss +dashedName: final-boss +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-advanced-bash-by-building.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-advanced-bash-by-building.md new file mode 100644 index 0000000000..9fd49d4f15 --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-advanced-bash-by-building.md @@ -0,0 +1,18 @@ +--- +id: 602da0de22201c65d2a019f6 +title: Learn Advanced Bash by Building +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-advanced-bash-by-building +dashedName: learn-advanced-bash-by-building +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-bash-and-sql-by-building-a-bike-rental-shop.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-bash-and-sql-by-building-a-bike-rental-shop.md new file mode 100644 index 0000000000..76f6ff4eea --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-bash-and-sql-by-building-a-bike-rental-shop.md @@ -0,0 +1,17 @@ +--- +id: 5f5b969a05380d2179fe6e18 +title: Learn Bash and SQL by Building a Bike Rental Shop +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-bash-and-sql-by-building-a-bike-rental-shop +dashedName: learn-bash-and-sql-by-building-a-bike-rental-shop +--- + + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-bash-by-building-a-boilerplate.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-bash-by-building-a-boilerplate.md new file mode 100644 index 0000000000..e1d2873609 --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-bash-by-building-a-boilerplate.md @@ -0,0 +1,18 @@ +--- +id: 5ea8adfab628f68d805bfc5e +title: Learn Bash by Building a Boilerplate +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/freeCodeCamp/.learn-bash-by-building-a-boilerplate +dashedName: learn-bash-by-building-a-boilerplate +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-bash-scripting-by-building-five-programs.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-bash-scripting-by-building-five-programs.md new file mode 100644 index 0000000000..af55d50738 --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-bash-scripting-by-building-five-programs.md @@ -0,0 +1,18 @@ +--- +id: 5f5904ac738bc2fa9efecf5a +title: Learn Bash Scripting by Building Five Programs +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-bash-scripting-by-building-five-programs +dashedName: learn-bash-scripting-by-building-five-programs +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-git-by-building-an-sql-reference-object.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-git-by-building-an-sql-reference-object.md new file mode 100644 index 0000000000..c2b735a923 --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-git-by-building-an-sql-reference-object.md @@ -0,0 +1,18 @@ +--- +id: 5fa323cdaf6a73463d590659 +title: Learn Git by Building an SQL Reference Object +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-git-by-building-an-sql-reference-object +dashedName: learn-git-by-building-an-sql-reference-object +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-github-by-building-a-list-of-inspirational-quotes.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-github-by-building-a-list-of-inspirational-quotes.md new file mode 100644 index 0000000000..f98a0b9293 --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-github-by-building-a-list-of-inspirational-quotes.md @@ -0,0 +1,18 @@ +--- +id: 602da04222201c65d2a019f3 +title: Learn GitHub by Building a List of Inspirational Quotes +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-github-by-building-a-list-of-inspirational-quotes +dashedName: learn-github-by-building-a-list-of-inspirational-quotes +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-nano-by-building-a-castle.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-nano-by-building-a-castle.md new file mode 100644 index 0000000000..b6f9e4ad71 --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-nano-by-building-a-castle.md @@ -0,0 +1,18 @@ +--- +id: 5f32db63eb37f7e17323f459 +title: Learn Nano by Building a Castle +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-nano-by-building-a-castle +dashedName: learn-nano-by-building-a-castle +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-relational-databases-by-building-a-mario-database.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-relational-databases-by-building-a-mario-database.md new file mode 100644 index 0000000000..189dcc68b7 --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-relational-databases-by-building-a-mario-database.md @@ -0,0 +1,18 @@ +--- +id: 5f2c289f164c29556da632fd +title: Learn Relational Databases by Building a Mario Database +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-relational-databases-by-building-a-mario-database +dashedName: learn-relational-databases-by-building-a-mario-database +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-sql-by-building-a-student-database.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-sql-by-building-a-student-database.md new file mode 100644 index 0000000000..7b95cbca4b --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/learn-sql-by-building-a-student-database.md @@ -0,0 +1,18 @@ +--- +id: 602da0c222201c65d2a019f5 +title: Learn SQL by Building a Student Database +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-sql-by-building-a-student-database +dashedName: learn-sql-by-building-a-student-database +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/periodic-table-database.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/periodic-table-database.md new file mode 100644 index 0000000000..05c18517d1 --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/periodic-table-database.md @@ -0,0 +1,18 @@ +--- +id: 602d9ff222201c65d2a019f2 +title: Periodic Table Database +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.periodic-table-database +dashedName: periodic-table-database +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/salon-appointment-scheduler.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/salon-appointment-scheduler.md new file mode 100644 index 0000000000..26fdda731e --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/salon-appointment-scheduler.md @@ -0,0 +1,18 @@ +--- +id: 5f87ac112ae598023a42df1a +title: Salon Appointment Scheduler +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.salon-appointment-scheduler +dashedName: salon-appointment-scheduler +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/world-cup-database.md b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/world-cup-database.md new file mode 100644 index 0000000000..196a965de7 --- /dev/null +++ b/curriculum/challenges/espanol/13-relational-databases/learn-relational-databases/world-cup-database.md @@ -0,0 +1,18 @@ +--- +id: 5f9771307d4d22b9d2b75a94 +title: World Cup Database +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.world-cup-database +dashedName: world-cup-database +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/exercise-tracker.md b/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/exercise-tracker.md index 433855e9c8..3aa838ae92 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/exercise-tracker.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/exercise-tracker.md @@ -1,6 +1,6 @@ --- id: 5a8b073d06fa14fcfde687aa -title: Exercise Tracker +title: Monitor degli esercizi challengeType: 4 forumTopicId: 301505 dashedName: exercise-tracker @@ -8,17 +8,17 @@ dashedName: exercise-tracker # --description-- -Build a full stack JavaScript app that is functionally similar to this: . Working on this project will involve you writing your code using one of the following methods: +Costruisci un'app JavaScript full-stack che sia funzionalmente simile a questa: . Lavorare su questo progetto ti porterà a scrivere il tuo codice utilizzando uno dei seguenti metodi: -- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-exercisetracker/) and complete your project locally. -- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-exercisetracker) to complete your project. -- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. +- Clonare [questa repository GitHub](https://github.com/freeCodeCamp/boilerplate-project-exercisetracker/) e completa il tuo progetto localmente. +- Usare [il nostro progetto di avvio Replit](https://replit.com/github/freeCodeCamp/boilerplate-project-exercisetracker) per completare il tuo progetto. +- Usare un costruttore di siti di tua scelta per completare il progetto. Assicurati di incorporare tutti i file della nostra repository GitHub. -When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. +Quando hai finito, assicurati che una demo funzionante del tuo progetto sia ospitata pubblicamente da qualche parte. Quindi invia l'URL nel campo `Solution Link`. Facoltativamente, invia anche un link al codice sorgente del tuo progetto nel campo `GitHub Link`. # --hints-- -You should provide your own project, not the example URL. +Dovresti inviare il tuo progetto, non l'URL di esempio. ```js (getUserInput) => { @@ -29,7 +29,7 @@ You should provide your own project, not the example URL. }; ``` -You can `POST` to `/api/users` with form data `username` to create a new user. The returned response will be an object with `username` and `_id` properties. +Puoi fare una richiesta `POST` a `/api/users` con il dato `username` proveniente dal modulo per creare un nuovo utente. La risposta restituita sarà un oggetto con proprietà `username` e `_id`. ```js async (getUserInput) => { @@ -49,7 +49,7 @@ async (getUserInput) => { }; ``` -You can make a `GET` request to `/api/users` to get an array of all users. Each element in the array is an object containing a user's `username` and `_id`. +È possibile fare una richiesta `GET` a `/api/users` per ottenere un array di tutti gli utenti. Ogni elemento nell'array è un oggetto contenente lo `username` e l'`_id` dell'utente. ```js async (getUserInput) => { @@ -66,7 +66,7 @@ async (getUserInput) => { }; ``` -You can `POST` to `/api/users/:_id/exercises` with form data `description`, `duration`, and optionally `date`. If no date is supplied, the current date will be used. The response returned will be the user object with the exercise fields added. +È possibile fare una richiesta `POST` a `/api/users/:_id/exercises` con i dati del modulo `description`, `duration` e, facoltativamente `date`. Se non viene fornita alcuna data, verrà utilizzata la data corrente. La risposta restituita sarà l'oggetto utente con l'aggiunta dei campi dell'esercizio. ```js async (getUserInput) => { @@ -102,7 +102,7 @@ async (getUserInput) => { }; ``` -You can make a `GET` request to `/api/users/:_id/logs` to retrieve a full exercise log of any user. The returned response will be the user object with a `log` array of all the exercises added. Each log item has the `description`, `duration`, and `date` properties. +È possibile fare una richiesta `GET` a `/api/users/:_id/logs` per recuperare il log completo degli esercizi di qualsiasi utente. La risposta restituita sarà l'oggetto utente con un array `log` di tutti gli esercizi aggiunti. Ogni elemento di log ha le proprietà `description`, `duration` e `date`. ```js async (getUserInput) => { @@ -144,7 +144,7 @@ async (getUserInput) => { }; ``` -A request to a user's log (`/api/users/:_id/logs`) returns an object with a `count` property representing the number of exercises returned. +Una richiesta al log di un utente (`/api/users/:_id/logs`) restituisce un oggetto con una proprietà `count` che rappresenta il numero di esercizi restituiti. ```js async (getUserInput) => { @@ -185,7 +185,7 @@ async (getUserInput) => { }; ``` -You can add `from`, `to` and `limit` parameters to a `/api/users/:_id/logs` request to retrieve part of the log of any user. `from` and `to` are dates in `yyyy-mm-dd` format. `limit` is an integer of how many logs to send back. +È possibile aggiungere parametri `from`, `to` e`limit` alla richiesta `/api/users/:_id/logs` per ricevere parte del log di ogni utente. `from` e `to` sono date nel formato `yyyy-mm-dd`. `limit` è un numero intero che indica quanti log devono essere restituiti. ```js async (getUserInput) => { diff --git a/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.md b/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.md index da459a9f3f..81ce3fdbaf 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.md @@ -1,6 +1,6 @@ --- id: bd7158d8c443edefaeb5bd0f -title: File Metadata Microservice +title: Microservizio Metadati di un file challengeType: 4 forumTopicId: 301506 dashedName: file-metadata-microservice @@ -8,21 +8,21 @@ dashedName: file-metadata-microservice # --description-- -Build a full stack JavaScript app that is functionally similar to this: . Working on this project will involve you writing your code using one of the following methods: +Costruisci un'app JavaScript full-stack che sia funzionalmente simile a questa: . Lavorare su questo progetto ti porterà a scrivere il tuo codice utilizzando uno dei seguenti metodi: -- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-filemetadata/) and complete your project locally. -- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-filemetadata) to complete your project. -- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. +- Clonare [questa repository GitHub](https://github.com/freeCodeCamp/boilerplate-project-filemetadata/) e completare il tuo progetto localmente. +- Usare [il nostro progetto di avvio Replit](https://replit.com/github/freeCodeCamp/boilerplate-project-filemetadata) per completare il tuo progetto. +- Usare un costruttore di siti di tua scelta per completare il progetto. Assicurati di incorporare tutti i file della nostra repository GitHub. -When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field. +Quando hai finito, assicurati che una demo funzionante del tuo progetto sia ospitata da qualche parte di pubblico. Quindi invia l'URL nel campo `Solution Link`. Facoltativamente, invia anche un link al codice sorgente dei tuoi progetti nel campo `GitHub Link`. # --instructions-- -**HINT:** You can use the `multer` npm package to handle file uploading. +**SUGGERIMENTO:** Puoi usare il pacchetto npm `multer` per gestire il caricamento dei file. # --hints-- -You should provide your own project, not the example URL. +È necessario fornire il proprio progetto, non l'URL di esempio. ```js (getUserInput) => { @@ -34,7 +34,7 @@ You should provide your own project, not the example URL. }; ``` -You can submit a form that includes a file upload. +Puoi inviare un modulo che include un caricamento di file. ```js async (getUserInput) => { @@ -45,7 +45,7 @@ async (getUserInput) => { }; ``` -The form file input field has the `name` attribute set to `upfile`. +Il campo di input del file form ha l'attributo `name` impostato su `upfile`. ```js async (getUserInput) => { @@ -56,7 +56,7 @@ async (getUserInput) => { }; ``` -When you submit a file, you receive the file `name`, `type`, and `size` in bytes within the JSON response. +Inviando un file, riceverai il `name`, il `type` e la dimensione (`size`) in byte del file, all'interno della risposta JSON. ```js async (getUserInput) => { diff --git a/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice.md b/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice.md index de86d19ddb..4d815141fe 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice.md @@ -1,6 +1,6 @@ --- id: bd7158d8c443edefaeb5bdff -title: Request Header Parser Microservice +title: Microservizio Parser di header della richiesta challengeType: 4 forumTopicId: 301507 dashedName: request-header-parser-microservice @@ -8,17 +8,17 @@ dashedName: request-header-parser-microservice # --description-- -Build a full stack JavaScript app that is functionally similar to this: . Working on this project will involve you writing your code using one of the following methods: +Costruisci un'app JavaScript full-stack che sia funzionalmente simile a questa: . Lavorare su questo progetto ti porterà a scrivere il tuo codice utilizzando uno dei seguenti metodi: -- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-headerparser/) and complete your project locally. -- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-headerparser) to complete your project. -- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. +- Clonare [questa repository GitHub](https://github.com/freeCodeCamp/boilerplate-project-headerparser/) e completare il tuo progetto localmente. +- Usare [il nostro progetto di avvio Replit](https://replit.com/github/freeCodeCamp/boilerplate-project-headerparser) per completare il tuo progetto. +- Usare un costruttore di siti di tua scelta per completare il progetto. Assicurati di incorporare tutti i file della nostra repository GitHub. -When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. +Quando hai finito, assicurati che una demo funzionante del tuo progetto sia ospitata da qualche parte di pubblico. Quindi invia l'URL nel campo `Solution Link`. Facoltativamente, invia anche un link al codice sorgente del tuo progetto nel campo `GitHub Link`. # --hints-- -You should provide your own project, not the example URL. +È necessario fornire il proprio progetto, non l'URL di esempio. ```js (getUserInput) => { @@ -30,7 +30,7 @@ You should provide your own project, not the example URL. }; ``` -A request to `/api/whoami` should return a JSON object with your IP address in the `ipaddress` key. +Una richiesta a `/api/whoami` dovrebbe restituire un oggetto JSON con il tuo indirizzo IP nella chiave `ipaddress`. ```js (getUserInput) => @@ -42,7 +42,7 @@ A request to `/api/whoami` should return a JSON object with your IP address in t ); ``` -A request to `/api/whoami` should return a JSON object with your preferred language in the `language` key. +Una richiesta a `/api/whoami` dovrebbe restituire un oggetto JSON con la tua lingua preferita nella chiave `language`. ```js (getUserInput) => @@ -54,7 +54,7 @@ A request to `/api/whoami` should return a JSON object with your preferred langu ); ``` -A request to `/api/whoami` should return a JSON object with your software in the `software` key. +Una richiesta a `/api/whoami` dovrebbe restituire un oggetto JSON con il tuo software nella chiave `software`. ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/timestamp-microservice.md b/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/timestamp-microservice.md index 00cee8bcd6..b2c7362317 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/timestamp-microservice.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/timestamp-microservice.md @@ -1,6 +1,6 @@ --- id: bd7158d8c443edefaeb5bdef -title: Timestamp Microservice +title: Microservizio Timestamp challengeType: 4 forumTopicId: 301508 dashedName: timestamp-microservice @@ -8,17 +8,17 @@ dashedName: timestamp-microservice # --description-- -Build a full stack JavaScript app that is functionally similar to this: . Working on this project will involve you writing your code using one of the following methods: +Costruisci un'app JavaScript full-stack che sia funzionalmente simile a questa: . Lavorare su questo progetto ti porterà a scrivere il tuo codice utilizzando uno dei seguenti metodi: -- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-timestamp/) and complete your project locally. -- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-timestamp) to complete your project. -- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. +- Clonare [questa repository GitHub](https://github.com/freeCodeCamp/boilerplate-project-timestamp/) e completare il tuo progetto localmente. +- Usare [il nostro progetto di avvio Replit](https://replit.com/github/freeCodeCamp/boilerplate-project-timestamp) per completare il tuo progetto. +- Usare un costruttore di siti di tua scelta per completare il progetto. Assicurati di incorporare tutti i file della nostra repository GitHub. -When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field. +Quando hai finito, assicurati che una demo funzionante del tuo progetto sia ospitata da qualche parte di pubblico. Quindi invia l'URL nel campo `Solution Link`. Facoltativamente, invia anche un link al codice sorgente dei tuoi progetti nel campo `GitHub Link`. # --hints-- -You should provide your own project, not the example URL. +È necessario fornire il proprio progetto, non l'URL di esempio. ```js (getUserInput) => { @@ -28,7 +28,7 @@ You should provide your own project, not the example URL. }; ``` -A request to `/api/:date?` with a valid date should return a JSON object with a `unix` key that is a Unix timestamp of the input date in milliseconds +Una richiesta a `/api/:date?` con una data valida dovrebbe restituire un oggetto JSON con una chiave `unix` che è un timestamp Unix della data di input in millisecondi ```js (getUserInput) => @@ -46,7 +46,7 @@ A request to `/api/:date?` with a valid date should return a JSON object with a ); ``` -A request to `/api/:date?` with a valid date should return a JSON object with a `utc` key that is a string of the input date in the format: `Thu, 01 Jan 1970 00:00:00 GMT` +Una richiesta a `/api/:date?` con una data valida dovrebbe restituire un oggetto JSON con una chiave `utc` che è una stringa della data di immissione nel formato: `Thu, 01 Jan 1970 00:00:00 GMT` ```js (getUserInput) => @@ -64,7 +64,7 @@ A request to `/api/:date?` with a valid date should return a JSON object with a ); ``` -A request to `/api/1451001600000` should return `{ unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }` +Una richiesta a `/api/1451001600000` dovrebbe restituire `{ unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }` ```js (getUserInput) => @@ -81,7 +81,7 @@ A request to `/api/1451001600000` should return `{ unix: 1451001600000, utc: "Fr ); ``` -Your project can handle dates that can be successfully parsed by `new Date(date_string)` +Il tuo progetto può gestire date che possono essere lette con successo da `new Date(date_string)` ```js (getUserInput) => @@ -98,7 +98,7 @@ Your project can handle dates that can be successfully parsed by `new Date(date_ ); ``` -If the input date string is invalid, the api returns an object having the structure `{ error : "Invalid Date" }` +Se la stringa della data di input non è valida, l'api restituisce un oggetto con la struttura `{ error : "Invalid Date" }` ```js (getUserInput) => @@ -112,7 +112,7 @@ If the input date string is invalid, the api returns an object having the struct ); ``` -An empty date parameter should return the current time in a JSON object with a `unix` key +Un parametro data vuoto dovrebbe restituire l'ora corrente in un oggetto JSON con una chiave `unix` ```js (getUserInput) => @@ -127,7 +127,7 @@ An empty date parameter should return the current time in a JSON object with a ` ); ``` -An empty date parameter should return the current time in a JSON object with a `utc` key +Un parametro data vuoto dovrebbe restituire l'ora corrente in un oggetto JSON con una chiave `utc` ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice.md b/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice.md index 34bf3e3fa6..ef902b7cfc 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice.md @@ -1,6 +1,6 @@ --- id: bd7158d8c443edefaeb5bd0e -title: URL Shortener Microservice +title: Microservizio di Abbreviazione URL challengeType: 4 forumTopicId: 301509 dashedName: url-shortener-microservice @@ -8,21 +8,21 @@ dashedName: url-shortener-microservice # --description-- -Build a full stack JavaScript app that is functionally similar to this: . Working on this project will involve you writing your code using one of the following methods: +Costruisci un'app JavaScript full-stack che sia funzionalmente simile a questa: . Lavorare su questo progetto ti porterà a scrivere il tuo codice utilizzando uno dei seguenti metodi: -- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-urlshortener/) and complete your project locally. -- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-urlshortener) to complete your project. -- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. +- Clonare [questa repository GitHub](https://github.com/freeCodeCamp/boilerplate-project-urlshortener/) e completare il tuo progetto localmente. +- Usare [il nostro progetto di avvio Replit](https://replit.com/github/freeCodeCamp/boilerplate-project-urlshortener) per completare il tuo progetto. +- Usare un costruttore di siti di tua scelta per completare il progetto. Assicurati di incorporare tutti i file della nostra repository GitHub. -When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field. +Quando hai finito, assicurati che una demo funzionante del tuo progetto sia ospitata da qualche parte di pubblico. Quindi invia l'URL nel campo `Solution Link`. Facoltativamente, invia anche un link al codice sorgente dei tuoi progetti nel campo `GitHub Link`. # --instructions-- -**HINT:** Do not forget to use a body parsing middleware to handle the POST requests. Also, you can use the function `dns.lookup(host, cb)` from the `dns` core module to verify a submitted URL. +**SUGGERIMENTO:** Non dimenticare di utilizzare un middleware di analisi del body per gestire le richieste POST. Inoltre, potrai utilizzare la funzione `dns.lookup(host, cb)` dal modulo core `dns` per verificare un URL inviato. # --hints-- -You should provide your own project, not the example URL. +È necessario fornire il proprio progetto, non l'URL di esempio. ```js (getUserInput) => { @@ -34,7 +34,7 @@ You should provide your own project, not the example URL. }; ``` -You can POST a URL to `/api/shorturl` and get a JSON response with `original_url` and `short_url` properties. Here's an example: `{ original_url : 'https://freeCodeCamp.org', short_url : 1}` +Puoi inviare via POST un URL a `/api/shorturl` e ottenere una risposta JSON con le proprietà `original_url` e `short_url`. Ecco un esempio: `{ original_url : 'https://freeCodeCamp.org', short_url : 1}` ```js async (getUserInput) => { @@ -56,7 +56,7 @@ async (getUserInput) => { }; ``` -When you visit `/api/shorturl/`, you will be redirected to the original URL. +Quando visiti `/api/shorturl/`, verrai reindirizzato all'URL originale. ```js async (getUserInput) => { @@ -88,7 +88,7 @@ async (getUserInput) => { }; ``` -If you pass an invalid URL that doesn't follow the valid `http://www.example.com` format, the JSON response will contain `{ error: 'invalid url' }` +Se passi un URL non valido che non segue il formato valido `http://www.example.com`, la risposta JSON conterrà `{ error: 'invalid url' }` ```js async (getUserInput) => { diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/chain-middleware-to-create-a-time-server.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/chain-middleware-to-create-a-time-server.md index d68ab003f3..aa7a8aac9f 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/chain-middleware-to-create-a-time-server.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/chain-middleware-to-create-a-time-server.md @@ -1,6 +1,6 @@ --- id: 587d7fb1367417b2b2512bf4 -title: Chain Middleware to Create a Time Server +title: Concatenare il middleware per creare un Time Server challengeType: 2 forumTopicId: 301510 dashedName: chain-middleware-to-create-a-time-server @@ -8,9 +8,9 @@ dashedName: chain-middleware-to-create-a-time-server # --description-- -Middleware can be mounted at a specific route using `app.METHOD(path, middlewareFunction)`. Middleware can also be chained inside route definition. +Il middleware può essere montato su un percorso specifico utilizzando `app.METHOD(path, middlewareFunction)`. Il middleware può anche essere concatenato all'interno della definizione del percorso. -Look at the following example: +Guarda l'esempio seguente: ```js app.get('/user', function(req, res, next) { @@ -21,17 +21,17 @@ app.get('/user', function(req, res, next) { }); ``` -This approach is useful to split the server operations into smaller units. That leads to a better app structure, and the possibility to reuse code in different places. This approach can also be used to perform some validation on the data. At each point of the middleware stack you can block the execution of the current chain and pass control to functions specifically designed to handle errors. Or you can pass control to the next matching route, to handle special cases. We will see how in the advanced Express section. +Questo approccio è utile per dividere le operazioni server in unità più piccole. Questo porta a una migliore struttura delle app, e alla possibilità di riutilizzare il codice in luoghi diversi. Questo approccio può essere utilizzato anche per eseguire una qualche convalida sui dati. In ogni punto dello stack middleware è possibile bloccare l'esecuzione della catena corrente e passare il controllo a funzioni specificamente progettate per gestire gli errori. Oppure è possibile passare il controllo alla prossima rotta corrispondente, per gestire casi speciali. Vedremo come nella sezione Express avanzata. # --instructions-- -In the route `app.get('/now', ...)` chain a middleware function and the final handler. In the middleware function you should add the current time to the request object in the `req.time` key. You can use `new Date().toString()`. In the handler, respond with a JSON object, taking the structure `{time: req.time}`. +Nel percorso `app.get('/now', ...)` concatena una funzione middleware e il gestore finale. Nella funzione middleware dovresti aggiungere l'ora corrente all'oggetto della richiesta nella chiave `req.time`. Puoi utilizzare `new Date().toString()`. Nel gestore, rispondi con un oggetto JSON, utilizzando la struttura `{time: req.time}`. -**Note:** The test will not pass if you don’t chain the middleware. If you mount the function somewhere else, the test will fail, even if the output result is correct. +**Nota:** Il test non sarà superato se non concatenerai il middleware. Se monti la funzione altrove, il test fallirà, anche se il risultato dell'uscita sarà corretto. # --hints-- -The /now endpoint should have mounted middleware +L'endpoint /now dovrebbe avere il middleware montato ```js (getUserInput) => @@ -49,7 +49,7 @@ The /now endpoint should have mounted middleware ); ``` -The /now endpoint should return a time that is +/- 20 secs from now +L'endpoint /now dovrebbe restituire un tempo che è di +/- 20 secondi da ora ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/get-data-from-post-requests.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/get-data-from-post-requests.md index 8398c13973..0b2253d347 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/get-data-from-post-requests.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/get-data-from-post-requests.md @@ -1,6 +1,6 @@ --- id: 587d7fb2367417b2b2512bf8 -title: Get Data from POST Requests +title: Ottenere dati dalle richieste POST challengeType: 2 forumTopicId: 301511 dashedName: get-data-from-post-requests @@ -8,27 +8,27 @@ dashedName: get-data-from-post-requests # --description-- -Mount a POST handler at the path `/name`. It’s the same path as before. We have prepared a form in the html frontpage. It will submit the same data of exercise 10 (Query string). If the body-parser is configured correctly, you should find the parameters in the object `req.body`. Have a look at the usual library example: +Monta un gestore POST sul percorso `/name`. È lo stesso percorso di prima. Abbiamo preparato un modulo nella pagina html principale. Invierà gli stessi dati dell'esercizio 10 (stringa di ricerca). Se il body parser è configurato correttamente, dovresti trovare i parametri nell'oggetto `req.body`. Dai un'occhiata al solito esempio della biblioteca:
route: POST '/library'
urlencoded_body: userId=546&bookId=6754
req.body: {userId: '546', bookId: '6754'}
-Respond with the same JSON object as before: `{name: 'firstname lastname'}`. Test if your endpoint works using the html form we provided in the app frontpage. +Rispondi con lo stesso oggetto JSON di prima: `{name: 'firstname lastname'}`. Verifica se il tuo endpoint funziona utilizzando il modulo html che abbiamo fornito nella pagina principale dell'app. -Tip: There are several other http methods other than GET and POST. And by convention there is a correspondence between the http verb, and the operation you are going to execute on the server. The conventional mapping is: +Suggerimento: ci sono diversi altri metodi http diversi da GET e POST. E per convenzione c'è una corrispondenza tra il verbo http, e l'operazione che si sta per eseguire sul server. La mappatura convenzionale è: -POST (sometimes PUT) - Create a new resource using the information sent with the request, +POST (talvolta PUT) - Crea una nuova risorsa utilizzando le informazioni inviate con la richiesta, -GET - Read an existing resource without modifying it, +GET - Leggi una risorsa esistente senza modificarla, -PUT or PATCH (sometimes POST) - Update a resource using the data sent, +PUT o PATCH (a volte POST) - Aggiorna una risorsa utilizzando i dati inviati, -DELETE => Delete a resource. +DELETE => Elimina una risorsa. -There are also a couple of other methods which are used to negotiate a connection with the server. Except from GET, all the other methods listed above can have a payload (i.e. the data into the request body). The body-parser middleware works with these methods as well. +Ci sono anche un paio di altri metodi che vengono utilizzati per negoziare una connessione con il server. Tranne che da GET, tutti gli altri metodi sopra elencati possono avere un carico utile (cioè i dati nel corpo della richiesta). Il middleware body-parser funziona anche con questi metodi. # --hints-- -Test 1 : Your API endpoint should respond with the correct name +Test 1: Il tuo endpoint API dovrebbe rispondere con il nome corretto ```js (getUserInput) => @@ -46,7 +46,7 @@ Test 1 : Your API endpoint should respond with the correct name ); ``` -Test 2 : Your API endpoint should respond with the correct name +Test 2: Il tuo endpoint API dovrebbe rispondere con il nome corretto ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/get-query-parameter-input-from-the-client.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/get-query-parameter-input-from-the-client.md index 0d301a9f5e..e780785a1f 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/get-query-parameter-input-from-the-client.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/get-query-parameter-input-from-the-client.md @@ -1,6 +1,6 @@ --- id: 587d7fb2367417b2b2512bf6 -title: Get Query Parameter Input from the Client +title: Ottenere l'input del parametro query dal client challengeType: 2 forumTopicId: 301512 dashedName: get-query-parameter-input-from-the-client @@ -8,19 +8,19 @@ dashedName: get-query-parameter-input-from-the-client # --description-- -Another common way to get input from the client is by encoding the data after the route path, using a query string. The query string is delimited by a question mark (?), and includes field=value couples. Each couple is separated by an ampersand (&). Express can parse the data from the query string, and populate the object `req.query`. Some characters, like the percent (%), cannot be in URLs and have to be encoded in a different format before you can send them. If you use the API from JavaScript, you can use specific methods to encode/decode these characters. +Un altro modo comune per ottenere input dal client è codificare i dati dopo il percorso della rotta, utilizzando una stringa di interrogazione (query). La stringa di query è delimitata da un punto interrogativo (?), e include le coppie campo=valore. Ogni coppia è separata da un simbolo &. Express può analizzare i dati dalla stringa di query e popolare l'oggetto `req.query`. Alcuni caratteri, come la percentuale (%), non possono essere presenti negli URL e devono essere codificati in un formato diverso prima di poterli inviare. Se accedi all'API da JavaScript, puoi usare metodi specifici per codificare/decodificare questi caratteri.
route_path: '/library'
actual_request_URL: '/library?userId=546&bookId=6754'
req.query: {userId: '546', bookId: '6754'}
# --instructions-- -Build an API endpoint, mounted at `GET /name`. Respond with a JSON document, taking the structure `{ name: 'firstname lastname'}`. The first and last name parameters should be encoded in a query string e.g. `?first=firstname&last=lastname`. +Costruisci un endpoint API, montato su `GET /name`. Rispondi con un documento JSON, usando la struttura `{ name: 'firstname lastname'}`. I parametri del nome e del cognome devono essere codificati in una stringa di query, ad esempio `?first=firstname&last=lastname`. -**Note:** In the following exercise you are going to receive data from a POST request, at the same `/name` route path. If you want, you can use the method `app.route(path).get(handler).post(handler)`. This syntax allows you to chain different verb handlers on the same path route. You can save a bit of typing, and have cleaner code. +**Nota:** Nel seguente esercizio riceverai i dati da una richiesta POST, allo stesso percorso `/name`. Se vuoi, puoi usare il metodo `app.route(path).get(handler).post(handler)`. Questa sintassi consente di concatenare diversi gestori di verbi sullo stesso percorso. Puoi risparmiare un po' di digitazione, e avere un codice più pulito. # --hints-- -Test 1 : Your API endpoint should respond with the correct name +Test 1: Il tuo endpoint API dovrebbe rispondere con il nome corretto ```js (getUserInput) => @@ -38,7 +38,7 @@ Test 1 : Your API endpoint should respond with the correct name ); ``` -Test 2 : Your API endpoint should respond with the correct name +Test 2: Il tuo endpoint API dovrebbe rispondere con il nome corretto ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/get-route-parameter-input-from-the-client.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/get-route-parameter-input-from-the-client.md index b0055f569e..ae09f17641 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/get-route-parameter-input-from-the-client.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/get-route-parameter-input-from-the-client.md @@ -1,6 +1,6 @@ --- id: 587d7fb2367417b2b2512bf5 -title: Get Route Parameter Input from the Client +title: Ottenere l'input del parametro della rotta dal client challengeType: 2 forumTopicId: 301513 dashedName: get-route-parameter-input-from-the-client @@ -8,17 +8,17 @@ dashedName: get-route-parameter-input-from-the-client # --description-- -When building an API, we have to allow users to communicate to us what they want to get from our service. For example, if the client is requesting information about a user stored in the database, they need a way to let us know which user they're interested in. One possible way to achieve this result is by using route parameters. Route parameters are named segments of the URL, delimited by slashes (/). Each segment captures the value of the part of the URL which matches its position. The captured values can be found in the `req.params` object. +Quando costruiamo un'API, dobbiamo consentire agli utenti di comunicarci cosa vogliono ottenere dal nostro servizio. Ad esempio, se il client richiede informazioni su un utente memorizzato nel database, hanno bisogno di un modo per farci sapere a quale utente sono interessati. Un modo possibile per raggiungere questo risultato è utilizzare i parametri della rotta. I parametri della rotta sono denominati segmenti dell'URL, e sono delimitati da slash (/). Ogni segmento cattura il valore della parte dell'URL che corrisponde alla sua posizione. I valori acquisiti possono essere trovati nell'oggetto `req.params`.
route_path: '/user/:userId/book/:bookId'
actual_request_URL: '/user/546/book/6754'
req.params: {userId: '546', bookId: '6754'}
# --instructions-- -Build an echo server, mounted at the route `GET /:word/echo`. Respond with a JSON object, taking the structure `{echo: word}`. You can find the word to be repeated at `req.params.word`. You can test your route from your browser's address bar, visiting some matching routes, e.g. `your-app-rootpath/freecodecamp/echo`. +Costruisci un server echo, montato sul percorso `GET /:word/echo`. Rispondi con un oggetto JSON, usando la struttura `{echo: word}`. Puoi trovare la parola da ripetere in `req.params.word`. Puoi testare il percorso dalla barra degli indirizzi del tuo browser, visitando alcuni percorsi corrispondenti, ad esempio `your-app-rootpath/freecodecamp/echo`. # --hints-- -Test 1 : Your echo server should repeat words correctly +Test 1: il tuo server echo dovrebbe ripetere correttamente le parole ```js (getUserInput) => @@ -36,7 +36,7 @@ Test 1 : Your echo server should repeat words correctly ); ``` -Test 2 : Your echo server should repeat words correctly +Test 2: il tuo server echo dovrebbe ripetere correttamente le parole ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/implement-a-root-level-request-logger-middleware.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/implement-a-root-level-request-logger-middleware.md index 2a2faa35c3..8453dbc45d 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/implement-a-root-level-request-logger-middleware.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/implement-a-root-level-request-logger-middleware.md @@ -1,6 +1,6 @@ --- id: 587d7fb1367417b2b2512bf3 -title: Implement a Root-Level Request Logger Middleware +title: Implementare un middleware logger di richiesta a livello radice challengeType: 2 forumTopicId: 301514 dashedName: implement-a-root-level-request-logger-middleware @@ -8,9 +8,9 @@ dashedName: implement-a-root-level-request-logger-middleware # --description-- -Earlier, you were introduced to the `express.static()` middleware function. Now it’s time to see what middleware is, in more detail. Middleware functions are functions that take 3 arguments: the request object, the response object, and the next function in the application’s request-response cycle. These functions execute some code that can have side effects on the app, and usually add information to the request or response objects. They can also end the cycle by sending a response when some condition is met. If they don’t send the response when they are done, they start the execution of the next function in the stack. This triggers calling the 3rd argument, `next()`. +In precedenza, sei stato introdotto alla funzione middleware `express.static()`. Ora è il momento di vedere cosa è un middleware in modo più dettagliato. Le funzioni middleware sono funzioni che richiedono 3 argomenti: l'oggetto richiesta (request), l'oggetto risposta (response) e la funzione successiva (next) nel ciclo richiesta-risposta dell'applicazione. Queste funzioni eseguono del codice che può avere effetti collaterali sull'app, e di solito aggiungono informazioni alla richiesta o agli oggetti di risposta. Possono anche terminare il ciclo inviando una risposta quando è soddisfatta una certa condizione. Se non inviano la risposta quando hanno finito, iniziano l'esecuzione della funzione successiva nello stack. Questo innesca la chiamata del terzo argomento, `next()`. -Look at the following example: +Considera l'esempio seguente: ```js function(req, res, next) { @@ -19,17 +19,17 @@ function(req, res, next) { } ``` -Let’s suppose you mounted this function on a route. When a request matches the route, it displays the string “I’m a middleware…”, then it executes the next function in the stack. In this exercise, you are going to build root-level middleware. As you have seen in challenge 4, to mount a middleware function at root level, you can use the `app.use()` method. In this case, the function will be executed for all the requests, but you can also set more specific conditions. For example, if you want a function to be executed only for POST requests, you could use `app.post()`. Analogous methods exist for all the HTTP verbs (GET, DELETE, PUT, …). +Supponiamo che tu abbia montato questa funzione su una rotta. Quando una richiesta corrisponde alla rotta, mostrerà la stringa “I’m a middleware…”, dopodiché eseguirà la funzione successiva nello stack. In questo esercizio, costruirai un middleware a livello di radice. Come hai visto nella sfida 4, per montare una funzione middleware a livello di radice, puoi usare il metodo `app.use()`. In questo caso, la funzione verrà eseguita per tutte le richieste, ma è anche possibile impostare condizioni più specifiche. Ad esempio, se desideri che una funzione venga eseguita solo per le richieste POST, puoi utilizzare `app.post()`. Esistono metodi analoghi per tutti i verbi HTTP (GET, DELETE, PUT, …). # --instructions-- -Build a simple logger. For every request, it should log to the console a string taking the following format: `method path - ip`. An example would look like this: `GET /json - ::ffff:127.0.0.1`. Note that there is a space between `method` and `path` and that the dash separating `path` and `ip` is surrounded by a space on both sides. You can get the request method (http verb), the relative route path, and the caller’s ip from the request object using `req.method`, `req.path` and `req.ip`. Remember to call `next()` when you are done, or your server will be stuck forever. Be sure to have the ‘Logs’ opened, and see what happens when some request arrives. +Costruisci un semplice logger. Per ogni richiesta, esso dovrebbe scrivere nella console una stringa con il seguente formato: `method path - ip`. L'output dovrebbe assomigliare a questo: `GET /json - ::ffff:127.0.0.1`. Nota che c'è uno spazio tra `method` e `path` e che il trattino che separa `path` e `ip` è circondato da uno spazio su entrambi i lati. Puoi ottenere il metodo di richiesta (il verbo http), il percorso relativo e l'ip del chiamante dall'oggetto request utilizzando `req.method`, `req.path` e `req.ip`. Ricordati di chiamare `next()` quando hai finito, o il tuo server rimarrà bloccato per sempre. Assicurati di avere il 'Logs' aperto, e guarda cosa succede quando arriva qualche richiesta. -**Note:** Express evaluates functions in the order they appear in the code. This is true for middleware too. If you want it to work for all the routes, it should be mounted before them. +**Nota:** Express valuta le funzioni nell'ordine in cui appaiono nel codice. Questo vale anche per i middleware. Se vuoi che funzioni per tutte le rotte, dovresti montarlo prima di loro. # --hints-- -Root level logger middleware should be active +Il middleware del logger di livello radice dovrebbe essere attivo ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/meet-the-node-console.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/meet-the-node-console.md index 5876dde8e5..2616df852d 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/meet-the-node-console.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/meet-the-node-console.md @@ -1,6 +1,6 @@ --- id: 587d7fb0367417b2b2512bed -title: Meet the Node console +title: Introduzione alla console di Node challengeType: 2 forumTopicId: 301515 dashedName: meet-the-node-console @@ -8,27 +8,27 @@ dashedName: meet-the-node-console # --description-- -Working on these challenges will involve you writing your code using one of the following methods: +Lavorare su queste sfide ti porterà a scrivere il tuo codice utilizzando uno dei seguenti metodi: -- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-express/) and complete these challenges locally. -- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-express) to complete these challenges. -- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. +- Clonare [questo repository GitHub](https://github.com/freeCodeCamp/boilerplate-express/) e completare queste sfide localmente. +- Usare [il nostro progetto di avvio Replit](https://replit.com/github/freeCodeCamp/boilerplate-express) per completare queste sfide. +- Usa un costruttore di siti di tua scelta per completare il progetto. Assicurati di incorporare tutti i file della nostra repository GitHub. -When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. +Quando hai finito, assicurati che una demo funzionante del tuo progetto sia ospitata da qualche parte di pubblico. Quindi invia l'URL nel campo `Solution Link`. -During the development process, it is important to be able to check what’s going on in your code. +Durante il processo di sviluppo, è importante essere in grado di controllare cosa sta succedendo nel tuo codice. -Node is just a JavaScript environment. Like client side JavaScript, you can use the console to display useful debug information. On your local machine, you would see console output in a terminal. On Replit, a terminal is open in the right pane by default. +Node è solo un ambiente JavaScript. Come per il JavaScript lato client, puoi usare la console per visualizzare utili informazioni di debug. Sulla tua macchina locale, vedrai l'output della console in un terminale. Su Replit, un terminale è aperto nel riquadro destro per impostazione predefinita. -We recommend to keep the terminal open while working at these challenges. By reading the output in the terminal, you can see any errors that may occur. +Ti consigliamo di mantenere il terminale aperto mentre lavori a a queste sfide. Leggendo l'output nel terminale, potrai vedere eventuali errori. # --instructions-- -Modify the `myApp.js` file to log "Hello World" to the console. +Modifica il file `myApp.js` per scrivere "Hello World" nella console. # --hints-- -`"Hello World"` should be in the console +`"Hello World"` dovrebbe essere visualizzato nella console ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/serve-an-html-file.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/serve-an-html-file.md index 1d61867322..eac95d56d1 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/serve-an-html-file.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/serve-an-html-file.md @@ -1,6 +1,6 @@ --- id: 587d7fb0367417b2b2512bef -title: Serve an HTML File +title: Servire un file HTML challengeType: 2 forumTopicId: 301516 dashedName: serve-an-html-file @@ -8,7 +8,7 @@ dashedName: serve-an-html-file # --description-- -You can respond to requests with a file using the `res.sendFile(path)` method. You can put it inside the `app.get('/', ...)` route handler. Behind the scenes, this method will set the appropriate headers to instruct your browser on how to handle the file you want to send, according to its type. Then it will read and send the file. This method needs an absolute file path. We recommend you to use the Node global variable `__dirname` to calculate the path like this: +È possibile rispondere alle richieste con un file utilizzando il metodo `res.sendFile(path)`. Puoi inserirlo all'interno del gestore della rotta `app.get('/', ...)`. Dietro le quinte, questo metodo imposterà le intestazioni appropriate per istruire il browser su come gestire il file che si desidera inviare, in base al suo tipo. Quindi leggerà e invierà il file. Questo metodo necessita di un percorso di file assoluto. Ti consigliamo di utilizzare la variabile globale Node `__dirname` per calcolare il percorso in questo modo: ```js absolutePath = __dirname + relativePath/file.ext @@ -16,13 +16,13 @@ absolutePath = __dirname + relativePath/file.ext # --instructions-- -Send the `/views/index.html` file as a response to GET requests to the `/` path. If you view your live app, you should see a big HTML heading (and a form that we will use later…), with no style applied. +Invia il file `/views/index.html` come risposta alle richieste GET al percorso `/`. Guardando la tua app live, dovresti vedere una grossa intestazione HTML (e un modulo, che useremo successivamente...) senza alcuno stile applicato. -**Note:** You can edit the solution of the previous challenge or create a new one. If you create a new solution, keep in mind that Express evaluates routes from top to bottom, and executes the handler for the first match. You have to comment out the preceding solution, or the server will keep responding with a string. +**Nota:** Puoi modificare la soluzione della sfida precedente o crearne una nuova. Se crei una nuova soluzione, tieni presente che Express valuta i percorsi dall'alto verso il basso ed esegue il gestore alla prima corrispondenza. Dovrai commentare la soluzione precedente, o il server continuerà a rispondere con una stringa. # --hints-- -Your app should serve the file views/index.html +La tua app dovrebbe servire il file views/index.html ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route.md index 1e977061c7..47bfba8569 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route.md @@ -1,6 +1,6 @@ --- id: 587d7fb1367417b2b2512bf1 -title: Serve JSON on a Specific Route +title: Servire un JSON su una rotta specifica challengeType: 2 forumTopicId: 301517 dashedName: serve-json-on-a-specific-route @@ -8,17 +8,17 @@ dashedName: serve-json-on-a-specific-route # --description-- -While an HTML server serves HTML, an API serves data. A REST (REpresentational State Transfer) API allows data exchange in a simple way, without the need for clients to know any detail about the server. The client only needs to know where the resource is (the URL), and the action it wants to perform on it (the verb). The GET verb is used when you are fetching some information, without modifying anything. These days, the preferred data format for moving information around the web is JSON. Simply put, JSON is a convenient way to represent a JavaScript object as a string, so it can be easily transmitted. +Mentre un server HTML serve HTML, un'API serve dati. Un'API REST (REpresentational State Transfer) consente lo scambio di dati in modo semplice, senza la necessità per i client di conoscere alcun dettaglio sul server. Il client deve solo sapere dove è la risorsa (l'URL), e l'azione che vuole eseguire su di essa (il verbo). Il verbo GET viene utilizzato quando stai recuperando alcune informazioni, senza modificare nulla. Al giorno d'oggi, il formato dati preferito per trasferire informazioni sul Web è JSON. In poche parole, JSON è un modo conveniente per rappresentare un oggetto JavaScript come una stringa, in modo che possa essere facilmente trasmesso. -Let's create a simple API by creating a route that responds with JSON at the path `/json`. You can do it as usual, with the `app.get()` method. Inside the route handler, use the method `res.json()`, passing in an object as an argument. This method closes the request-response loop, returning the data. Behind the scenes, it converts a valid JavaScript object into a string, then sets the appropriate headers to tell your browser that you are serving JSON, and sends the data back. A valid object has the usual structure `{key: data}`. `data` can be a number, a string, a nested object or an array. `data` can also be a variable or the result of a function call, in which case it will be evaluated before being converted into a string. +Creiamo una semplice API creando una rotta (route) che risponda con JSON al percorso `/json`. Puoi farlo come al solito, con il metodo `app.get()`. All'interno del gestore della rotta, usa il metodo `res.json()`, passandogli un oggetto come argomento. Questo metodo chiude il ciclo richiesta-risposta, restituendo i dati. Dietro le quinte, converte un oggetto JavaScript valido in una stringa, poi imposta le intestazioni appropriate per dire al tuo browser che stai servendo JSON, e restituisce i dati. Un oggetto valido ha la solita struttura `{key: data}`. `data` può essere un numero, una stringa, un oggetto annidato o un array. `data` può anche essere una variabile o il risultato di una chiamata di funzione, nel qual caso sarà valutato prima di essere convertito in una stringa. # --instructions-- -Serve the object `{"message": "Hello json"}` as a response, in JSON format, to GET requests to the `/json` route. Then point your browser to `your-app-url/json`, you should see the message on the screen. +Servi l'oggetto `{"message": "Hello json"}` come risposta, in formato JSON, alle richieste GET per il percorso `/json`. Quindi punta il tuo browser a `your-app-url/json`, dovresti vedere il messaggio sullo schermo. # --hints-- -The endpoint `/json` should serve the json object `{"message": "Hello json"}` +L'endpoint `/json` dovrebbe servire l'oggetto json `{"message": "Hello json"}` ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/serve-static-assets.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/serve-static-assets.md index f3e2796c54..9e3d194c22 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/serve-static-assets.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/serve-static-assets.md @@ -1,6 +1,6 @@ --- id: 587d7fb0367417b2b2512bf0 -title: Serve Static Assets +title: Servire Risorse Statiche challengeType: 2 forumTopicId: 301518 dashedName: serve-static-assets @@ -8,21 +8,21 @@ dashedName: serve-static-assets # --description-- -An HTML server usually has one or more directories that are accessible by the user. You can place there the static assets needed by your application (stylesheets, scripts, images). +Un server HTML di solito ha una o più directory che sono accessibili all'utente. È possibile posizionare lì le risorse statiche necessarie per l'applicazione (fogli di stile, script, immagini). -In Express, you can put in place this functionality using the middleware `express.static(path)`, where the `path` parameter is the absolute path of the folder containing the assets. +In Express, puoi mettere in atto questa funzionalità usando il middleware `express.static(path)`, dove il parametro `path` è il percorso assoluto della cartella contenente le risorse. -If you don’t know what middleware is... don’t worry, we will discuss in detail later. Basically, middleware are functions that intercept route handlers, adding some kind of information. A middleware needs to be mounted using the method `app.use(path, middlewareFunction)`. The first `path` argument is optional. If you don’t pass it, the middleware will be executed for all requests. +Se non sai cosa è un middleware... non ti preoccupare, ne discuteremo in dettaglio più tardi. Fondamentalmente, i middleware sono funzioni che intercettano i gestori delle rotte, aggiungendo un certo tipo di informazioni. Un middleware deve essere montato usando il metodo `app.use(path, middlewareFunction)`. Il primo argomento `path` è facoltativo. Se non viene passato, il middleware verrà eseguito per tutte le richieste. # --instructions-- -Mount the `express.static()` middleware to the path `/public` with `app.use()`. The absolute path to the assets folder is `__dirname + /public`. +Monta il middleware `express.static()` sul percorso `/public` con `app.use()`. Il percorso assoluto della cartella asset è `__dirname + /public`. -Now your app should be able to serve a CSS stylesheet. Note that the `/public/style.css` file is referenced in the `/views/index.html` in the project boilerplate. Your front-page should look a little better now! +Ora la tua app dovrebbe essere in grado di servire un foglio di stile CSS. Nota che il file `/public/style.css` è referenziato nel `/views/index.html` nel codice standard. Adesso la tua pagina principale dovrebbe avere un aspetto un po' migliore! # --hints-- -Your app should serve asset files from the `/public` directory to the `/public` path +La tua app dovrebbe servire i file di risorsa dalla directory `/public` al percorso `/public` ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/start-a-working-express-server.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/start-a-working-express-server.md index e8e3e82fc5..a091b10236 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/start-a-working-express-server.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/start-a-working-express-server.md @@ -1,6 +1,6 @@ --- id: 587d7fb0367417b2b2512bee -title: Start a Working Express Server +title: Avviare un server Express funzionante challengeType: 2 forumTopicId: 301519 dashedName: start-a-working-express-server @@ -8,9 +8,9 @@ dashedName: start-a-working-express-server # --description-- -In the first two lines of the file `myApp.js`, you can see how easy it is to create an Express app object. This object has several methods, and you will learn many of them in these challenges. One fundamental method is `app.listen(port)`. It tells your server to listen on a given port, putting it in running state. For testing reasons, we need the app to be running in the background so we added this method in the `server.js` file for you. +Nelle prime due righe del file `myApp.js` puoi vedere quanto sia facile creare un oggetto app Express. Questo oggetto ha diversi metodi, che conoscerai in queste sfide. Un metodo fondamentale è `app.listen(port)`. Dice al tuo server di mettersi in ascolto su una data porta, mettendola in uno stato attivo. Per motivi di test, abbiamo bisogno che l'app sia in esecuzione in background per cui abbiamo aggiunto questo metodo nel file `server.js` per te. -Let’s serve our first string! In Express, routes takes the following structure: `app.METHOD(PATH, HANDLER)`. METHOD is an http method in lowercase. PATH is a relative path on the server (it can be a string, or even a regular expression). HANDLER is a function that Express calls when the route is matched. Handlers take the form `function(req, res) {...}`, where req is the request object, and res is the response object. For example, the handler +Serviamo la nostra prima stringa! In Express, le rotte hanno la seguente struttura: `app.METHOD(PATH, HANDLER)`. METHOD è un metodo http in minuscolo. PATH è un percorso relativo sul server (può essere una stringa, o anche un'espressione regolare). HANDLER è una funzione che Express chiama quando la rotta corrisponde. I gestori assumono la forma `function(req, res) {...}`, dove req è l'oggetto request (richiesta), e res è l'oggetto response (risposta). Ad esempio, il gestore ```js function(req, res) { @@ -18,17 +18,17 @@ function(req, res) { } ``` -will serve the string 'Response String'. +servirà la stringa 'Response String'. # --instructions-- -Use the `app.get()` method to serve the string "Hello Express" to GET requests matching the `/` (root) path. Be sure that your code works by looking at the logs, then see the results in the preview if you are using Replit. +Utilizza il metodo `app.get()` per servire la stringa "Hello Express" alle richieste GET corrispondenti al percorso `/` (root). Assicurati che il codice funzioni guardando i log, quindi guarda i risultati nell'anteprima se utilizzi Replit. -**Note:** All the code for these lessons should be added in between the few lines of code we have started you off with. +**Nota:** Tutto il codice per queste lezioni dovrebbe essere aggiunto tra le poche righe di codice di partenza. # --hints-- -Your app should serve the string 'Hello Express' +La tua app dovrebbe servire la stringa 'Hello Express' ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md index 9e0c3a879b..84b44fb570 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md @@ -1,6 +1,6 @@ --- id: 587d7fb2367417b2b2512bf7 -title: Use body-parser to Parse POST Requests +title: Usare il body parser per analizzare le richieste POST challengeType: 2 forumTopicId: 301520 dashedName: use-body-parser-to-parse-post-requests @@ -8,9 +8,9 @@ dashedName: use-body-parser-to-parse-post-requests # --description-- -Besides GET, there is another common HTTP verb, it is POST. POST is the default method used to send client data with HTML forms. In REST convention, POST is used to send data to create new items in the database (a new user, or a new blog post). You don’t have a database in this project, but you are going to learn how to handle POST requests anyway. +Oltre a GET, c'è un altro verbo HTTP di uso comune, che è POST. POST è il metodo predefinito utilizzato per inviare dati dal client attraverso i moduli HTML. Nella convenzione REST, POST viene utilizzato per inviare dati che creeranno nuovi elementi nel database (un nuovo utente, o un nuovo post del blog). Non hai un database in questo progetto, ma imparerai comunque a gestire le richieste POST. -In these kind of requests, the data doesn’t appear in the URL, it is hidden in the request body. The body is a part of the HTTP request, also called the payload. Even though the data is not visible in the URL, this does not mean that it is private. To see why, look at the raw content of an HTTP POST request: +In questo tipo di richieste, i dati non appaiono nell'URL, sono nascosti nel corpo della richiesta. Il corpo fa parte della richiesta HTTP, chiamata anche payload (carico utile). Anche se i dati non sono visibili nell'URL, ciò non significa che siano privati. Per vedere perché, guarda il contenuto grezzo di una richiesta HTTP POST: ```http POST /path/subpath HTTP/1.0 @@ -22,17 +22,17 @@ Content-Length: 20 name=John+Doe&age=25 ``` -As you can see, the body is encoded like the query string. This is the default format used by HTML forms. With Ajax, you can also use JSON to handle data having a more complex structure. There is also another type of encoding: multipart/form-data. This one is used to upload binary files. In this exercise, you will use a urlencoded body. To parse the data coming from POST requests, you have to install the `body-parser` package. This package allows you to use a series of middleware, which can decode data in different formats. +Come puoi vedere, il corpo è codificato come la query string. Questo è il formato predefinito usato dai moduli HTML. Con Ajax, è anche possibile utilizzare JSON per gestire dati che hanno una struttura più complessa. C'è anche un altro tipo di codifica: multipart/form-data. Questo viene utilizzato per caricare file binari. In questo esercizio, utilizzerai un corpo urlencoded. Per analizzare i dati provenienti dalle richieste POST, dovrai installare il pacchetto `body-parser`. Questo pacchetto consente di utilizzare una serie di middleware, che possono decodificare i dati in diversi formati. # --instructions-- -Install the `body-parser` module in your `package.json`. Then, `require` it at the top of the file. Store it in a variable named `bodyParser`. The middleware to handle urlencoded data is returned by `bodyParser.urlencoded({extended: false})`. Pass to `app.use()` the function returned by the previous method call. As usual, the middleware must be mounted before all the routes which need it. +Installa il modulo `body-parser` nel tuo `package.json`. Poi, richiedilo con `require` all'inizio del file. Memorizzalo in una variabile chiamata `bodyParser`. Il middleware per gestire i dati urlencoded viene restituito da `bodyParser.urlencoded({extended: false})`. Passa a `app.use()` la funzione restituita dalla precedente chiamata del metodo. Come al solito, il middleware deve essere montato prima di tutte le rotte che ne hanno bisogno. -**Note:** `extended=false` is a configuration option that tells the parser to use the classic encoding. When using it, values can be only strings or arrays. The extended version allows more data flexibility, but it is outmatched by JSON. +**Nota:** `extended=false` è un'opzione di configurazione che dice al parser di usare la codifica classica. Quando lo si utilizza, i valori possono essere solo stringhe o array. La versione estesa consente una maggiore flessibilità dei dati, ma è superata da JSON. # --hints-- -The 'body-parser' middleware should be mounted +Il middleware 'body-parser' dovrebbe essere montato ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/use-the-.env-file.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/use-the-.env-file.md index e953553f4b..35036315de 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/use-the-.env-file.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/use-the-.env-file.md @@ -1,6 +1,6 @@ --- id: 587d7fb1367417b2b2512bf2 -title: Use the .env File +title: Usare il file .env challengeType: 2 forumTopicId: 301521 dashedName: use-the--env-file @@ -8,23 +8,23 @@ dashedName: use-the--env-file # --description-- -The `.env` file is a hidden file that is used to pass environment variables to your application. This file is secret, no one but you can access it, and it can be used to store data that you want to keep private or hidden. For example, you can store API keys from external services or your database URI. You can also use it to store configuration options. By setting configuration options, you can change the behavior of your application, without the need to rewrite some code. +Il file `.env` è un file nascosto che viene utilizzato per passare le variabili d'ambiente alla tua applicazione. Questo file è segreto, nessuno tranne te può accedervi, e può essere utilizzato per memorizzare i dati che desideri mantenere privati o nascosti. Ad esempio, puoi memorizzare le chiavi API di servizi esterni o l'URI del database. Puoi anche usarlo per memorizzare le opzioni di configurazione. Impostando le opzioni di configurazione, puoi modificare il comportamento della tua applicazione, senza la necessità di riscrivere una parte di codice. -The environment variables are accessible from the app as `process.env.VAR_NAME`. The `process.env` object is a global Node object, and variables are passed as strings. By convention, the variable names are all uppercase, with words separated by an underscore. The `.env` is a shell file, so you don’t need to wrap names or values in quotes. It is also important to note that there cannot be space around the equals sign when you are assigning values to your variables, e.g. `VAR_NAME=value`. Usually, you will put each variable definition on a separate line. +Le variabili di ambiente sono accessibili dall'app come `process.env.VAR_NAME`. L'oggetto `process.env` è un oggetto Node globale e le variabili sono passate come stringhe. Per convenzione, i nomi delle variabili sono tutti in maiuscolo, con parole separate da un trattino basso. `.env` è un file di shell, quindi non è necessario racchiudere i nomi o i valori tra virgolette. È anche importante notare che non ci possono essere degli spazi intorno al segno uguale quando si assegnano valori alle variabili, ad esempio `VAR_NAME=value`. Normalmente metterai ogni definizione di variabile in una riga separata. # --instructions-- -Let's add an environment variable as a configuration option. +Aggiungiamo una variabile d'ambiente come opzione di configurazione. -Create a `.env` file in the root of your project directory, and store the variable `MESSAGE_STYLE=uppercase` in it. +Crea un file `.env` nella directory principale del tuo progetto e memorizza la variabile `MESSAGE_STYLE=uppercase` in esso. -Then, in the `/json` GET route handler you created in the last challenge, transform the response object's message to uppercase if `process.env.MESSAGE_STYLE` equals `uppercase`. The response object should either be `{"message": "Hello json"}` or `{"message": "HELLO JSON"}`, depending on the `MESSAGE_STYLE` value. +Poi, nel gestore della rotta GET `/json` che hai creato nell'ultima sfida, trasforma il messaggio dell'oggetto di risposta in maiuscolo se `process.env.MESSAGE_STYLE` è uguale a `uppercase`. L'oggetto della risposta dovrebbe essere `{"message": "Hello json"}` o `{"message": "HELLO JSON"}`, a seconda del valore di `MESSAGE_STYLE`. -**Note:** If you are using Replit, you cannot create a `.env` file. Instead, use the built-in SECRETS tab to add the variable. +**Nota:** Se stai usando Replit, non puoi creare un file `.env`. Utilizza invece la scheda SECRETS integrata per aggiungere la variabile. # --hints-- -The response of the endpoint `/json` should change according to the environment variable `MESSAGE_STYLE` +La risposta dell'endpoint `/json` dovrebbe cambiare in base alla variabile d'ambiente `MESSAGE_STYLE` ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-a-description-to-your-package.json.md b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-a-description-to-your-package.json.md index d4f4da4d68..c25aef4dba 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-a-description-to-your-package.json.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-a-description-to-your-package.json.md @@ -1,6 +1,6 @@ --- id: 587d7fb3367417b2b2512bfc -title: Add a Description to Your package.json +title: Aggiungere una descrizione al tuo package.json challengeType: 2 forumTopicId: 301522 dashedName: add-a-description-to-your-package-json @@ -8,11 +8,11 @@ dashedName: add-a-description-to-your-package-json # --description-- -The next part of a good package.json file is the `description` field; where a short, but informative description about your project belongs. +La parte successiva di un buon file package.json è il campo `description`, che conterrà una breve ma informativa descrizione del progetto. -If you some day plan to publish a package to npm, this is the string that should sell your idea to the user when they decide whether to install your package or not. However, that’s not the only use case for the description, it’s a great way to summarize what a project does. It’s just as important in any Node.js project to help other developers, future maintainers or even your future self understand the project quickly. +Se un giorno avessi intenzione di pubblicare un pacchetto su npm, questa è la stringa che dovrebbe vendere la tua idea all'utente quando decide se installare o meno il pacchetto. Tuttavia, questo non è l'unico caso di utilizzo per la descrizione: essa è un ottimo modo per riassumere ciò che un progetto fa. È altrettanto importante in qualsiasi progetto Node.js per aiutare altri sviluppatori, futuri manutentori o anche il futuro te stesso a comprendere il progetto velocemente. -Regardless of what you plan for your project, a description is definitely recommended. Here's an example: +Indipendentemente da ciò che prevedi per il vostro progetto, una descrizione è sicuramente consigliata. Ecco un esempio: ```json "description": "A project that does something awesome", @@ -20,13 +20,13 @@ Regardless of what you plan for your project, a description is definitely recomm # --instructions-- -Add a `description` to the package.json file of your project. +Aggiungi una `description` al file package.json del tuo progetto. -**Note:** Remember to use double-quotes for field-names (") and commas (,) to separate fields. +**Nota:** Ricordati di usare le virgolette doppie (") per i nomi di campo e le virgole (,) per separare i campi. # --hints-- -package.json should have a valid "description" key +package.json dovrebbe avere una chiave "description" valida ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-a-license-to-your-package.json.md b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-a-license-to-your-package.json.md index d97b013401..acca4f49bf 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-a-license-to-your-package.json.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-a-license-to-your-package.json.md @@ -1,6 +1,6 @@ --- id: 587d7fb4367417b2b2512bfe -title: Add a License to Your package.json +title: Aggiungere una licenza al tuo package.json challengeType: 2 forumTopicId: 301523 dashedName: add-a-license-to-your-package-json @@ -8,9 +8,9 @@ dashedName: add-a-license-to-your-package-json # --description-- -The `license` field is where you inform users of what they are allowed to do with your project. +Il campo `license` è dove informi gli utenti di quello che possono fare con il tuo progetto. -Some common licenses for open source projects include MIT and BSD. License information is not required, and copyright laws in most countries will give you ownership of what you create by default. However, it’s always a good practice to explicitly state what users can and can’t do. Here's an example of the license field: +Alcune licenze comuni per progetti open source sono MIT e BSD. Le informazioni sulla licenza non sono richieste e le leggi sul copyright nella maggior parte dei paesi ti daranno la proprietà di ciò che crei senza che tu debba fare altro. Tuttavia, è sempre una buona pratica dichiarare esplicitamente quello che gli utenti possono e non possono fare. Ecco un esempio del campo di licenza: ```json "license": "MIT", @@ -18,11 +18,11 @@ Some common licenses for open source projects include MIT and BSD. License infor # --instructions-- -Fill the `license` field in the package.json file of your project as you find suitable. +Compila il campo `license` nel file package.json del tuo progetto come ritieni opportuno. # --hints-- -package.json should have a valid "license" key +package.json dovrebbe avere una chiave "license" valida ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-a-version-to-your-package.json.md b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-a-version-to-your-package.json.md index a5b3b8b245..5985e3d06f 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-a-version-to-your-package.json.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-a-version-to-your-package.json.md @@ -1,6 +1,6 @@ --- id: 587d7fb4367417b2b2512bff -title: Add a Version to Your package.json +title: Aggiungere una versione al tuo package.json challengeType: 2 forumTopicId: 301525 dashedName: add-a-version-to-your-package-json @@ -8,7 +8,7 @@ dashedName: add-a-version-to-your-package-json # --description-- -A `version` is one of the required fields of your package.json file. This field describes the current version of your project. Here's an example: +`version` è uno dei campi obbligatori del file package.json. Questo campo descrive la versione corrente del tuo progetto. Ecco un esempio: ```json "version": "1.2.0", @@ -16,11 +16,11 @@ A `version` is one of the required fields of your package.json file. This field # --instructions-- -Add a `version` to the package.json file of your project. +Aggiungi una `version` al file package.json del tuo progetto. # --hints-- -package.json should have a valid "version" key +package.json deve avere una chiave "version" valida ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-keywords-to-your-package.json.md b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-keywords-to-your-package.json.md index 33c9742e8b..b5f1646d58 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-keywords-to-your-package.json.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/add-keywords-to-your-package.json.md @@ -1,6 +1,6 @@ --- id: 587d7fb4367417b2b2512bfd -title: Add Keywords to Your package.json +title: Aggiungere parole chiave al tuo package.json challengeType: 2 forumTopicId: 301526 dashedName: add-keywords-to-your-package-json @@ -8,23 +8,23 @@ dashedName: add-keywords-to-your-package-json # --description-- -The `keywords` field is where you can describe your project using related keywords. Here's an example: +Il campo `keywords` è dove puoi descrivere il tuo progetto usando le parole chiave correlate. Ecco un esempio: ```json "keywords": [ "descriptive", "related", "words" ], ``` -As you can see, this field is structured as an array of double-quoted strings. +Come puoi vedere, questo campo è strutturato come una serie di stringhe tra virgolette doppie. # --instructions-- -Add an array of suitable strings to the `keywords` field in the package.json file of your project. +Aggiungi un array di stringhe adatte al campo `keywords` nel file package.json del tuo progetto. -One of the keywords should be "freecodecamp". +Una delle parole chiave dovrebbe essere "freecodecamp". # --hints-- -package.json should have a valid "keywords" key +package.json dovrebbe avere una chiave "keywords" valida ```js (getUserInput) => @@ -39,7 +39,7 @@ package.json should have a valid "keywords" key ); ``` -"keywords" field should be an Array +il campo "keywords" dovrebbe essere un Array ```js (getUserInput) => @@ -54,7 +54,7 @@ package.json should have a valid "keywords" key ); ``` -"keywords" should include "freecodecamp" +"keywords" dovrebbe includere "freecodecamp" ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/expand-your-project-with-external-packages-from-npm.md b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/expand-your-project-with-external-packages-from-npm.md index 18523e17aa..5387c9aefa 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/expand-your-project-with-external-packages-from-npm.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/expand-your-project-with-external-packages-from-npm.md @@ -1,6 +1,6 @@ --- id: 587d7fb4367417b2b2512c00 -title: Expand Your Project with External Packages from npm +title: Espandere il tuo progetto con pacchetti esterni di npm challengeType: 2 forumTopicId: 301527 dashedName: expand-your-project-with-external-packages-from-npm @@ -8,9 +8,9 @@ dashedName: expand-your-project-with-external-packages-from-npm # --description-- -One of the biggest reasons to use a package manager, is their powerful dependency management. Instead of manually having to make sure that you get all dependencies whenever you set up a project on a new computer, npm automatically installs everything for you. But how can npm know exactly what your project needs? Meet the `dependencies` section of your package.json file. +Uno dei più grandi motivi per utilizzare un gestore di pacchetti, è la loro potente gestione delle dipendenze. Invece di dover fare manualmente in modo di ottenere tutte le dipendenze ogni volta che si imposta un progetto su un nuovo computer, npm installa tutto per te automaticamente. Ma come può npm sapere esattamente di cosa ha bisogno il tuo progetto? Vai a vedere la sezione `dependencies` del tuo file package.json. -In this section, packages your project requires are stored using the following format: +In questa sezione, i pacchetti richiesti dal progetto vengono memorizzati nel seguente formato: ```json "dependencies": { @@ -22,13 +22,13 @@ In this section, packages your project requires are stored using the following f # --instructions-- -Add version "2.14.0" of the "moment" package to the `dependencies` field of your package.json file. +Aggiungi la versione "2.14.0" del pacchetto "moment" al campo `dependencies` del tuo file package.json. -**Note:** Moment is a handy library for working with time and dates. +**Nota:** Moment è una comoda libreria per lavorare con l'ora e le date. # --hints-- -"dependencies" should include "moment" +"dependencies" dovrebbe includere "moment" ```js (getUserInput) => @@ -47,7 +47,7 @@ Add version "2.14.0" of the "moment" package to the `dependencies` field of your ); ``` -"moment" version should be "2.14.0" +La versione di "moment" dovrebbe essere "2.14.0" ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/how-to-use-package.json-the-core-of-any-node.js-project-or-npm-package.md b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/how-to-use-package.json-the-core-of-any-node.js-project-or-npm-package.md index 7c3ce74460..df825f53e1 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/how-to-use-package.json-the-core-of-any-node.js-project-or-npm-package.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/how-to-use-package.json-the-core-of-any-node.js-project-or-npm-package.md @@ -1,6 +1,6 @@ --- id: 587d7fb3367417b2b2512bfb -title: 'How to Use package.json, the Core of Any Node.js Project or npm Package' +title: 'Come utilizzare package.json, il nucleo di qualsiasi progetto Node.js o pacchetto npm' challengeType: 2 forumTopicId: 301528 dashedName: how-to-use-package-json-the-core-of-any-node-js-project-or-npm-package @@ -8,19 +8,19 @@ dashedName: how-to-use-package-json-the-core-of-any-node-js-project-or-npm-packa # --description-- -Working on these challenges will involve you writing your code using one of the following methods: +Lavorare su queste sfide ti porterà a scrivere il tuo codice utilizzando uno dei seguenti metodi: -- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-npm/) and complete these challenges locally. -- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-npm) to complete these challenges. -- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. +- Clonare [questo repository GitHub](https://github.com/freeCodeCamp/boilerplate-npm/) e completare queste sfide localmente. +- Usare [il nostro progetto di avvio Replit](https://replit.com/github/freeCodeCamp/boilerplate-npm) per completare queste sfide. +- Usare un costruttore di siti a tua scelta per completare il progetto. Assicurati di incorporare tutti i file dal nostro repository GitHub. -When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. +Quando hai finito, assicurati che una demo funzionante del tuo progetto sia ospitata pubblicamente da qualche parte. Quindi invia l'URL nel campo `Solution Link`. Facoltativamente, invia anche un link al codice sorgente del tuo progetto nel campo `GitHub Link`. -The `package.json` file is the center of any Node.js project or npm package. It stores information about your project, similar to how the <head> section of an HTML document describes the content of a webpage. It consists of a single JSON object where information is stored in key-value pairs. There are only two required fields; "name" and "version", but it’s good practice to provide additional information about your project that could be useful to future users or maintainers. +Il file `package.json` è il centro di qualsiasi progetto Node.js o pacchetto npm. Memorizza informazioni sul tuo progetto, in modo simile a come la sezione <head> di un documento HTML descrive il contenuto di una pagina web. Consiste di un singolo oggetto JSON dove le informazioni sono memorizzate in coppie chiave-valore. Ci sono solo due campi obbligatori; "name" e "version", ma è buona pratica fornire ulteriori informazioni sul tuo progetto che potrebbero essere utili per futuri utenti o manutentori. -If you look at the file tree of your project, you will find the package.json file on the top level of the tree. This is the file that you will be improving in the next couple of challenges. +Se guardi l'albero dei file del tuo progetto, troverai il file package.json al livello superiore dell'albero. Questo è il file che andremo a migliorare nelle prossime due sfide. -One of the most common pieces of information in this file is the `author` field. It specifies who created the project, and can consist of a string or an object with contact or other details. An object is recommended for bigger projects, but a simple string like the following example will do for this project. +Una delle informazioni più comuni in questo file è il campo `author`. Specifica chi ha creato il progetto e può consistere in una stringa o un oggetto con informazioni di contatto o altri dettagli. Un oggetto è consigliato per progetti più grandi, ma una semplice stringa come l'esempio seguente farà al caso nostro per questo progetto. ```json "author": "Jane Doe", @@ -28,13 +28,13 @@ One of the most common pieces of information in this file is the `author` field. # --instructions-- -Add your name as the `author` of the project in the package.json file. +Aggiungi il tuo nome come `author` del progetto nel file package.json. -**Note:** Remember that you’re writing JSON, so all field names must use double-quotes (") and be separated with a comma (,). +**Nota:** Ricorda che stai scrivendo JSON, quindi tutti i nomi dei campi devono usare virgolette doppie (") ed essere separati con una virgola (,). # --hints-- -package.json should have a valid "author" key +package.json deve avere una chiave "author" valida ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/manage-npm-dependencies-by-understanding-semantic-versioning.md b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/manage-npm-dependencies-by-understanding-semantic-versioning.md index c1b6abac8a..8c7c88bf0f 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/manage-npm-dependencies-by-understanding-semantic-versioning.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/manage-npm-dependencies-by-understanding-semantic-versioning.md @@ -1,6 +1,6 @@ --- id: 587d7fb5367417b2b2512c01 -title: Manage npm Dependencies By Understanding Semantic Versioning +title: Gestire le dipendenze npm comprendendo il versioning semantico challengeType: 2 forumTopicId: 301529 dashedName: manage-npm-dependencies-by-understanding-semantic-versioning @@ -8,23 +8,23 @@ dashedName: manage-npm-dependencies-by-understanding-semantic-versioning # --description-- -`Versions` of the npm packages in the dependencies section of your package.json file follow what’s called Semantic Versioning (SemVer), an industry standard for software versioning aiming to make it easier to manage dependencies. Libraries, frameworks or other tools published on npm should use SemVer in order to clearly communicate what kind of changes projects can expect if they update. +Il campo `versions` nella sezione delle dipendenze del tuo pacchetto npm segue quello che si chiama Versioning Semantico (SemVer), uno standard di settore per la versione del software al fine di rendere più facile la gestione delle dipendenze. Le librerie, i framework o altri strumenti pubblicati su npm dovrebbero utilizzare SemVer per comunicare chiaramente che tipo di cambiamenti i progetti possono aspettarsi se essi vengono aggiornati. -Knowing SemVer can be useful when you develop software that uses external dependencies (which you almost always do). One day, your understanding of these numbers will save you from accidentally introducing breaking changes to your project without understanding why things that worked yesterday suddenly don’t work today. This is how Semantic Versioning works according to the official website: +Conoscere SemVer può essere utile quando si sviluppa un software che utilizza dipendenze esterne (cosa che avviene quasi sempre). Un giorno, la tua comprensione di questi numeri ti salverà dall'introduzione accidentale di cambiamenti che potrebbero bloccare il tuo progetto senza capire perché le cose che hanno funzionato fino a ieri improvvisamente non funzionano più oggi. Questo è come il Semantic Versioning funziona secondo il sito ufficiale: ```json "package": "MAJOR.MINOR.PATCH" ``` -The MAJOR version should increment when you make incompatible API changes. The MINOR version should increment when you add functionality in a backwards-compatible manner. The PATCH version should increment when you make backwards-compatible bug fixes. This means that PATCHes are bug fixes and MINORs add new features but neither of them break what worked before. Finally, MAJORs add changes that won’t work with earlier versions. +La versione MAJOR dovrebbe essere incrementata quando si effettuano modifiche API incompatibili. La versione MINOR dovrebbe essere incrementata quando si aggiungono funzionalità in modo retrocompatibile. La versione PATCH dovrebbe essere incrementata quando si fanno correzioni di bug retrocompatibili. Ciò significa che le PATCHes sono correzioni di bug e le MINOR aggiungono nuove funzionalità, ma nessuna delle due rischia di rompere quello che funzionava prima. Infine, le MAJORs aggiungono modifiche che non funzioneranno con le versioni precedenti. # --instructions-- -In the dependencies section of your package.json file, change the `version` of moment to match MAJOR version 2, MINOR version 10 and PATCH version 2 +Nella sezione dependencies del tuo file package.json, cambia la `version` di moment per farlo corrispondere alla versione MAJOR 2, alla versione MINOR 10 e alla versione PATCH 2 # --hints-- -"dependencies" should include "moment" +"dependencies" dovrebbe includere "moment" ```js (getUserInput) => @@ -43,7 +43,7 @@ In the dependencies section of your package.json file, change the `version` of m ); ``` -"moment" version should be "2.10.2" +La versione di "moment" dovrebbe essere "2.10.2" ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/remove-a-package-from-your-dependencies.md b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/remove-a-package-from-your-dependencies.md index b1b7b32731..85216edce0 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/remove-a-package-from-your-dependencies.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/remove-a-package-from-your-dependencies.md @@ -1,6 +1,6 @@ --- id: 587d7fb5367417b2b2512c04 -title: Remove a Package from Your Dependencies +title: Rimuovere un pacchetto dalle tue dipendenze challengeType: 2 forumTopicId: 301530 dashedName: remove-a-package-from-your-dependencies @@ -8,21 +8,21 @@ dashedName: remove-a-package-from-your-dependencies # --description-- -You have now tested a few ways you can manage dependencies of your project by using the package.json's dependencies section. You have also included external packages by adding them to the file and even told npm what types of versions you want, by using special characters such as the tilde or the caret. +Ora hai testato alcuni modi per gestire le dipendenze del tuo progetto utilizzando la sezione delle dipendenze di package.json. Hai anche incluso dei pacchetti esterni aggiungendoli al file e hai detto a npm quali tipi di versioni desideri, utilizzando caratteri speciali come la tilde o il cursore. -But what if you want to remove an external package that you no longer need? You might already have guessed it, just remove the corresponding key-value pair for that package from your dependencies. +Ma cosa dovresti fare per rimuovere un pacchetto esterno di cui non hai più bisogno? Potresti già averlo indovinato, basta rimuovere dalle dipendenze la coppia chiave-valore corrispondente a quel pacchetto. -This same method applies to removing other fields in your package.json as well +Questo stesso metodo si applica anche alla rimozione di altri campi nel tuo package.json # --instructions-- -Remove the moment package from your dependencies. +Rimuovi il pacchetto moment dalle tue dipendenze. -**Note:** Make sure you have the right amount of commas after removing it. +**Nota:** Assicurati di avere la giusta quantità di virgole dopo averlo rimosso. # --hints-- -"dependencies" should not include "moment" +"dependencies" non dovrebbe includere "moment" ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/use-the-caret-character-to-use-the-latest-minor-version-of-a-dependency.md b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/use-the-caret-character-to-use-the-latest-minor-version-of-a-dependency.md index a39adcd533..801c231eea 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/use-the-caret-character-to-use-the-latest-minor-version-of-a-dependency.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/use-the-caret-character-to-use-the-latest-minor-version-of-a-dependency.md @@ -1,6 +1,6 @@ --- id: 587d7fb5367417b2b2512c03 -title: Use the Caret-Character to Use the Latest Minor Version of a Dependency +title: Usare il simbolo del cursore per specificare l'ultima versione minore di una dipendenza challengeType: 2 forumTopicId: 301531 dashedName: use-the-caret-character-to-use-the-latest-minor-version-of-a-dependency @@ -8,25 +8,25 @@ dashedName: use-the-caret-character-to-use-the-latest-minor-version-of-a-depende # --description-- -Similar to how the tilde we learned about in the last challenge allows npm to install the latest PATCH for a dependency, the caret (`^`) allows npm to install future updates as well. The difference is that the caret will allow both MINOR updates and PATCHes. +Simile a come la tilde che abbiamo imparato nell'ultima sfida permette a npm di installare l'ultima PATCH per una dipendenza, il cursore (caret, `^`) permette a npm di installare anche aggiornamenti futuri. La differenza è che il cursore permetterà sia gli aggiornamenti MINOR che le PATCHes. -Your current version of moment should be "~2.10.2" which allows npm to install to the latest 2.10.x version. If you were to use the caret (^) as a version prefix instead, npm would be allowed to update to any 2.x.x version. +La tua versione attuale di moment dovrebbe essere "~2.10.2" che permette a npm di installare l'ultima versione 2.10.x. Se invece dovessi usare il cursore (^) come prefisso di versione, npm avrebbe il permesso di aggiornare a qualsiasi versione 2.x.x. ```json "package": "^1.3.8" ``` -This would allow updates to any 1.x.x version of the package. +Questo permetterebbe di aggiornare qualsiasi versione 1.x.x del pacchetto. # --instructions-- -Use the caret (`^`) to prefix the version of moment in your dependencies and allow npm to update it to any new MINOR release. +Usa il cursore (`^`) per prefissare la versione di moment nelle tue dipendenze e consentire a npm di aggiornarlo a qualsiasi nuova versione MINOR. -**Note:** The version numbers themselves should not be changed. +**Nota:** I numeri di versione non devono essere modificati. # --hints-- -"dependencies" should include "moment" +"dependencies" dovrebbe includere "moment" ```js (getUserInput) => @@ -45,7 +45,7 @@ Use the caret (`^`) to prefix the version of moment in your dependencies and all ); ``` -"moment" version should match "^2.x.x" +La versione di "moment" dovrebbe corrispondere a "^2.x.x" ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/use-the-tilde-character-to-always-use-the-latest-patch-version-of-a-dependency.md b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/use-the-tilde-character-to-always-use-the-latest-patch-version-of-a-dependency.md index 564df74a9d..d29ae386ea 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/use-the-tilde-character-to-always-use-the-latest-patch-version-of-a-dependency.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/managing-packages-with-npm/use-the-tilde-character-to-always-use-the-latest-patch-version-of-a-dependency.md @@ -1,6 +1,6 @@ --- id: 587d7fb5367417b2b2512c02 -title: Use the Tilde-Character to Always Use the Latest Patch Version of a Dependency +title: Usare il carattere tilde per utilizzare sempre l'ultima versione patch di una dipendenza challengeType: 2 forumTopicId: 301532 dashedName: use-the-tilde-character-to-always-use-the-latest-patch-version-of-a-dependency @@ -8,9 +8,9 @@ dashedName: use-the-tilde-character-to-always-use-the-latest-patch-version-of-a- # --description-- -In the last challenge, you told npm to only include a specific version of a package. That’s a useful way to freeze your dependencies if you need to make sure that different parts of your project stay compatible with each other. But in most use cases, you don’t want to miss bug fixes since they often include important security patches and (hopefully) don’t break things in doing so. +Nell'ultima sfida, hai detto a npm di includere solo una versione specifica di un pacchetto. Questo è un modo utile per congelare le tue dipendenze, se hai bisogno di assicurarti che diverse parti del tuo progetto rimangano compatibili tra loro. Ma nella maggior parte dei casi d'uso, non vuoi perdere le correzioni di bug dal momento che spesso includono importanti patch di sicurezza e (si spera) non rompono le cose nel farlo. -To allow an npm dependency to update to the latest PATCH version, you can prefix the dependency’s version with the tilde (`~`) character. Here's an example of how to allow updates to any 1.3.x version. +Per consentire a una dipendenza npm di aggiornare all'ultima versione PATCH, è possibile prefissare la versione della dipendenza con il carattere tilde (`~`). Ecco un esempio di come consentire gli aggiornamenti di qualsiasi versione 1.3.x. ```json "package": "~1.3.8" @@ -18,15 +18,15 @@ To allow an npm dependency to update to the latest PATCH version, you can prefix # --instructions-- -In the package.json file, your current rule for how npm may upgrade moment is to use a specific version (2.10.2). But now, you want to allow the latest 2.10.x version. +Nel file package.json, la tua regola corrente per come npm potrebbe aggiornare moment è usare una versione specifica (2.10.2). Ma ora desideriamo consentire l'ultima versione 2.10.x. -Use the tilde (`~`) character to prefix the version of moment in your dependencies, and allow npm to update it to any new PATCH release. +Usa il carattere tilde (`~`) per prefissare la versione di moment nelle tue dipendenze, e consentire a npm di aggiornarlo a qualsiasi nuova release PATCH. -**Note:** The version numbers themselves should not be changed. +**Nota:** I numeri di versione non devono essere modificati. # --hints-- -"dependencies" should include "moment" +"dependencies" dovrebbe includere "moment" ```js (getUserInput) => @@ -45,7 +45,7 @@ Use the tilde (`~`) character to prefix the version of moment in your dependenci ); ``` -"moment" version should match "~2.10.2" +La versione di "moment" dovrebbe corrispondere a "~2.10.2" ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/chain-search-query-helpers-to-narrow-search-results.md b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/chain-search-query-helpers-to-narrow-search-results.md index 12be099f8a..4f90100ab5 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/chain-search-query-helpers-to-narrow-search-results.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/chain-search-query-helpers-to-narrow-search-results.md @@ -1,6 +1,6 @@ --- id: 587d7fb9367417b2b2512c12 -title: Chain Search Query Helpers to Narrow Search Results +title: Concatenare gli helper delle query per restringere i risultati di ricerca challengeType: 2 forumTopicId: 301533 dashedName: chain-search-query-helpers-to-narrow-search-results @@ -8,15 +8,15 @@ dashedName: chain-search-query-helpers-to-narrow-search-results # --description-- -If you don’t pass the callback as the last argument to `Model.find()` (or to the other search methods), the query is not executed. You can store the query in a variable for later use. This kind of object enables you to build up a query using chaining syntax. The actual db search is executed when you finally chain the method `.exec()`. You always need to pass your callback to this last method. There are many query helpers, here we'll use the most commonly used. +Se non si passa la callback come ultimo argomento a `Model.find()` (o agli altri metodi di ricerca), la query non viene eseguita. È possibile memorizzare la query in una variabile per un uso successivo. Questo tipo di oggetto ti permette di costruire una query usando la sintassi di concatenazione. L'effettiva ricerca nel database viene eseguita quando alla fine concateni il metodo `.exec()`. Hai sempre bisogno di passare la tua callback a questo ultimo metodo. Ci sono molti helper di query: qui useremo i più comuni. # --instructions-- -Modify the `queryChain` function to find people who like the food specified by the variable named `foodToSearch`. Sort them by `name`, limit the results to two documents, and hide their age. Chain `.find()`, `.sort()`, `.limit()`, `.select()`, and then `.exec()`. Pass the `done(err, data)` callback to `exec()`. +Modifica la funzione `queryChain` per trovare persone a cui piace il cibo specificato dalla variabile denominata `foodToSearch`. Ordina per `name`, limita i risultati a due documenti e nascondi la loro età. Concatena `.find()`, `.sort()`, `.limit()`, `.select()`, e quindi `.exec()`. Passa la callback `done(err, data)` a `exec()`. # --hints-- -Chaining query helpers should succeed +La concatenazione degli helper delle query dovrebbe avere successo ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/create-a-model.md b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/create-a-model.md index 1e7e686d23..2df8f15f98 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/create-a-model.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/create-a-model.md @@ -1,6 +1,6 @@ --- id: 587d7fb6367417b2b2512c07 -title: Create a Model +title: Creare un modello challengeType: 2 forumTopicId: 301535 dashedName: create-a-model @@ -8,13 +8,13 @@ dashedName: create-a-model # --description-- -**C**RUD Part I - CREATE +**C**RUD Parte I - CREATE -First of all we need a Schema. Each schema maps to a MongoDB collection. It defines the shape of the documents within that collection. Schemas are building block for Models. They can be nested to create complex models, but in this case we'll keep things simple. A model allows you to create instances of your objects, called documents. +Innanzi tutto abbiamo bisogno di uno Schema. Ogni schema mappa a una collezione MongoDB. Definisce la forma dei documenti all'interno di quella collezione. Gli schemi sono elementi costitutivi dei modelli. Possono essere annidati per creare modelli complessi, ma per ora terremo le cose semplici. Un modello ti permette di creare istanze dei tuoi oggetti, chiamate documenti. -Replit is a real server, and in real servers the interactions with the database happen in handler functions. These functions are executed when some event happens (e.g. someone hits an endpoint on your API). We’ll follow the same approach in these exercises. The `done()` function is a callback that tells us that we can proceed after completing an asynchronous operation such as inserting, searching, updating, or deleting. It's following the Node convention, and should be called as `done(null, data)` on success, or `done(err)` on error. +Replit è un vero server, e nei server reali le interazioni con il database avvengono nelle funzioni del gestore. Queste funzioni vengono eseguite quando si verifica qualche evento (ad esempio, qualcuno raggiunge un endpoint sulla tua API). Seguiremo lo stesso approccio in questi esercizi. La funzione `done()` è una callback che ci dice che possiamo procedere dopo aver completato un'operazione asincrona come l'inserimento, la ricerca, l'aggiornamento o la cancellazione. Segue la convenzione Node e dovrebbe essere chiamata come `done(null, data)` in caso di successo, o `done(err)` in caso di errore. -Warning - When interacting with remote services, errors may occur! +Attenzione - Quando interagisci con i servizi remoti, potrebbero verificarsi degli errori! ```js /* Example */ @@ -28,7 +28,7 @@ const someFunc = function(done) { # --instructions-- -Create a person schema called `personSchema` having this prototype: +Crea uno schema persona chiamato `personSchema` con questo prototipo: ```markup - Person Prototype - @@ -38,13 +38,13 @@ age : number favoriteFoods : array of strings (*) ``` -Use the Mongoose basic schema types. If you want you can also add more fields, use simple validators like required or unique, and set default values. See the [Mongoose docs](http://mongoosejs.com/docs/guide.html). +Utilizzare i tipi di schema base di Mongoose. Se vuoi puoi anche aggiungere più campi, utilizzare semplici validatori come required o unique, e impostare dei valori predefiniti. Vedi i [Mongoose docs](http://mongoosejs.com/docs/guide.html). -Now, create a model called `Person` from the `personSchema`. +Ora, crea un modello chiamato `Person` da `personSchema`. # --hints-- -Creating an instance from a mongoose schema should succeed +Creare un'istanza da uno schema mongoose dovrebbe avere successo ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/create-and-save-a-record-of-a-model.md b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/create-and-save-a-record-of-a-model.md index ae385b6b21..569337c66a 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/create-and-save-a-record-of-a-model.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/create-and-save-a-record-of-a-model.md @@ -1,6 +1,6 @@ --- id: 587d7fb6367417b2b2512c09 -title: Create and Save a Record of a Model +title: Creare e salvare un record di un modello challengeType: 2 forumTopicId: 301536 dashedName: create-and-save-a-record-of-a-model @@ -8,11 +8,11 @@ dashedName: create-and-save-a-record-of-a-model # --description-- -In this challenge you will have to create and save a record of a model. +In questa sfida dovrai creare e salvare un record di un modello. # --instructions-- -Within the `createAndSavePerson` function, create a document instance using the `Person` model constructor you built before. Pass to the constructor an object having the fields `name`, `age`, and `favoriteFoods`. Their types must conform to the ones in the `personSchema`. Then, call the method `document.save()` on the returned document instance. Pass to it a callback using the Node convention. This is a common pattern; all the following CRUD methods take a callback function like this as the last argument. +All'interno della funzione `createAndSavePerson`, crea un'istanza di documento usando il costruttore del modello `Person` che hai costruito prima. Passa al costruttore un oggetto con i campi `name`, `age`e `favoriteFoods`. I loro tipi devono essere conformi a quelli di `personSchema`. Quindi, chiama il metodo `document.save()` sull'istanza di documento restituita. Passa ad essa una callback usando la convenzione di Node. Questo è un modello comune; tutti i metodi CRUD seguenti prendono una funzione di callback come questa come ultimo argomento. ```js /* Example */ @@ -25,7 +25,7 @@ person.save(function(err, data) { # --hints-- -Creating and saving a db item should succeed +Si dovrebbe creare e salvare con successo un elemento del database ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/create-many-records-with-model.create.md b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/create-many-records-with-model.create.md index 08812efbd1..dec849b31a 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/create-many-records-with-model.create.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/create-many-records-with-model.create.md @@ -1,6 +1,6 @@ --- id: 587d7fb7367417b2b2512c0a -title: Create Many Records with model.create() +title: Creare diversi record con model.create() challengeType: 2 forumTopicId: 301537 dashedName: create-many-records-with-model-create @@ -8,17 +8,17 @@ dashedName: create-many-records-with-model-create # --description-- -Sometimes you need to create many instances of your models, e.g. when seeding a database with initial data. `Model.create()` takes an array of objects like `[{name: 'John', ...}, {...}, ...]` as the first argument, and saves them all in the db. +A volte avrai bisogno di creare molte istanze dei tuoi modelli, ad esempio quando fai il seeding (semina) di un database con i dati iniziali. `Model.create()` prende un array di oggetti come `[{name: 'John', ...}, {...}, ...]` come primo argomento, e li salva tutti nel database. # --instructions-- -Modify the `createManyPeople` function to create many people using `Model.create()` with the argument `arrayOfPeople`. +Modifica la funzione `createManyPeople` per creare molte persone usando `Model.create()` con l'argomento `arrayOfPeople`. -**Note:** You can reuse the model you instantiated in the previous exercise. +**Nota:** Puoi riutilizzare il modello che hai istanziato nell'esercizio precedente. # --hints-- -Creating many db items at once should succeed +La creazione di molti oggetti db contemporaneamente dovrebbe avere successo ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/delete-many-documents-with-model.remove.md b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/delete-many-documents-with-model.remove.md index 7709b5fd5d..4ea4907302 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/delete-many-documents-with-model.remove.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/delete-many-documents-with-model.remove.md @@ -1,6 +1,6 @@ --- id: 587d7fb8367417b2b2512c11 -title: Delete Many Documents with model.remove() +title: Eliminare molti documenti con model.remove() challengeType: 2 forumTopicId: 301538 dashedName: delete-many-documents-with-model-remove @@ -8,17 +8,17 @@ dashedName: delete-many-documents-with-model-remove # --description-- -`Model.remove()` is useful to delete all the documents matching given criteria. +`Model.remove()` è utile per eliminare tutti i documenti corrispondenti ai criteri indicati. # --instructions-- -Modify the `removeManyPeople` function to delete all the people whose name is within the variable `nameToRemove`, using `Model.remove()`. Pass it to a query document with the `name` field set, and a callback. +Modifica la funzione `removeManyPeople` per eliminare tutte le persone il cui nome è all'interno della variabile `nameToRemove`, usando `Model.remove()`. Passalo a un documento di query con il campo `name` impostato e una callback. -**Note:** The `Model.remove()` doesn’t return the deleted document, but a JSON object containing the outcome of the operation, and the number of items affected. Don’t forget to pass it to the `done()` callback, since we use it in tests. +**Nota:** `Model.remove()` non restituisce il documento eliminato, ma un oggetto JSON contenente l'esito dell'operazione e il numero di elementi interessati. Non dimenticate di passarlo alla callback `done()`, dal momento che lo utilizzeremo nei test. # --hints-- -Deleting many items at once should succeed +L'eliminazione di molti oggetti contemporaneamente dovrebbe avere successo ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/delete-one-document-using-model.findbyidandremove.md b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/delete-one-document-using-model.findbyidandremove.md index f010b51c40..82290c8e90 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/delete-one-document-using-model.findbyidandremove.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/delete-one-document-using-model.findbyidandremove.md @@ -1,6 +1,6 @@ --- id: 587d7fb8367417b2b2512c10 -title: Delete One Document Using model.findByIdAndRemove +title: Eliminare un documento usando model.findByIdAndRemove challengeType: 2 forumTopicId: 301539 dashedName: delete-one-document-using-model-findbyidandremove @@ -8,15 +8,15 @@ dashedName: delete-one-document-using-model-findbyidandremove # --description-- -`findByIdAndRemove` and `findOneAndRemove` are like the previous update methods. They pass the removed document to the db. As usual, use the function argument `personId` as the search key. +`findByIdAndRemove` e `findOneAndRemove` sono come i metodi di aggiornamento precedenti. Passano il documento rimosso al database. Come al solito, usa l'argomento `personId` della funzione come chiave di ricerca. # --instructions-- -Modify the `removeById` function to delete one person by the person's `_id`. You should use one of the methods `findByIdAndRemove()` or `findOneAndRemove()`. +Modifica la funzione `removeById` in modo che elimini una persona in base al suo `_id`. È necessario utilizzare i metodi `findByIdAndRemove()` o `findOneAndRemove()`. # --hints-- -Deleting an item should succeed +L'eliminazione di un elemento dovrebbe avere successo ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/install-and-set-up-mongoose.md b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/install-and-set-up-mongoose.md index 88c275d62d..349b0837fe 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/install-and-set-up-mongoose.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/install-and-set-up-mongoose.md @@ -1,6 +1,6 @@ --- id: 587d7fb6367417b2b2512c06 -title: Install and Set Up Mongoose +title: Installare e configurare Mongoose challengeType: 2 forumTopicId: 301540 dashedName: install-and-set-up-mongoose @@ -8,21 +8,21 @@ dashedName: install-and-set-up-mongoose # --description-- -Working on these challenges will involve you writing your code using one of the following methods: +Lavorare su queste sfide ti porterà a scrivere il tuo codice utilizzando uno dei seguenti metodi: -- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-mongomongoose/) and complete these challenges locally. -- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-mongomongoose) to complete these challenges. -- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. +- Clonare [questo repository GitHub](https://github.com/freeCodeCamp/boilerplate-mongomongoose/) e completare queste sfide localmente. +- Usare [il nostro progetto di avvio Replit](https://replit.com/github/freeCodeCamp/boilerplate-mongomongoose) per completare queste sfide. +- Usa un costruttore di siti a tua scelta per completare il progetto. Assicurati di incorporare tutti i file dal nostro repository GitHub. -When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. +Quando hai finito, assicurati che una demo funzionante del tuo progetto sia ospitata pubblicamente da qualche parte. Quindi invia l'URL nel campo `Solution Link`. -In this challenge, you will set up a MongoDB Atlas database and import the required packages to connect to it. +In questa sfida, imposterai un database MongoDB Atlas e importerai i pacchetti necessari per connetterti ad esso. -Follow this tutorial to set up a hosted database on MongoDB Atlas. +Segui questo tutorial per impostare un database ospitato su MongoDB Atlas. # --instructions-- -Add `mongodb` and `mongoose` to the project’s `package.json`. Then, require mongoose as `mongoose` in `myApp.js`. Create a `.env` file and add a `MONGO_URI` variable to it. Its value should be your MongoDB Atlas database URI. Be sure to surround the URI with single or double quotes, and remember that you can't use spaces around the `=` in environment variables. For example, `MONGO_URI='VALUE'`. When you are done, connect to the database using the following syntax: +Aggiungi `mongodb` e `mongoose` al `package.json` del progetto. Poi, richiedi mongoose come `mongoose` in `myApp.js`. Crea un file `.env` e aggiungi una variabile `MONGO_URI` ad esso. Il suo valore dovrebbe essere l'URI del database MongoDB Atlas. Assicurati di racchiudere l'URI tra virgolette singole o doppie, e ricorda che non puoi usare spazi attorno al segno `=` nelle variabili d'ambiente. Ad esempio, `MONGO_URI='VALUE'`. Quando hai finito, connettiti al database usando la seguente sintassi: ```js mongoose.connect(, { useNewUrlParser: true, useUnifiedTopology: true }); @@ -30,7 +30,7 @@ mongoose.connect(, { useNewUrlParser: true, useUnifiedTopology: true } # --hints-- -"mongodb" dependency should be in package.json +la dipendenza "mongodb" dovrebbe essere specificata in package.json ```js (getUserInput) => @@ -45,7 +45,7 @@ mongoose.connect(, { useNewUrlParser: true, useUnifiedTopology: true } ); ``` -"mongoose" dependency should be in package.json +la dipendenza "mongoose" dovrebbe essere specificata in package.json ```js (getUserInput) => @@ -60,7 +60,7 @@ mongoose.connect(, { useNewUrlParser: true, useUnifiedTopology: true } ); ``` -"mongoose" should be connected to a database +"mongoose" dovrebbe essere connesso a un database ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/perform-classic-updates-by-running-find-edit-then-save.md b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/perform-classic-updates-by-running-find-edit-then-save.md index ecbb514dac..05ecb03fc7 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/perform-classic-updates-by-running-find-edit-then-save.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/perform-classic-updates-by-running-find-edit-then-save.md @@ -1,6 +1,6 @@ --- id: 587d7fb8367417b2b2512c0e -title: 'Perform Classic Updates by Running Find, Edit, then Save' +title: 'Eseguire classici aggiornamenti eseguendo Find, Edit e Save' challengeType: 2 forumTopicId: 301541 dashedName: perform-classic-updates-by-running-find-edit-then-save @@ -8,17 +8,17 @@ dashedName: perform-classic-updates-by-running-find-edit-then-save # --description-- -In the good old days, this was what you needed to do if you wanted to edit a document, and be able to use it somehow (e.g. sending it back in a server response). Mongoose has a dedicated updating method: `Model.update()`. It is bound to the low-level mongo driver. It can bulk-edit many documents matching certain criteria, but it doesn’t send back the updated document, only a 'status' message. Furthermore, it makes model validations difficult, because it just directly calls the mongo driver. +Nei bei tempi andati, questo era quello che dovevi fare se volevi modificare un documento, ed essere in grado di usarlo in qualche modo (ad esempio restituendolo in una risposta del server). Mongoose ha un metodo di aggiornamento dedicato: `Model.update()`. Esso è legato al driver di basso livello di mongo. Può modificare contemporaneamente più documenti che corrispondono a determinati criteri, ma non restituisce il documento aggiornato, solo un messaggio di 'stato'. Inoltre, rende difficile le validazioni del modello, perché chiama direttamente il driver di mongo. # --instructions-- -Modify the `findEditThenSave` function to find a person by `_id` (use any of the above methods) with the parameter `personId` as search key. Add `"hamburger"` to the list of the person's `favoriteFoods` (you can use `Array.push()`). Then - inside the find callback - `save()` the updated `Person`. +Modifica la funzione `findEditThenSave` per trovare una persona in base al suo `_id` (utilizza uno qualsiasi dei metodi visti in precedenza) con il parametro `personId` come chiave di ricerca. Aggiungi `"hamburger"` alla lista dei `favoriteFoods` della persona (puoi usare `Array.push()`). Quindi - all'interno della callback find - salva (`save()`) la `Person` aggiornata. -**Note:** This may be tricky, if in your Schema, you declared `favoriteFoods` as an Array, without specifying the type (i.e. `[String]`). In that case, `favoriteFoods` defaults to Mixed type, and you have to manually mark it as edited using `document.markModified('edited-field')`. See [Mongoose documentation](https://mongoosejs.com/docs/schematypes.html#Mixed) +**Nota:** Potrebbe essere complicato, se nel tuo Schema, hai dichiarato `favoriteFoods` come Array, senza specificare il tipo (cioè `[String]`). In questo caso, `favoriteFoods` prende di default il tipo misto, e devi contrassegnarlo manualmente come modificato utilizzando `document.markModified('edited-field')`. Vedi la [Documentazione di Mongoose](https://mongoosejs.com/docs/schematypes.html#Mixed) # --hints-- -Find-edit-update an item should succeed +Il Find-edit-update di un elemento dovrebbe avere successo ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/perform-new-updates-on-a-document-using-model.findoneandupdate.md b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/perform-new-updates-on-a-document-using-model.findoneandupdate.md index ddd4ecd80a..1fa813653e 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/perform-new-updates-on-a-document-using-model.findoneandupdate.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/perform-new-updates-on-a-document-using-model.findoneandupdate.md @@ -1,6 +1,6 @@ --- id: 587d7fb8367417b2b2512c0f -title: Perform New Updates on a Document Using model.findOneAndUpdate() +title: Eseguire nuovi aggiornamenti su un documento utilizzando model.findOneAndUpdate() challengeType: 2 forumTopicId: 301542 dashedName: perform-new-updates-on-a-document-using-model-findoneandupdate @@ -8,17 +8,17 @@ dashedName: perform-new-updates-on-a-document-using-model-findoneandupdate # --description-- -Recent versions of Mongoose have methods to simplify documents updating. Some more advanced features (i.e. pre/post hooks, validation) behave differently with this approach, so the classic method is still useful in many situations. `findByIdAndUpdate()` can be used when searching by id. +Le versioni recenti di Mongoose hanno metodi per semplificare l'aggiornamento dei documenti. Alcune caratteristiche più avanzate (cioè gli agganci pre/post validazione) si comportano in modo diverso con questo approccio, quindi il metodo classico è ancora utile in molte situazioni. `findByIdAndUpdate()` può essere usato durante la ricerca tramite id. # --instructions-- -Modify the `findAndUpdate` function to find a person by `Name` and set the person's age to `20`. Use the function parameter `personName` as the search key. +Modifica la funzione `findAndUpdate` per trovare una persona in base al suo `Name` e impostare l'età della persona a `20`. Utilizza il parametro `personName` della funzione come chiave di ricerca. -**Note:** You should return the updated document. To do that, you need to pass the options document `{ new: true }` as the 3rd argument to `findOneAndUpdate()`. By default, these methods return the unmodified object. +**Nota:** Dovresti restituire il documento aggiornato. Per farlo, dovresti passare il documento di opzioni `{ new: true }` come terzo argomento a `findOneAndUpdate()`. Per impostazione predefinita, questi metodi restituiscono l'oggetto non modificato. # --hints-- -findOneAndUpdate an item should succeed +findOneAndUpdate su un elemento dovrebbe avere successo ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/use-model.find-to-search-your-database.md b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/use-model.find-to-search-your-database.md index a3e22a5b1e..1a0b8d5f5d 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/use-model.find-to-search-your-database.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/use-model.find-to-search-your-database.md @@ -1,6 +1,6 @@ --- id: 587d7fb7367417b2b2512c0b -title: Use model.find() to Search Your Database +title: Usare model.find() per fare ricerche nel database challengeType: 2 forumTopicId: 301543 dashedName: use-model-find-to-search-your-database @@ -8,17 +8,17 @@ dashedName: use-model-find-to-search-your-database # --description-- -In its simplest usage, `Model.find()` accepts a query document (a JSON object) as the first argument, then a callback. It returns an array of matches. It supports an extremely wide range of search options. Read more in the docs. +Nel suo uso più semplice, `Model.find()` accetta un documento di query (un oggetto JSON) come primo argomento, quindi una callback. Restituisce un array di corrispondenze. Supporta una gamma estremamente ampia di opzioni di ricerca. Per approfondimenti leggi la documentazione. # --instructions-- -Modify the `findPeopleByName` function to find all the people having a given name, using Model.find() -\> [Person] +Modifica la funzione `findPeopleByName` per trovare tutte le persone che hanno un dato nome, usando Model.find() -\> [Person] -Use the function argument `personName` as the search key. +Usa l'argomento `personName` della funzione come chiave di ricerca. # --hints-- -Find all items corresponding to a criteria should succeed +La ricerca di tutti gli elementi corrispondenti a un criterio dovrebbe avere successo ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/use-model.findbyid-to-search-your-database-by-id.md b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/use-model.findbyid-to-search-your-database-by-id.md index 36c2b551e1..c7af979995 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/use-model.findbyid-to-search-your-database-by-id.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/use-model.findbyid-to-search-your-database-by-id.md @@ -1,6 +1,6 @@ --- id: 587d7fb7367417b2b2512c0d -title: Use model.findById() to Search Your Database By _id +title: Usare model.findById() per cercare nel database in base all'_id challengeType: 2 forumTopicId: 301544 dashedName: use-model-findbyid-to-search-your-database-by-id @@ -8,15 +8,15 @@ dashedName: use-model-findbyid-to-search-your-database-by-id # --description-- -When saving a document, MongoDB automatically adds the field `_id`, and set it to a unique alphanumeric key. Searching by `_id` is an extremely frequent operation, so Mongoose provides a dedicated method for it. +Quando si salva un documento, MongoDB aggiunge automaticamente il campo `_id` e lo imposta su una chiave alfanumerica univoca. La ricerca per `_id` è un'operazione estremamente frequente, quindi Mongoose fornisce un metodo dedicato ad essa. # --instructions-- -Modify the `findPersonById` to find the only person having a given `_id`, using `Model.findById() -> Person`. Use the function argument `personId` as the search key. +Modifica il `findPersonById` per trovare l'unica persona che abbia un certo `_id` utilizzando `Model.findById() -> Person`. Usa l'argomento `personId` della funzione come chiave di ricerca. # --hints-- -Find an item by Id should succeed +La ricerca di un elemento per Id dovrebbe avere successo ```js (getUserInput) => diff --git a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/use-model.findone-to-return-a-single-matching-document-from-your-database.md b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/use-model.findone-to-return-a-single-matching-document-from-your-database.md index e7f9c78278..fa40599d1a 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/use-model.findone-to-return-a-single-matching-document-from-your-database.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/mongodb-and-mongoose/use-model.findone-to-return-a-single-matching-document-from-your-database.md @@ -1,6 +1,6 @@ --- id: 587d7fb7367417b2b2512c0c -title: Use model.findOne() to Return a Single Matching Document from Your Database +title: Usare model.findOne() per restituire un singolo documento corrispondente dal tuo database challengeType: 2 forumTopicId: 301545 dashedName: use-model-findone-to-return-a-single-matching-document-from-your-database @@ -8,15 +8,15 @@ dashedName: use-model-findone-to-return-a-single-matching-document-from-your-dat # --description-- -`Model.findOne()` behaves like `Model.find()`, but it returns only one document (not an array), even if there are multiple items. It is especially useful when searching by properties that you have declared as unique. +`Model.findOne()` si comporta come `Model.find()`, ma restituisce un solo documento (non un array), anche se ci sono più elementi. È particolarmente utile durante la ricerca per proprietà che hai dichiarato come unique (univoche). # --instructions-- -Modify the `findOneByFood` function to find just one person which has a certain food in the person's favorites, using `Model.findOne() -> Person`. Use the function argument `food` as search key. +Modifica la funzione `findOneByFood` per trovare solo una persona che abbia un certo cibo nei preferiti della persona, usando `Model.findOne() -> Person`. Usa l'argomento `food` della funzione come chiave di ricerca. # --hints-- -Find one item should succeed +La ricerca di un elemento dovrebbe avere successo ```js (getUserInput) => diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/announce-new-users.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/announce-new-users.md index fca0105f3d..78837cd134 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/announce-new-users.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/announce-new-users.md @@ -1,6 +1,6 @@ --- id: 589fc832f9fc0f352b528e78 -title: Announce New Users +title: Annunciare nuovi utenti challengeType: 2 forumTopicId: 301546 dashedName: announce-new-users @@ -8,9 +8,9 @@ dashedName: announce-new-users # --description-- -Many chat rooms are able to announce when a user connects or disconnects and then display that to all of the connected users in the chat. Seeing as though you already are emitting an event on connect and disconnect, you will just have to modify this event to support such a feature. The most logical way of doing so is sending 3 pieces of data with the event: the name of the user who connected/disconnected, the current user count, and if that name connected or disconnected. +Molte chat room sono in grado di annunciare quando un utente si connette o si disconnette e mostrarlo a tutti gli utenti connessi nella chat. Considerando che stai già emettendo un evento alla connessione e alla disconnessione, dovrai solo modificare questo evento per supportare questa caratteristica. Il modo più logico di farlo è inviare di 3 pezzi di dati con l'evento: il nome dell'utente che si è connesso/disconnesso, il conteggio corrente degli utenti, e se questo nome si è connesso o disconnesso. -Change the event name to `'user'`, and pass an object along containing the fields 'name', 'currentUsers', and 'connected' (to be `true` in case of connection, or `false` for disconnection of the user sent). Be sure to change both 'user count' events and set the disconnect one to send `false` for the field 'connected' instead of `true` like the event emitted on connect. +Cambia il nome dell'evento in `'user'` e passa insieme ad esso un oggetto contenente i campi 'name', 'currentUsers', e 'connected' (`true` in caso di connessione, o `false` per la disconnessione dell'utente inviato). Assicurati di modificare entrambi gli eventi 'user count' e impostare quello per la disconnessione in modo che invii `false` per il campo 'connected' invece di `true` come fa l'evento emesso alla connessione. ```js io.emit('user', { @@ -20,9 +20,9 @@ io.emit('user', { }); ``` -Now your client will have all the necessary information to correctly display the current user count and announce when a user connects or disconnects! To handle this event on the client side we should listen for `'user'`, then update the current user count by using jQuery to change the text of `#num-users` to `'{NUMBER} users online'`, as well as append a `
  • ` to the unordered list with id `messages` with `'{NAME} has {joined/left} the chat.'`. +Ora il tuo client avrà tutte le informazioni necessarie per visualizzare correttamente il conteggio attuale degli utenti e annunciare quando un utente si connette o si disconnette! Per gestire questo evento sul lato client dovremmo rimanere in ascolto di `'user'`, poi aggiornare il conteggio degli utenti attuali usando jQuery per cambiare il testo di `#num-users` a `'{NUMBER} users online'`, oltre ad aggiungere un `
  • ` alla lista non ordinata con id `messages` con `'{NAME} has {joined/left} the chat.'`. -An implementation of this could look like the following: +Un'implementazione di questo tipo potrebbe essere la seguente: ```js socket.on('user', data => { @@ -34,11 +34,11 @@ socket.on('user', data => { }); ``` -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/bf95a0f74b756cf0771cd62c087b8286). +Invia la tua pagina quando pensi di averlo fatto bene. Se incontri degli errori, puoi controllare il progetto completato fino a questo punto [qui](https://gist.github.com/camperbot/bf95a0f74b756cf0771cd62c087b8286). # --hints-- -Event `'user'` should be emitted with name, currentUsers, and connected. +L'evento `'user'` dovrebbe essere emesso con name, currentUsers, e connected. ```js (getUserInput) => @@ -56,7 +56,7 @@ Event `'user'` should be emitted with name, currentUsers, and connected. ); ``` -Client should properly handle and display the new data from event `'user'`. +Il client dovrebbe gestire e visualizzare correttamente i nuovi dati dall'evento `'user'`. ```js (getUserInput) => diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/authentication-strategies.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/authentication-strategies.md index 0d29b5c99a..d8f0d52340 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/authentication-strategies.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/authentication-strategies.md @@ -1,6 +1,6 @@ --- id: 5895f70df9fc0f352b528e68 -title: Authentication Strategies +title: Strategie di autenticazione challengeType: 2 forumTopicId: 301547 dashedName: authentication-strategies @@ -8,11 +8,11 @@ dashedName: authentication-strategies # --description-- -A strategy is a way of authenticating a user. You can use a strategy for allowing users to authenticate based on locally saved information (if you have them register first) or from a variety of providers such as Google or GitHub. For this project, we will set up a local strategy. To see a list of the hundreds of strategies, visit Passport's site [here](http://passportjs.org/). +Una strategia è un modo di autenticare un utente. Puoi utilizzare una strategia per permettere agli utenti di autenticarsi basandosi su informazioni salvate localmente (se li si fa prima registrare/iscrivere), o da una varietà di fornitori come Google o GitHub. Per questo progetto, imposteremo una strategia locale. Per vedere una lista delle centinaia di strategie, visita il sito Passport [qui](http://passportjs.org/). -Add `passport-local@~1.0.0` as a dependency and add it to your server as follows: `const LocalStrategy = require('passport-local');` +Aggiungi `passport-local@~1.0.0` come dipendenza ed aggiungilo al tuo server come segue: `const LocalStrategy = require('passport-local');` -Now you will have to tell passport to **use** an instantiated LocalStrategy object with a few settings defined. Make sure this (as well as everything from this point on) is encapsulated in the database connection since it relies on it! +Ora, dovrai dire a passport di **usare** un oggetto LocalStrategy istanziato con alcune impostazioni definite. Assicurati che questo (come tutto da questo punto in poi) sia compreso all'interno della connessione al database dato che si basa su di essa! ```js passport.use(new LocalStrategy( @@ -28,17 +28,17 @@ passport.use(new LocalStrategy( )); ``` -This is defining the process to use when we try to authenticate someone locally. First, it tries to find a user in our database with the username entered, then it checks for the password to match, then finally, if no errors have popped up that we checked for, like an incorrect password, the `user`'s object is returned and they are authenticated. +Questo definisce il processo da utilizzare quando proviamo ad autenticare qualcuno localmente. Innanzitutto, cerca di trovare un utente nel nostro database con il nome utente inserito, poi controlla che la password corrisponda ed infine, se non spunta nessun errore da ciò che abbiamo controllato, come una password sbagliata, l'oggetto `user` viene restituito ed è autenticato. -Many strategies are set up using different settings, but generally it is easy to set it up based on the README in that strategy's repository. A good example of this is the GitHub strategy where we don't need to worry about a username or password because the user will be sent to GitHub's auth page to authenticate. As long as they are logged in and agree then GitHub returns their profile for us to use. +Molte strategie vengono organizzate con impostazioni differenti, ma in genere sono facile da impostare basandosi sul README nel repository della strategia. Un buon esempio di questo è la strategia GitHub, dove non dobbiamo preoccuparci di nome utente e password dal momento che l'utente sarà indirizzato alla pagina di autenticazione di GitHub per autenticarsi. Una volta che sono loggati e accettano, GitHub ci restituisce il loro profilo da utilizzare. -In the next step, we will set up how to actually call the authentication strategy to validate a user based on form data! +Nel passo successivo, imposteremo il modo in cui chiamare effettivamente la strategia di autenticazione per convalidare un utente sulla base dei dati del modulo! -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/53b495c02b92adeee0aa1bd3f3be8a4b). +Invia la tua pagina quando pensi di averlo fatto correttamente. Se dovessi incontrare degli errori, puoi controllare il progetto completato fino a questo punto [qui](https://gist.github.com/camperbot/53b495c02b92adeee0aa1bd3f3be8a4b). # --hints-- -Passport-local should be a dependency. +Passport-local dovrebbe essere una dipendenza. ```js (getUserInput) => @@ -57,7 +57,7 @@ Passport-local should be a dependency. ); ``` -Passport-local should be correctly required and setup. +Passport-local dovrebbe essere correttamente richiesta e configurata. ```js (getUserInput) => diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md index ce5af55213..dae7b37726 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md @@ -1,6 +1,6 @@ --- id: 589fc831f9fc0f352b528e77 -title: Authentication with Socket.IO +title: Autenticazione con Socket.IO challengeType: 2 forumTopicId: 301548 dashedName: authentication-with-socket-io @@ -8,9 +8,9 @@ dashedName: authentication-with-socket-io # --description-- -Currently, you cannot determine who is connected to your web socket. While `req.user` contains the user object, that's only when your user interacts with the web server, and with web sockets you have no `req` (request) and therefore no user data. One way to solve the problem of knowing who is connected to your web socket is by parsing and decoding the cookie that contains the passport session then deserializing it to obtain the user object. Luckily, there is a package on NPM just for this that turns a once complex task into something simple! +Al momento, non puoi determinare chi sia connesso alla tua socket web. `req.user` contiene l'oggetto utente, ma solo quando l'utente interagisce con il server web. Con le web sockets non hai `req` (richiesta) e di conseguenza, nessun dato utente. Un modo per risolvere il problema di sapere chi sia connesso alla tua web socket è di analizzare e decodificare il cookie che contiene la sessione passport, per poi deserializzarlo e ottenere l'oggetto utente. Fortunatamente, c'è un pacchetto su NPM fatto per questo, che trasforma un compito una volta complesso, in qualcosa di semplice! -Add `passport.socketio@~3.7.0`, `connect-mongo@~3.2.0`, and `cookie-parser@~1.4.5` as dependencies and require them as `passportSocketIo`, `MongoStore`, and `cookieParser` respectively. Also, we need to initialize a new memory store, from `express-session` which we previously required. It should look like this: +Aggiungi `passport.socketio@~3.7.0`, `connect-mongo@~3.2.0`, e `cookie-parser@~1.4.5` come dipendenze e richiedile rispettivamente come `passportSocketIo`, `MongoStore`, e `cookieParser`. Inoltre, dobbiamo inizializzare un nuovo archivio di memoria da `express-session` che abbiamo richiesto in precedenza. Dovrebbe assomigliare a questo: ```js const MongoStore = require('connect-mongo')(session); @@ -18,7 +18,7 @@ const URI = process.env.MONGO_URI; const store = new MongoStore({ url: URI }); ``` -Now we just have to tell Socket.IO to use it and set the options. Be sure this is added before the existing socket code and not in the existing connection listener. For your server, it should look like this: +Ora dobbiamo solo dire a Socket.IO di utilizzarlo e impostare le opzioni. Assicurati che venga aggiunto prima del codice socket esistente, e non nel listener di connessione esistente. Per il tuo server, dovrebbe assomigliare a questo: ```js io.use( @@ -33,11 +33,11 @@ io.use( ); ``` -Be sure to add the `key` and `store` to the `session` middleware mounted on the app. This is necessary to tell *SocketIO* which session to relate to. +Assicurati di aggiungere la `key` e lo `store` al middleware `session` montato sull'app. Questo è necessario per dire a *SocketIO* a quale sessione riferirsi. -
    +
    -Now, define the `success`, and `fail` callback functions: +Ora, definisci le funzioni di callback per `success` e `fail`: ```js function onAuthorizeSuccess(data, accept) { @@ -53,19 +53,19 @@ function onAuthorizeFail(data, message, error, accept) { } ``` -The user object is now accessible on your socket object as `socket.request.user`. For example, now you can add the following: +L'oggetto utente è ora disponibile sul tuo oggetto socket come `socket.request.user`. Per esempio, ora puoi aggiungere quanto segue: ```js console.log('user ' + socket.request.user.name + ' connected'); ``` -It will log to the server console who has connected! +Scriverà sulla console del server chi si è connesso! -Submit your page when you think you've got it right. If you're running into errors, you can check out the project up to this point [here](https://gist.github.com/camperbot/1414cc9433044e306dd7fd0caa1c6254). +Invia la tua pagina quando pensi che sia corretto. Se dovessi incontrare degli errori, puoi controllare il progetto fino a questo punto [qui](https://gist.github.com/camperbot/1414cc9433044e306dd7fd0caa1c6254). # --hints-- -`passport.socketio` should be a dependency. +`passport.socketio` dovrebbe essere una dipendenza. ```js (getUserInput) => @@ -84,7 +84,7 @@ Submit your page when you think you've got it right. If you're running into erro ); ``` -`cookie-parser` should be a dependency. +`cookie-parser` dovrebbe essere una dipendenza. ```js (getUserInput) => @@ -103,7 +103,7 @@ Submit your page when you think you've got it right. If you're running into erro ); ``` -passportSocketIo should be properly required. +passportSocketIo dovrebbe essere richiesta correttamente. ```js (getUserInput) => @@ -121,7 +121,7 @@ passportSocketIo should be properly required. ); ``` -passportSocketIo should be properly setup. +passportSocketIo dovrebbe essere configurata correttamente. ```js (getUserInput) => diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md index f6cf40e834..f77aa8dbcd 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md @@ -1,6 +1,6 @@ --- id: 589690e6f9fc0f352b528e6e -title: Clean Up Your Project with Modules +title: Riordinare il progetto con i moduli challengeType: 2 forumTopicId: 301549 dashedName: clean-up-your-project-with-modules @@ -8,9 +8,9 @@ dashedName: clean-up-your-project-with-modules # --description-- -Right now, everything you have is in your `server.js` file. This can lead to hard to manage code that isn't very expandable. Create 2 new files: `routes.js` and `auth.js` +Al momento, tutto il codice è compreso nel file `server.js`. Questo può portare ad un codice difficile da mantenere a poco espandibile. Crea 2 nuovi file: `routes.js` e `auth.js` -Both should start with the following code: +Entrambi dovrebbero iniziare con il codice seguente: ```js module.exports = function (app, myDataBase) { @@ -18,11 +18,11 @@ module.exports = function (app, myDataBase) { } ``` -Now, in the top of your server file, require these files like so: `const routes = require('./routes.js');` Right after you establish a successful connection with the database, instantiate each of them like so: `routes(app, myDataBase)` +Ora, all'inizio del tuo file del server, richiedi questi nuovi file così: `const routes = require('./routes.js');` Subito dopo aver stabilito con successo una connessione al database, crea un'istanza per ciascun file, in questo modo: `routes(app, myDataBase)` -Finally, take all of the routes in your server and paste them into your new files, and remove them from your server file. Also take the `ensureAuthenticated` function, since it was specifically created for routing. Now, you will have to correctly add the dependencies in which are used, such as `const passport = require('passport');`, at the very top, above the export line in your `routes.js` file. +Infine, trasferisci tutte le rotte presenti nel tuo server e incollale nei nuovi file. Inoltre, prendi la funzione `ensureAuthenticated` dato che è stata creata specificamente per il routing. Ora, dovrai importare correttamente in cima al tuo file `routes.js` le dipendenze che vengono utilizzate, come `const passport = require('passport');` al di sopra della linea di export. -Keep adding them until no more errors exist, and your server file no longer has any routing (**except for the route in the catch block**)! +Continua ad aggiungere percorsi fino a quando non ci saranno più errori e il tuo file server non avrà più neanche una rotta (**ad eccezione della rotta nel blocco catch**)! Now do the same thing in your auth.js file with all of the things related to authentication such as the serialization and the setting up of the local strategy and erase them from your server file. Be sure to add the dependencies in and call `auth(app, myDataBase)` in the server in the same spot. diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.md index bd17bbb9a6..3469dc0b1c 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.md @@ -1,6 +1,6 @@ --- id: 5895f70ef9fc0f352b528e6b -title: How to Put a Profile Together +title: Mettere insieme un profilo challengeType: 2 forumTopicId: 301554 dashedName: how-to-put-a-profile-together @@ -8,27 +8,27 @@ dashedName: how-to-put-a-profile-together # --description-- -Now that we can ensure the user accessing the `/profile` is authenticated, we can use the information contained in `req.user` on our page! +Ora che possiamo garantire che l'utente che accede al `/profile` sia autenticato, possiamo utilizzare le informazioni contenute in `req.user` sulla nostra pagina! -Pass an object containing the property `username` and value of `req.user.username` as the second argument for the render method of the profile view. Then, go to your `profile.pug` view, and add the following line below the existing `h1` element, and at the same level of indentation: +Passa un oggetto contenente la proprietà `username` e il valore di `req.user.username` come secondo argomento per il metodo render della vista del profilo. Quindi, vai alla tua vista `profile.pug`, e aggiungi la seguente riga sotto l'elemento `h1` esistente, e allo stesso livello di indentazione: ```pug h2.center#welcome Welcome, #{username}! ``` -This creates an `h2` element with the class '`center`' and id '`welcome`' containing the text '`Welcome,`' followed by the username. +Questo crea un elemento `h2` di classe '`center`' e con id '`welcome`' contenente il testo '`Welcome,`' seguito dal nome utente. -Also, in `profile.pug`, add a link referring to the `/logout` route, which will host the logic to unauthenticate a user. +Inoltre, in `profile.pug`, aggiungi un link relativo alla rotta `/logout`, che ospiterà la logica per disconnettere un utente. ```pug a(href='/logout') Logout ``` -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/136b3ad611cc80b41cab6f74bb460f6a). +Invia la tua pagina quando pensi di averlo fatto correttamente. Se dovessi incontrare degli errori, puoi controllare il progetto completato fino a questo punto [qui](https://gist.github.com/camperbot/136b3ad611cc80b41cab6f74bb460f6a). # --hints-- -You should correctly add a Pug render variable to /profile. +Dovresti aggiungere correttamente una variabile di rendering Pug a /profile. ```js (getUserInput) => diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md index 43740bdac5..3cc137ac92 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md @@ -78,7 +78,7 @@ GitHub strategy should be setup correctly thus far. (data) => { assert.match( data, - /passport\.use.*new GitHubStrategy/gi, + /passport\.use.*new GitHubStrategy/gis, 'Passport should use a new GitHubStrategy' ); assert.match( diff --git a/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/american-british-translator.md b/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/american-british-translator.md index 0f778edc57..5f932d6168 100644 --- a/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/american-british-translator.md +++ b/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/american-british-translator.md @@ -130,7 +130,7 @@ async (getUserInput) => { }; ``` -The `/api/translate` route should also handle the way titles/honorifics are abbreviated in American and British English. For example, Doctor Wright is abbreviated as "Dr Wright" in British English and "Dr. Wright" in American English. See `/public/american-to-british-titles.js` for the different titles your application should handle. +The `/api/translate` route should also handle the way titles/honorifics are abbreviated in American and British English. For example, Doctor Wright is abbreviated as "Dr Wright" in British English and "Dr. Wright" in American English. See `/components/american-to-british-titles.js` for the different titles your application should handle. ```js async (getUserInput) => { diff --git a/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/personal-library.md b/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/personal-library.md index f0bec1330e..6254a8c417 100644 --- a/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/personal-library.md +++ b/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/personal-library.md @@ -18,8 +18,7 @@ When you are done, make sure a working demo of your project is hosted somewhere # --instructions-- -1. Add your MongoDB connection string to `.env` without quotes as `DB` - Example: `DB=mongodb://admin:pass@1234.mlab.com:1234/fccpersonallib` +1. Add your MongoDB connection string to `.env` without quotes as `DB` Example: `DB=mongodb://admin:pass@1234.mlab.com:1234/fccpersonallib` 2. In your `.env` file set `NODE_ENV` to `test`, without quotes 3. You need to create all routes within `routes/api.js` 4. You will create all functional tests in `tests/2_functional-tests.js` diff --git a/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/sudoku-solver.md b/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/sudoku-solver.md index 79f9512fc1..b371014bf5 100644 --- a/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/sudoku-solver.md +++ b/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/sudoku-solver.md @@ -40,7 +40,7 @@ Write the following tests in `tests/1_unit-tests.js`: - Logic handles an invalid region (3x3 grid) placement - Valid puzzle strings pass the solver - Invalid puzzle strings fail the solver -- Solver returns the the expected solution for an incomplete puzzle +- Solver returns the expected solution for an incomplete puzzle Write the following tests in `tests/2_functional-tests.js` diff --git a/curriculum/challenges/italian/07-scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter.md b/curriculum/challenges/italian/07-scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter.md index adf4f36e7c..b03590db98 100644 --- a/curriculum/challenges/italian/07-scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter.md +++ b/curriculum/challenges/italian/07-scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter.md @@ -16,8 +16,7 @@ After going to that link, fork the project. Once you complete the project based We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you everything you need to know to complete this project: -
      -
    • +
      • Python for Everybody Video Course (14 hours)
      • diff --git a/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.md b/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.md index 284a5eabab..1585b497b2 100644 --- a/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.md +++ b/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.md @@ -12,7 +12,7 @@ dashedName: parsing-html-and-saving-data More resources: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas) +- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/tree/master/unit-1-reading-data-with-python-and-pandas/lesson-17-reading-html-tables/files) - [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- diff --git a/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.md b/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.md index 18d6487a0a..442d815a51 100644 --- a/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.md +++ b/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.md @@ -12,7 +12,7 @@ dashedName: reading-data-csv-and-txt More resources: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas) +- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/tree/master/unit-1-reading-data-with-python-and-pandas/lesson-1-reading-csv-and-txt-files/files) - [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- diff --git a/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.md b/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.md index 5502a07e7a..9a6275ac38 100644 --- a/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.md +++ b/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.md @@ -12,7 +12,7 @@ dashedName: reading-data-from-databases More resources: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas) +- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/tree/master/unit-1-reading-data-with-python-and-pandas/lesson-11-reading-data-from-relational-databases/files) - [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- diff --git a/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.md b/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.md index a16b2d0176..5a98490864 100644 --- a/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.md +++ b/curriculum/challenges/italian/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.md @@ -12,7 +12,7 @@ dashedName: reading-data-introduction More resources: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas) +- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/tree/master/unit-1-reading-data-with-python-and-pandas/lesson-1-reading-csv-and-txt-files/files) - [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- diff --git a/curriculum/challenges/italian/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-cross-site-scripting-xss-attacks-with-helmet.xssfilter.md b/curriculum/challenges/italian/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-cross-site-scripting-xss-attacks-with-helmet.xssfilter.md index 82389f8d83..701f65a0cd 100644 --- a/curriculum/challenges/italian/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-cross-site-scripting-xss-attacks-with-helmet.xssfilter.md +++ b/curriculum/challenges/italian/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-cross-site-scripting-xss-attacks-with-helmet.xssfilter.md @@ -1,8 +1,7 @@ --- id: 587d8247367417b2b2512c39 title: >- - Mitigate the Risk of Cross Site Scripting (XSS) Attacks with - helmet.xssFilter() + Mitigate the Risk of Cross Site Scripting (XSS) Attacks with helmet.xssFilter() challengeType: 2 forumTopicId: 301583 dashedName: mitigate-the-risk-of-cross-site-scripting-xss-attacks-with-helmet-xssfilter diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/add-a-new-element-to-a-binary-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/add-a-new-element-to-a-binary-search-tree.md index 35a51fab5f..77f653d0f4 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/add-a-new-element-to-a-binary-search-tree.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/add-a-new-element-to-a-binary-search-tree.md @@ -144,7 +144,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/check-if-an-element-is-present-in-a-binary-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/check-if-an-element-is-present-in-a-binary-search-tree.md index e45bd5a51a..03daa65cb2 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/check-if-an-element-is-present-in-a-binary-search-tree.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/check-if-an-element-is-present-in-a-binary-search-tree.md @@ -145,7 +145,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/check-if-binary-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/check-if-binary-search-tree.md index ddaf38f231..42081a1355 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/check-if-binary-search-tree.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/check-if-binary-search-tree.md @@ -89,7 +89,7 @@ function BinarySearchTree() { } function isBinarySearchTree(tree) { // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-doubly-linked-list.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-doubly-linked-list.md index 8e727deba5..16c2e122fa 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-doubly-linked-list.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-doubly-linked-list.md @@ -160,7 +160,7 @@ assert( DoublyLinkedList.prototype = Object.assign( DoublyLinkedList.prototype, { - + print() { if (this.head == null) { return null; @@ -204,7 +204,7 @@ var DoublyLinkedList = function() { this.head = null; this.tail = null; // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-hash-table.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-hash-table.md index 05f5c099bb..a33c3d5178 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-hash-table.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-hash-table.md @@ -210,7 +210,7 @@ var hash = string => { var HashTable = function() { this.collection = {}; // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-map-data-structure.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-map-data-structure.md index ac3d5754d0..0c32270e72 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-map-data-structure.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-map-data-structure.md @@ -158,7 +158,7 @@ assert( var Map = function() { this.collection = {}; // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-set-class.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-set-class.md index 8dae14f764..d818be6a80 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-set-class.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-set-class.md @@ -170,7 +170,7 @@ class Set { } // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-trie-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-trie-search-tree.md index 1586e0b2e8..fb838c883e 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-trie-search-tree.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-trie-search-tree.md @@ -139,7 +139,7 @@ var Node = function() { }; var Trie = function() { // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/depth-first-search.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/depth-first-search.md index 7d86343817..8fedd91cc5 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/depth-first-search.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/depth-first-search.md @@ -16,7 +16,7 @@ Once it reaches one end of a path, the search will backtrack to the last node wi The animation below shows how the algorithm works. The algorithm starts with the top node and visits the nodes in the numbered order. - + Notice how, unlike breadth-first search, every time a node is visited, it doesn't visit all of its neighbors. Instead, it first visits one of its neighbors and continues down that path until there are no more nodes to be visited on that path. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.md index b049822d4a..eb71f5ea47 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.md @@ -261,7 +261,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` @@ -278,7 +278,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line this.findMinHeight = function(root = this.root) { // empty tree. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree.md index 590820dd49..23077f9d93 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree.md @@ -187,7 +187,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap.md index d3b5a44d78..158817a64d 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap.md @@ -125,14 +125,14 @@ function createRandomArray(size = 5){ let a = new Array(size); for(let i = 0; i < size; i++) a[i] = Math.floor(Math.random() * 100); - + return a; } const array = createRandomArray(25); var MinHeap = function() { // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/insert-an-element-into-a-max-heap.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/insert-an-element-into-a-max-heap.md index 74e6b693f7..e20657a87c 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/insert-an-element-into-a-max-heap.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/insert-an-element-into-a-max-heap.md @@ -123,7 +123,7 @@ assert( ```js var MaxHeap = function() { // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/invert-a-binary-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/invert-a-binary-tree.md index bb2226fac8..8be38b0d5d 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/invert-a-binary-tree.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/invert-a-binary-tree.md @@ -160,7 +160,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data.md index 8c40ae5161..1c79329128 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data.md @@ -124,7 +124,7 @@ class Set { return newSet; } // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.md index 71d0bc063e..ea0caa1b3e 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.md @@ -200,7 +200,7 @@ class Set { return newSet; } // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data.md index e2bef36377..a108cb3b4e 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data.md @@ -101,7 +101,7 @@ class Set { return newSet; } // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list.md index 871cf51e9d..a202036ff0 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list.md @@ -194,7 +194,7 @@ function LinkedList() { previous = currentNode; currentNode = currentNode.next; } - + if (currentNode.next === null && currentNode.element !== element) { return; } diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-items-from-a-set-in-es6.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-items-from-a-set-in-es6.md index b676bb7eeb..c958d1922c 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-items-from-a-set-in-es6.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-items-from-a-set-in-es6.md @@ -48,8 +48,11 @@ assert( ```js function checkSet(){ - var set = null; - return set; + // Only change code below this line + var set = null; + + // Only change code above this line + return set; } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/reverse-a-doubly-linked-list.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/reverse-a-doubly-linked-list.md index 18293576f2..58edfaa2a5 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/reverse-a-doubly-linked-list.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/reverse-a-doubly-linked-list.md @@ -165,7 +165,7 @@ var DoublyLinkedList = function() { this.head = null; this.tail = null; // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree.md index d048a3a43c..b02f10043d 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree.md @@ -214,7 +214,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree.md index 8dc78340bf..c03fb75077 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree.md @@ -278,7 +278,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-101-optimum-polynomial.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-101-optimum-polynomial.md index 7573114475..cd51f0f2ec 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-101-optimum-polynomial.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-101-optimum-polynomial.md @@ -10,26 +10,30 @@ dashedName: problem-101-optimum-polynomial If we are presented with the first k terms of a sequence it is impossible to say with certainty the value of the next term, as there are infinitely many polynomial functions that can model the sequence. -As an example, let us consider the sequence of cube numbers. This is defined by the generating function, un = n3: 1, 8, 27, 64, 125, 216, ... +As an example, let us consider the sequence of cube numbers. This is defined by the generating function, $u_n = n^3: 1, 8, 27, 64, 125, 216, \ldots$ Suppose we were only given the first two terms of this sequence. Working on the principle that "simple is best" we should assume a linear relationship and predict the next term to be 15 (common difference 7). Even if we were presented with the first three terms, by the same principle of simplicity, a quadratic relationship should be assumed. -We shall define OP(k, n) to be the nth term of the optimum polynomial generating function for the first k terms of a sequence. It should be clear that OP(k, n) will accurately generate the terms of the sequence for n ≤ k, and potentially the first incorrect term (FIT) will be OP(k, k+1); in which case we shall call it a bad OP (BOP). +We shall define $OP(k, n)$ to be the $n^{th}$ term of the optimum polynomial generating function for the first k terms of a sequence. It should be clear that $OP(k, n)$ will accurately generate the terms of the sequence for $n ≤ k$, and potentially the first incorrect term (FIT) will be $OP(k, k+1)$; in which case we shall call it a bad OP (BOP). -As a basis, if we were only given the first term of sequence, it would be most sensible to assume constancy; that is, for n ≥ 2, OP(1, n) = u1. +As a basis, if we were only given the first term of sequence, it would be most sensible to assume constancy; that is, for $n ≥ 2, OP(1, n) = u_1$. Hence we obtain the following OPs for the cubic sequence: -OP(1, n) = 1 1, 1, 1, 1, ... OP(2, n) = 7n−6 1, 8, 15, ... OP(3, n) = 6n2−11n+6 1, 8, 27, 58, ... OP(4, n) = n3 1, 8, 27, 64, 125, ... +$$\begin{array}{ll} OP(1, n) = 1 & 1, {\color{red}1}, 1, 1, \ldots \\\\ OP(2, n) = 7n−6 & 1, 8, {\color{red}{15}}, \ldots \\\\ OP(3, n) = 6n^2−11n+6 & 1, 8, 27, {\color{red}{58}}, \ldots \\\\ OP(4, n) = n^3 & 1, 8, 27, 64, 125, \ldots \end{array}$$ -Clearly no BOPs exist for k ≥ 4. By considering the sum of FITs generated by the BOPs (indicated in red above), we obtain 1 + 15 + 58 = 74. Consider the following tenth degree polynomial generating function: un = 1 − n + n2 − n3 + n4 − n5 + n6 − n7 + n8 − n9 + n10 Find the sum of FITs for the BOPs. +Clearly no BOPs exist for k ≥ 4. By considering the sum of FITs generated by the BOPs (indicated in $\color{red}{red}$ above), we obtain 1 + 15 + 58 = 74. Consider the following tenth degree polynomial generating function: + +$$u_n = 1 − n + n^2 − n^3 + n^4 − n^5 + n^6 − n^7 + n^8 − n^9 + n^{10}$$ + +Find the sum of FITs for the BOPs. # --hints-- -`euler101()` should return 37076114526. +`optimumPolynomial()` should return `37076114526`. ```js -assert.strictEqual(euler101(), 37076114526); +assert.strictEqual(optimumPolynomial(), 37076114526); ``` # --seed-- @@ -37,12 +41,12 @@ assert.strictEqual(euler101(), 37076114526); ## --seed-contents-- ```js -function euler101() { +function optimumPolynomial() { return true; } -euler101(); +optimumPolynomial(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-103-special-subset-sums-optimum.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-103-special-subset-sums-optimum.md index 1ba5808084..677153bd67 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-103-special-subset-sums-optimum.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-103-special-subset-sums-optimum.md @@ -8,30 +8,29 @@ dashedName: problem-103-special-subset-sums-optimum # --description-- -Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: +Let $S(A)$ represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: -S(B) ≠ S(C); that is, sums of subsets cannot be equal. +1. $S(B) ≠ S(C)$; that is, sums of subsets cannot be equal. +2. If B contains more elements than C then $S(B) > S(C)$. -If B contains more elements than C then S(B) > S(C). +If $S(A)$ is minimised for a given n, we shall call it an optimum special sum set. The first five optimum special sum sets are given below. -If S(A) is minimised for a given n, we shall call it an optimum special sum set. The first five optimum special sum sets are given below. +$$\begin{align} & n = 1: \\{1\\} \\\\ & n = 2: \\{1, 2\\} \\\\ & n = 3: \\{2, 3, 4\\} \\\\ & n = 4: \\{3, 5, 6, 7\\} \\\\ & n = 5: \\{6, 9, 11, 12, 13\\} \\\\ \end{align}$$ -n = 1: {1}n = 2: {1, 2}n = 3: {2, 3, 4}n = 4: {3, 5, 6, 7}n = 5: {6, 9, 11, 12, 13} +It seems that for a given optimum set, $A = \\{a_1, a_2, \ldots, a_n\\}$, the next optimum set is of the form $B = \\{b, a_1 + b, a_2 + b, \ldots, a_n + b\\}$, where b is the "middle" element on the previous row. -It seems that for a given optimum set, A = {a1, a2, ... , an}, the next optimum set is of the form B = {b, a1+b, a2+b, ... ,an+b}, where b is the "middle" element on the previous row. +By applying this "rule" we would expect the optimum set for $n = 6$ to be $A = \\{11, 17, 20, 22, 23, 24\\}$, with $S(A) = 117$. However, this is not the optimum set, as we have merely applied an algorithm to provide a near optimum set. The optimum set for $n = 6$ is $A = \\{11, 18, 19, 20, 22, 25\\}$, with $S(A) = 115$ and corresponding set string: `111819202225`. -By applying this "rule" we would expect the optimum set for n = 6 to be A = {11, 17, 20, 22, 23, 24}, with S(A) = 117. However, this is not the optimum set, as we have merely applied an algorithm to provide a near optimum set. The optimum set for n = 6 is A = {11, 18, 19, 20, 22, 25}, with S(A) = 115 and corresponding set string: 111819202225. +Given that A is an optimum special sum set for $n = 7$, find its set string. -Given that A is an optimum special sum set for n = 7, find its set string. - -NOTE: This problem is related to Problem 105 and Problem 106. +**Note:** This problem is related to Problem 105 and Problem 106. # --hints-- -`euler103()` should return 20313839404245. +`optimumSpecialSumSet()` should return the string `20313839404245`. ```js -assert.strictEqual(euler103(), 20313839404245); +assert.strictEqual(optimumSpecialSumSet(), '20313839404245'); ``` # --seed-- @@ -39,12 +38,12 @@ assert.strictEqual(euler103(), 20313839404245); ## --seed-contents-- ```js -function euler103() { +function optimumSpecialSumSet() { return true; } -euler103(); +optimumSpecialSumSet(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-104-pandigital-fibonacci-ends.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-104-pandigital-fibonacci-ends.md index 625840f94a..1c61ea7c2e 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-104-pandigital-fibonacci-ends.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-104-pandigital-fibonacci-ends.md @@ -10,18 +10,18 @@ dashedName: problem-104-pandigital-fibonacci-ends The Fibonacci sequence is defined by the recurrence relation: -Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. +$F_n = F_{n − 1} + F_{n − 2}$, where $F_1 = 1$ and $F_2 = 1$ -It turns out that F541, which contains 113 digits, is the first Fibonacci number for which the last nine digits are 1-9 pandigital (contain all the digits 1 to 9, but not necessarily in order). And F2749, which contains 575 digits, is the first Fibonacci number for which the first nine digits are 1-9 pandigital. +It turns out that $F_{541}$, which contains 113 digits, is the first Fibonacci number for which the last nine digits are 1 - 9 pandigital (contain all the digits 1 to 9, but not necessarily in order). And $F_{2749}$, which contains 575 digits, is the first Fibonacci number for which the first nine digits are 1 - 9 pandigital. -Given that Fk is the first Fibonacci number for which the first nine digits AND the last nine digits are 1-9 pandigital, find k. +Given that $F_k$ is the first Fibonacci number for which the first nine digits AND the last nine digits are 1 - 9 pandigital, find `k`. # --hints-- -`euler104()` should return 329468. +`pandigitalFibonacciEnds()` should return `329468`. ```js -assert.strictEqual(euler104(), 329468); +assert.strictEqual(pandigitalFibonacciEnds(), 329468); ``` # --seed-- @@ -29,12 +29,12 @@ assert.strictEqual(euler104(), 329468); ## --seed-contents-- ```js -function euler104() { +function pandigitalFibonacciEnds() { return true; } -euler104(); +pandigitalFibonacciEnds(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-105-special-subset-sums-testing.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-105-special-subset-sums-testing.md index 28d4d6ac86..0a5d611f90 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-105-special-subset-sums-testing.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-105-special-subset-sums-testing.md @@ -8,37 +8,48 @@ dashedName: problem-105-special-subset-sums-testing # --description-- -Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: +Let $S(A)$ represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: -S(B) ≠ S(C); that is, sums of subsets cannot be equal. +1. $S(B) ≠ S(C)$; that is, sums of subsets cannot be equal. +2. If B contains more elements than C then $S(B) > S(C)$. -If B contains more elements than C then S(B) > S(C). +For example, {81, 88, 75, 42, 87, 84, 86, 65} is not a special sum set because 65 + 87 + 88 = 75 + 81 + 84, whereas {157, 150, 164, 119, 79, 159, 161, 139, 158} satisfies both rules for all possible subset pair combinations and $S(A) = 1286$. -For example, {81, 88, 75, 42, 87, 84, 86, 65} is not a special sum set because 65 + 87 + 88 = 75 + 81 + 84, whereas {157, 150, 164, 119, 79, 159, 161, 139, 158} satisfies both rules for all possible subset pair combinations and S(A) = 1286. +Using `sets`, an array with one-hundred sets, containing seven to twelve elements (the two examples given above are the first two sets), identify all the special sum sets, $A_1, A_2, \ldots, A_k$, and find the value of $(A_1) + S(A_2) + \cdots + S(A_k)$. -Using sets.txt (right click and "Save Link/Target As..."), a 4K text file with one-hundred sets containing seven to twelve elements (the two examples given above are the first two sets in the file), identify all the special sum sets, A1, A2, ..., Ak, and find the value of S(A1) + S(A2) + ... + S(Ak). - -NOTE: This problem is related to Problem 103 and Problem 106. +**Note:** This problem is related to Problem 103 and Problem 106. # --hints-- -`euler105()` should return 73702. +`testingSpecialSubsetSums(testSets)` should return `73702`. ```js -assert.strictEqual(euler105(), 73702); +assert.strictEqual(testingSpecialSubsetSums(_testSets), 73702); ``` # --seed-- +## --after-user-code-- + +```js +const _testSets = [ + [81,88,75,42,87,84,86,65],[157,150,164,119,79,159,161,139,158],[673,465,569,603,629,592,584,300,601,599,600],[90,85,83,84,65,87,76,46],[165,168,169,190,162,85,176,167,127],[224,275,278,249,277,279,289,295,139],[354,370,362,384,359,324,360,180,350,270],[599,595,557,298,448,596,577,667,597,588,602],[175,199,137,88,187,173,168,171,174],[93,187,196,144,185,178,186,202,182],[157,155,81,158,119,176,152,167,159],[184,165,159,166,163,167,174,124,83],[1211,1212,1287,605,1208,1189,1060,1216,1243,1200,908,1210],[339,299,153,305,282,304,313,306,302,228],[94,104,63,112,80,84,93,96],[41,88,82,85,61,74,83,81],[90,67,84,83,82,97,86,41],[299,303,151,301,291,302,307,377,333,280],[55,40,48,44,25,42,41],[1038,1188,1255,1184,594,890,1173,1151,1186,1203,1187,1195],[76,132,133,144,135,99,128,154],[77,46,108,81,85,84,93,83],[624,596,391,605,529,610,607,568,604,603,453],[83,167,166,189,163,174,160,165,133],[308,281,389,292,346,303,302,304,300,173],[593,1151,1187,1184,890,1040,1173,1186,1195,1255,1188,1203],[68,46,64,33,60,58,65],[65,43,88,87,86,99,93,90],[83,78,107,48,84,87,96,85],[1188,1173,1256,1038,1187,1151,890,1186,1184,1203,594,1195],[302,324,280,296,294,160,367,298,264,299],[521,760,682,687,646,664,342,698,692,686,672],[56,95,86,97,96,89,108,120],[344,356,262,343,340,382,337,175,361,330],[47,44,42,27,41,40,37],[139,155,161,158,118,166,154,156,78],[118,157,164,158,161,79,139,150,159],[299,292,371,150,300,301,281,303,306,262],[85,77,86,84,44,88,91,67],[88,85,84,44,65,91,76,86],[138,141,127,96,136,154,135,76],[292,308,302,346,300,324,304,305,238,166],[354,342,341,257,348,343,345,321,170,301],[84,178,168,167,131,170,193,166,162],[686,701,706,673,694,687,652,343,683,606,518],[295,293,301,367,296,279,297,263,323,159],[1038,1184,593,890,1188,1173,1187,1186,1195,1150,1203,1255],[343,364,388,402,191,383,382,385,288,374],[1187,1036,1183,591,1184,1175,888,1197,1182,1219,1115,1167],[151,291,307,303,345,238,299,323,301,302],[140,151,143,138,99,69,131,137],[29,44,42,59,41,36,40],[348,329,343,344,338,315,169,359,375,271],[48,39,34,37,50,40,41],[593,445,595,558,662,602,591,297,610,580,594],[686,651,681,342,541,687,691,707,604,675,699],[180,99,189,166,194,188,144,187,199],[321,349,335,343,377,176,265,356,344,332],[1151,1255,1195,1173,1184,1186,1188,1187,1203,593,1038,891],[90,88,100,83,62,113,80,89],[308,303,238,300,151,304,324,293,346,302],[59,38,50,41,42,35,40],[352,366,174,355,344,265,343,310,338,331],[91,89,93,90,117,85,60,106],[146,186,166,175,202,92,184,183,189],[82,67,96,44,80,79,88,76],[54,50,58,66,31,61,64],[343,266,344,172,308,336,364,350,359,333],[88,49,87,82,90,98,86,115],[20,47,49,51,54,48,40],[159,79,177,158,157,152,155,167,118],[1219,1183,1182,1115,1035,1186,591,1197,1167,887,1184,1175],[611,518,693,343,704,667,686,682,677,687,725],[607,599,634,305,677,604,603,580,452,605,591],[682,686,635,675,692,730,687,342,517,658,695],[662,296,573,598,592,584,553,593,595,443,591],[180,185,186,199,187,210,93,177,149],[197,136,179,185,156,182,180,178,99],[271,298,218,279,285,282,280,238,140],[1187,1151,890,593,1194,1188,1184,1173,1038,1186,1255,1203],[169,161,177,192,130,165,84,167,168],[50,42,43,41,66,39,36],[590,669,604,579,448,599,560,299,601,597,598],[174,191,206,179,184,142,177,180,90],[298,299,297,306,164,285,374,269,329,295],[181,172,162,138,170,195,86,169,168],[1184,1197,591,1182,1186,889,1167,1219,1183,1033,1115,1175],[644,695,691,679,667,687,340,681,770,686,517],[606,524,592,576,628,593,591,584,296,444,595],[94,127,154,138,135,74,136,141],[179,168,172,178,177,89,198,186,137],[302,299,291,300,298,149,260,305,280,370],[678,517,670,686,682,768,687,648,342,692,702],[302,290,304,376,333,303,306,298,279,153],[95,102,109,54,96,75,85,97],[150,154,146,78,152,151,162,173,119],[150,143,157,152,184,112,154,151,132],[36,41,54,40,25,44,42],[37,48,34,59,39,41,40],[681,603,638,611,584,303,454,607,606,605,596] +]; +``` + ## --seed-contents-- ```js -function euler105() { +function testingSpecialSubsetSums(sets) { return true; } -euler105(); +const testSets = [ + [81,88,75,42,87,84,86,65],[157,150,164,119,79,159,161,139,158],[673,465,569,603,629,592,584,300,601,599,600],[90,85,83,84,65,87,76,46],[165,168,169,190,162,85,176,167,127],[224,275,278,249,277,279,289,295,139],[354,370,362,384,359,324,360,180,350,270],[599,595,557,298,448,596,577,667,597,588,602],[175,199,137,88,187,173,168,171,174],[93,187,196,144,185,178,186,202,182],[157,155,81,158,119,176,152,167,159],[184,165,159,166,163,167,174,124,83],[1211,1212,1287,605,1208,1189,1060,1216,1243,1200,908,1210],[339,299,153,305,282,304,313,306,302,228],[94,104,63,112,80,84,93,96],[41,88,82,85,61,74,83,81],[90,67,84,83,82,97,86,41],[299,303,151,301,291,302,307,377,333,280],[55,40,48,44,25,42,41],[1038,1188,1255,1184,594,890,1173,1151,1186,1203,1187,1195],[76,132,133,144,135,99,128,154],[77,46,108,81,85,84,93,83],[624,596,391,605,529,610,607,568,604,603,453],[83,167,166,189,163,174,160,165,133],[308,281,389,292,346,303,302,304,300,173],[593,1151,1187,1184,890,1040,1173,1186,1195,1255,1188,1203],[68,46,64,33,60,58,65],[65,43,88,87,86,99,93,90],[83,78,107,48,84,87,96,85],[1188,1173,1256,1038,1187,1151,890,1186,1184,1203,594,1195],[302,324,280,296,294,160,367,298,264,299],[521,760,682,687,646,664,342,698,692,686,672],[56,95,86,97,96,89,108,120],[344,356,262,343,340,382,337,175,361,330],[47,44,42,27,41,40,37],[139,155,161,158,118,166,154,156,78],[118,157,164,158,161,79,139,150,159],[299,292,371,150,300,301,281,303,306,262],[85,77,86,84,44,88,91,67],[88,85,84,44,65,91,76,86],[138,141,127,96,136,154,135,76],[292,308,302,346,300,324,304,305,238,166],[354,342,341,257,348,343,345,321,170,301],[84,178,168,167,131,170,193,166,162],[686,701,706,673,694,687,652,343,683,606,518],[295,293,301,367,296,279,297,263,323,159],[1038,1184,593,890,1188,1173,1187,1186,1195,1150,1203,1255],[343,364,388,402,191,383,382,385,288,374],[1187,1036,1183,591,1184,1175,888,1197,1182,1219,1115,1167],[151,291,307,303,345,238,299,323,301,302],[140,151,143,138,99,69,131,137],[29,44,42,59,41,36,40],[348,329,343,344,338,315,169,359,375,271],[48,39,34,37,50,40,41],[593,445,595,558,662,602,591,297,610,580,594],[686,651,681,342,541,687,691,707,604,675,699],[180,99,189,166,194,188,144,187,199],[321,349,335,343,377,176,265,356,344,332],[1151,1255,1195,1173,1184,1186,1188,1187,1203,593,1038,891],[90,88,100,83,62,113,80,89],[308,303,238,300,151,304,324,293,346,302],[59,38,50,41,42,35,40],[352,366,174,355,344,265,343,310,338,331],[91,89,93,90,117,85,60,106],[146,186,166,175,202,92,184,183,189],[82,67,96,44,80,79,88,76],[54,50,58,66,31,61,64],[343,266,344,172,308,336,364,350,359,333],[88,49,87,82,90,98,86,115],[20,47,49,51,54,48,40],[159,79,177,158,157,152,155,167,118],[1219,1183,1182,1115,1035,1186,591,1197,1167,887,1184,1175],[611,518,693,343,704,667,686,682,677,687,725],[607,599,634,305,677,604,603,580,452,605,591],[682,686,635,675,692,730,687,342,517,658,695],[662,296,573,598,592,584,553,593,595,443,591],[180,185,186,199,187,210,93,177,149],[197,136,179,185,156,182,180,178,99],[271,298,218,279,285,282,280,238,140],[1187,1151,890,593,1194,1188,1184,1173,1038,1186,1255,1203],[169,161,177,192,130,165,84,167,168],[50,42,43,41,66,39,36],[590,669,604,579,448,599,560,299,601,597,598],[174,191,206,179,184,142,177,180,90],[298,299,297,306,164,285,374,269,329,295],[181,172,162,138,170,195,86,169,168],[1184,1197,591,1182,1186,889,1167,1219,1183,1033,1115,1175],[644,695,691,679,667,687,340,681,770,686,517],[606,524,592,576,628,593,591,584,296,444,595],[94,127,154,138,135,74,136,141],[179,168,172,178,177,89,198,186,137],[302,299,291,300,298,149,260,305,280,370],[678,517,670,686,682,768,687,648,342,692,702],[302,290,304,376,333,303,306,298,279,153],[95,102,109,54,96,75,85,97],[150,154,146,78,152,151,162,173,119],[150,143,157,152,184,112,154,151,132],[36,41,54,40,25,44,42],[37,48,34,59,39,41,40],[681,603,638,611,584,303,454,607,606,605,596] +]; + +testingSpecialSubsetSums(testSets); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-106-special-subset-sums-meta-testing.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-106-special-subset-sums-meta-testing.md index bb1db2e260..e771a72835 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-106-special-subset-sums-meta-testing.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-106-special-subset-sums-meta-testing.md @@ -8,11 +8,10 @@ dashedName: problem-106-special-subset-sums-meta-testing # --description-- -Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: +Let $S(A)$ represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: -S(B) ≠ S(C); that is, sums of subsets cannot be equal. - -If B contains more elements than C then S(B) > S(C). +1. $S(B) ≠ S(C)$; that is, sums of subsets cannot be equal. +2. If B contains more elements than C then $S(B) > S(C)$. For this problem we shall assume that a given set contains n strictly increasing elements and it already satisfies the second rule. @@ -20,14 +19,14 @@ Surprisingly, out of the 25 possible subset pairs that can be obtained from a se For n = 12, how many of the 261625 subset pairs that can be obtained need to be tested for equality? -NOTE: This problem is related to Problem 103 and Problem 105. +**Note:** This problem is related to Problem 103 and Problem 105. # --hints-- -`euler106()` should return 21384. +`subsetSumsMetaTesting()` should return `21384`. ```js -assert.strictEqual(euler106(), 21384); +assert.strictEqual(subsetSumsMetaTesting(), 21384); ``` # --seed-- @@ -35,12 +34,12 @@ assert.strictEqual(euler106(), 21384); ## --seed-contents-- ```js -function euler106() { +function subsetSumsMetaTesting() { return true; } -euler106(); +subsetSumsMetaTesting(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-107-minimal-network.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-107-minimal-network.md index f51dfe801d..312e9f3312 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-107-minimal-network.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-107-minimal-network.md @@ -10,29 +10,58 @@ dashedName: problem-107-minimal-network The following undirected network consists of seven vertices and twelve edges with a total weight of 243. -The same network can be represented by the matrix below. ABCDEFG A-161221--- B16--1720-- C12--28-31- D211728-181923 E-20-18--11 F--3119--27 G---231127- However, it is possible to optimise the network by removing some edges and still ensure that all points on the network remain connected. The network which achieves the maximum saving is shown below. It has a weight of 93, representing a saving of 243 − 93 = 150 from the original network. +Network with seven vertices and twelve edges -Using network.txt (right click and 'Save Link/Target As...'), a 6K text file containing a network with forty vertices, and given in matrix form, find the maximum saving which can be achieved by removing redundant edges whilst ensuring that the network remains connected. +The same network can be represented by the matrix below. + +| | A | B | C | D | E | F | G | +| - | -- | -- | -- | -- | -- | -- | -- | +| A | - | 16 | 12 | 21 | - | - | - | +| B | 16 | - | - | 17 | 20 | - | - | +| C | 12 | - | - | 28 | - | 31 | - | +| D | 21 | 17 | 28 | - | 18 | 19 | 23 | +| E | - | 20 | - | 18 | - | - | 11 | +| F | - | - | 31 | 19 | - | - | 27 | +| G | - | - | - | 23 | 11 | 27 | - | + + +However, it is possible to optimise the network by removing some edges and still ensure that all points on the network remain connected. The network which achieves the maximum saving is shown below. It has a weight of 93, representing a saving of 243 − 93 = 150 from the original network. + +Network wtih seven vertices and left six edges: AB, BD, CA, DE, DF, EG + +Using `network`, an 2D array representing network in matrix form, find the maximum saving which can be achieved by removing redundant edges whilst ensuring that the network remains connected. Vertices not having connection will be represented with `-1`. # --hints-- -`euler107()` should return 259679. +`minimalNetwork(testNetwork)` should return `259679`. ```js -assert.strictEqual(euler107(), 259679); +assert.strictEqual(minimalNetwork(_testNetwork), 259679); ``` # --seed-- +## --after-user-code-- + +```js +const _testNetwork = [ + [-1,-1,-1,427,668,495,377,678,-1,177,-1,-1,870,-1,869,624,300,609,131,-1,251,-1,-1,-1,856,221,514,-1,591,762,182,56,-1,884,412,273,636,-1,-1,774],[-1,-1,262,-1,-1,508,472,799,-1,956,578,363,940,143,-1,162,122,910,-1,729,802,941,922,573,531,539,667,607,-1,920,-1,-1,315,649,937,-1,185,102,636,289],[-1,262,-1,-1,926,-1,958,158,647,47,621,264,81,-1,402,813,649,386,252,391,264,637,349,-1,-1,-1,108,-1,727,225,578,699,-1,898,294,-1,575,168,432,833],[427,-1,-1,-1,366,-1,-1,635,-1,32,962,468,893,854,718,427,448,916,258,-1,760,909,529,311,404,-1,-1,588,680,875,-1,615,-1,409,758,221,-1,-1,76,257],[668,-1,926,366,-1,-1,-1,250,268,-1,503,944,-1,677,-1,727,793,457,981,191,-1,-1,-1,351,969,925,987,328,282,589,-1,873,477,-1,-1,19,450,-1,-1,-1],[495,508,-1,-1,-1,-1,-1,765,711,819,305,302,926,-1,-1,582,-1,861,-1,683,293,-1,-1,66,-1,27,-1,-1,290,-1,786,-1,554,817,33,-1,54,506,386,381],[377,472,958,-1,-1,-1,-1,-1,-1,120,42,-1,134,219,457,639,538,374,-1,-1,-1,966,-1,-1,-1,-1,-1,449,120,797,358,232,550,-1,305,997,662,744,686,239],[678,799,158,635,250,765,-1,-1,-1,35,-1,106,385,652,160,-1,890,812,605,953,-1,-1,-1,79,-1,712,613,312,452,-1,978,900,-1,901,-1,-1,225,533,770,722],[-1,-1,647,-1,268,711,-1,-1,-1,283,-1,172,-1,663,236,36,403,286,986,-1,-1,810,761,574,53,793,-1,-1,777,330,936,883,286,-1,174,-1,-1,-1,828,711],[177,956,47,32,-1,819,120,35,283,-1,50,-1,565,36,767,684,344,489,565,-1,-1,103,810,463,733,665,494,644,863,25,385,-1,342,470,-1,-1,-1,730,582,468],[-1,578,621,962,503,305,42,-1,-1,50,-1,155,519,-1,-1,256,990,801,154,53,474,650,402,-1,-1,-1,966,-1,-1,406,989,772,932,7,-1,823,391,-1,-1,933],[-1,363,264,468,944,302,-1,106,172,-1,155,-1,-1,-1,380,438,-1,41,266,-1,-1,104,867,609,-1,270,861,-1,-1,165,-1,675,250,686,995,366,191,-1,433,-1],[870,940,81,893,-1,926,134,385,-1,565,519,-1,-1,313,851,-1,-1,-1,248,220,-1,826,359,829,-1,234,198,145,409,68,359,-1,814,218,186,-1,-1,929,203,-1],[-1,143,-1,854,677,-1,219,652,663,36,-1,-1,313,-1,132,-1,433,598,-1,-1,168,870,-1,-1,-1,128,437,-1,383,364,966,227,-1,-1,807,993,-1,-1,526,17],[869,-1,402,718,-1,-1,457,160,236,767,-1,380,851,132,-1,-1,596,903,613,730,-1,261,-1,142,379,885,89,-1,848,258,112,-1,900,-1,-1,818,639,268,600,-1],[624,162,813,427,727,582,639,-1,36,684,256,438,-1,-1,-1,-1,539,379,664,561,542,-1,999,585,-1,-1,321,398,-1,-1,950,68,193,-1,697,-1,390,588,848,-1],[300,122,649,448,793,-1,538,890,403,344,990,-1,-1,433,596,539,-1,-1,73,-1,318,-1,-1,500,-1,968,-1,291,-1,-1,765,196,504,757,-1,542,-1,395,227,148],[609,910,386,916,457,861,374,812,286,489,801,41,-1,598,903,379,-1,-1,-1,946,136,399,-1,941,707,156,757,258,251,-1,807,-1,-1,-1,461,501,-1,-1,616,-1],[131,-1,252,258,981,-1,-1,605,986,565,154,266,248,-1,613,664,73,-1,-1,686,-1,-1,575,627,817,282,-1,698,398,222,-1,649,-1,-1,-1,-1,-1,654,-1,-1],[-1,729,391,-1,191,683,-1,953,-1,-1,53,-1,220,-1,730,561,-1,946,686,-1,-1,389,729,553,304,703,455,857,260,-1,991,182,351,477,867,-1,-1,889,217,853],[251,802,264,760,-1,293,-1,-1,-1,-1,474,-1,-1,168,-1,542,318,136,-1,-1,-1,-1,392,-1,-1,-1,267,407,27,651,80,927,-1,974,977,-1,-1,457,117,-1],[-1,941,637,909,-1,-1,966,-1,810,103,650,104,826,870,261,-1,-1,399,-1,389,-1,-1,-1,202,-1,-1,-1,-1,867,140,403,962,785,-1,511,-1,1,-1,707,-1],[-1,922,349,529,-1,-1,-1,-1,761,810,402,867,359,-1,-1,999,-1,-1,575,729,392,-1,-1,388,939,-1,959,-1,83,463,361,-1,-1,512,931,-1,224,690,369,-1],[-1,573,-1,311,351,66,-1,79,574,463,-1,609,829,-1,142,585,500,941,627,553,-1,202,388,-1,164,829,-1,620,523,639,936,-1,-1,490,-1,695,-1,505,109,-1],[856,531,-1,404,969,-1,-1,-1,53,733,-1,-1,-1,-1,379,-1,-1,707,817,304,-1,-1,939,164,-1,-1,616,716,728,-1,889,349,-1,963,150,447,-1,292,586,264],[221,539,-1,-1,925,27,-1,712,793,665,-1,270,234,128,885,-1,968,156,282,703,-1,-1,-1,829,-1,-1,-1,822,-1,-1,-1,736,576,-1,697,946,443,-1,205,194],[514,667,108,-1,987,-1,-1,613,-1,494,966,861,198,437,89,321,-1,757,-1,455,267,-1,959,-1,616,-1,-1,-1,349,156,339,-1,102,790,359,-1,439,938,809,260],[-1,607,-1,588,328,-1,449,312,-1,644,-1,-1,145,-1,-1,398,291,258,698,857,407,-1,-1,620,716,822,-1,-1,293,486,943,-1,779,-1,6,880,116,775,-1,947],[591,-1,727,680,282,290,120,452,777,863,-1,-1,409,383,848,-1,-1,251,398,260,27,867,83,523,728,-1,349,293,-1,212,684,505,341,384,9,992,507,48,-1,-1],[762,920,225,875,589,-1,797,-1,330,25,406,165,68,364,258,-1,-1,-1,222,-1,651,140,463,639,-1,-1,156,486,212,-1,-1,349,723,-1,-1,186,-1,36,240,752],[182,-1,578,-1,-1,786,358,978,936,385,989,-1,359,966,112,950,765,807,-1,991,80,403,361,936,889,-1,339,943,684,-1,-1,965,302,676,725,-1,327,134,-1,147],[56,-1,699,615,873,-1,232,900,883,-1,772,675,-1,227,-1,68,196,-1,649,182,927,962,-1,-1,349,736,-1,-1,505,349,965,-1,474,178,833,-1,-1,555,853,-1],[-1,315,-1,-1,477,554,550,-1,286,342,932,250,814,-1,900,193,504,-1,-1,351,-1,785,-1,-1,-1,576,102,779,341,723,302,474,-1,689,-1,-1,-1,451,-1,-1],[884,649,898,409,-1,817,-1,901,-1,470,7,686,218,-1,-1,-1,757,-1,-1,477,974,-1,512,490,963,-1,790,-1,384,-1,676,178,689,-1,245,596,445,-1,-1,343],[412,937,294,758,-1,33,305,-1,174,-1,-1,995,186,807,-1,697,-1,461,-1,867,977,511,931,-1,150,697,359,6,9,-1,725,833,-1,245,-1,949,-1,270,-1,112],[273,-1,-1,221,19,-1,997,-1,-1,-1,823,366,-1,993,818,-1,542,501,-1,-1,-1,-1,-1,695,447,946,-1,880,992,186,-1,-1,-1,596,949,-1,91,-1,768,273],[636,185,575,-1,450,54,662,225,-1,-1,391,191,-1,-1,639,390,-1,-1,-1,-1,-1,1,224,-1,-1,443,439,116,507,-1,327,-1,-1,445,-1,91,-1,248,-1,344],[-1,102,168,-1,-1,506,744,533,-1,730,-1,-1,929,-1,268,588,395,-1,654,889,457,-1,690,505,292,-1,938,775,48,36,134,555,451,-1,270,-1,248,-1,371,680],[-1,636,432,76,-1,386,686,770,828,582,-1,433,203,526,600,848,227,616,-1,217,117,707,369,109,586,205,809,-1,-1,240,-1,853,-1,-1,-1,768,-1,371,-1,540],[774,289,833,257,-1,381,239,722,711,468,933,-1,-1,17,-1,-1,148,-1,-1,853,-1,-1,-1,-1,264,194,260,947,-1,752,147,-1,-1,343,112,273,344,680,540,-1] +]; +``` + ## --seed-contents-- ```js -function euler107() { +function minimalNetwork(network) { return true; } -euler107(); +const testNetwork = [ + [-1,-1,-1,427,668,495,377,678,-1,177,-1,-1,870,-1,869,624,300,609,131,-1,251,-1,-1,-1,856,221,514,-1,591,762,182,56,-1,884,412,273,636,-1,-1,774],[-1,-1,262,-1,-1,508,472,799,-1,956,578,363,940,143,-1,162,122,910,-1,729,802,941,922,573,531,539,667,607,-1,920,-1,-1,315,649,937,-1,185,102,636,289],[-1,262,-1,-1,926,-1,958,158,647,47,621,264,81,-1,402,813,649,386,252,391,264,637,349,-1,-1,-1,108,-1,727,225,578,699,-1,898,294,-1,575,168,432,833],[427,-1,-1,-1,366,-1,-1,635,-1,32,962,468,893,854,718,427,448,916,258,-1,760,909,529,311,404,-1,-1,588,680,875,-1,615,-1,409,758,221,-1,-1,76,257],[668,-1,926,366,-1,-1,-1,250,268,-1,503,944,-1,677,-1,727,793,457,981,191,-1,-1,-1,351,969,925,987,328,282,589,-1,873,477,-1,-1,19,450,-1,-1,-1],[495,508,-1,-1,-1,-1,-1,765,711,819,305,302,926,-1,-1,582,-1,861,-1,683,293,-1,-1,66,-1,27,-1,-1,290,-1,786,-1,554,817,33,-1,54,506,386,381],[377,472,958,-1,-1,-1,-1,-1,-1,120,42,-1,134,219,457,639,538,374,-1,-1,-1,966,-1,-1,-1,-1,-1,449,120,797,358,232,550,-1,305,997,662,744,686,239],[678,799,158,635,250,765,-1,-1,-1,35,-1,106,385,652,160,-1,890,812,605,953,-1,-1,-1,79,-1,712,613,312,452,-1,978,900,-1,901,-1,-1,225,533,770,722],[-1,-1,647,-1,268,711,-1,-1,-1,283,-1,172,-1,663,236,36,403,286,986,-1,-1,810,761,574,53,793,-1,-1,777,330,936,883,286,-1,174,-1,-1,-1,828,711],[177,956,47,32,-1,819,120,35,283,-1,50,-1,565,36,767,684,344,489,565,-1,-1,103,810,463,733,665,494,644,863,25,385,-1,342,470,-1,-1,-1,730,582,468],[-1,578,621,962,503,305,42,-1,-1,50,-1,155,519,-1,-1,256,990,801,154,53,474,650,402,-1,-1,-1,966,-1,-1,406,989,772,932,7,-1,823,391,-1,-1,933],[-1,363,264,468,944,302,-1,106,172,-1,155,-1,-1,-1,380,438,-1,41,266,-1,-1,104,867,609,-1,270,861,-1,-1,165,-1,675,250,686,995,366,191,-1,433,-1],[870,940,81,893,-1,926,134,385,-1,565,519,-1,-1,313,851,-1,-1,-1,248,220,-1,826,359,829,-1,234,198,145,409,68,359,-1,814,218,186,-1,-1,929,203,-1],[-1,143,-1,854,677,-1,219,652,663,36,-1,-1,313,-1,132,-1,433,598,-1,-1,168,870,-1,-1,-1,128,437,-1,383,364,966,227,-1,-1,807,993,-1,-1,526,17],[869,-1,402,718,-1,-1,457,160,236,767,-1,380,851,132,-1,-1,596,903,613,730,-1,261,-1,142,379,885,89,-1,848,258,112,-1,900,-1,-1,818,639,268,600,-1],[624,162,813,427,727,582,639,-1,36,684,256,438,-1,-1,-1,-1,539,379,664,561,542,-1,999,585,-1,-1,321,398,-1,-1,950,68,193,-1,697,-1,390,588,848,-1],[300,122,649,448,793,-1,538,890,403,344,990,-1,-1,433,596,539,-1,-1,73,-1,318,-1,-1,500,-1,968,-1,291,-1,-1,765,196,504,757,-1,542,-1,395,227,148],[609,910,386,916,457,861,374,812,286,489,801,41,-1,598,903,379,-1,-1,-1,946,136,399,-1,941,707,156,757,258,251,-1,807,-1,-1,-1,461,501,-1,-1,616,-1],[131,-1,252,258,981,-1,-1,605,986,565,154,266,248,-1,613,664,73,-1,-1,686,-1,-1,575,627,817,282,-1,698,398,222,-1,649,-1,-1,-1,-1,-1,654,-1,-1],[-1,729,391,-1,191,683,-1,953,-1,-1,53,-1,220,-1,730,561,-1,946,686,-1,-1,389,729,553,304,703,455,857,260,-1,991,182,351,477,867,-1,-1,889,217,853],[251,802,264,760,-1,293,-1,-1,-1,-1,474,-1,-1,168,-1,542,318,136,-1,-1,-1,-1,392,-1,-1,-1,267,407,27,651,80,927,-1,974,977,-1,-1,457,117,-1],[-1,941,637,909,-1,-1,966,-1,810,103,650,104,826,870,261,-1,-1,399,-1,389,-1,-1,-1,202,-1,-1,-1,-1,867,140,403,962,785,-1,511,-1,1,-1,707,-1],[-1,922,349,529,-1,-1,-1,-1,761,810,402,867,359,-1,-1,999,-1,-1,575,729,392,-1,-1,388,939,-1,959,-1,83,463,361,-1,-1,512,931,-1,224,690,369,-1],[-1,573,-1,311,351,66,-1,79,574,463,-1,609,829,-1,142,585,500,941,627,553,-1,202,388,-1,164,829,-1,620,523,639,936,-1,-1,490,-1,695,-1,505,109,-1],[856,531,-1,404,969,-1,-1,-1,53,733,-1,-1,-1,-1,379,-1,-1,707,817,304,-1,-1,939,164,-1,-1,616,716,728,-1,889,349,-1,963,150,447,-1,292,586,264],[221,539,-1,-1,925,27,-1,712,793,665,-1,270,234,128,885,-1,968,156,282,703,-1,-1,-1,829,-1,-1,-1,822,-1,-1,-1,736,576,-1,697,946,443,-1,205,194],[514,667,108,-1,987,-1,-1,613,-1,494,966,861,198,437,89,321,-1,757,-1,455,267,-1,959,-1,616,-1,-1,-1,349,156,339,-1,102,790,359,-1,439,938,809,260],[-1,607,-1,588,328,-1,449,312,-1,644,-1,-1,145,-1,-1,398,291,258,698,857,407,-1,-1,620,716,822,-1,-1,293,486,943,-1,779,-1,6,880,116,775,-1,947],[591,-1,727,680,282,290,120,452,777,863,-1,-1,409,383,848,-1,-1,251,398,260,27,867,83,523,728,-1,349,293,-1,212,684,505,341,384,9,992,507,48,-1,-1],[762,920,225,875,589,-1,797,-1,330,25,406,165,68,364,258,-1,-1,-1,222,-1,651,140,463,639,-1,-1,156,486,212,-1,-1,349,723,-1,-1,186,-1,36,240,752],[182,-1,578,-1,-1,786,358,978,936,385,989,-1,359,966,112,950,765,807,-1,991,80,403,361,936,889,-1,339,943,684,-1,-1,965,302,676,725,-1,327,134,-1,147],[56,-1,699,615,873,-1,232,900,883,-1,772,675,-1,227,-1,68,196,-1,649,182,927,962,-1,-1,349,736,-1,-1,505,349,965,-1,474,178,833,-1,-1,555,853,-1],[-1,315,-1,-1,477,554,550,-1,286,342,932,250,814,-1,900,193,504,-1,-1,351,-1,785,-1,-1,-1,576,102,779,341,723,302,474,-1,689,-1,-1,-1,451,-1,-1],[884,649,898,409,-1,817,-1,901,-1,470,7,686,218,-1,-1,-1,757,-1,-1,477,974,-1,512,490,963,-1,790,-1,384,-1,676,178,689,-1,245,596,445,-1,-1,343],[412,937,294,758,-1,33,305,-1,174,-1,-1,995,186,807,-1,697,-1,461,-1,867,977,511,931,-1,150,697,359,6,9,-1,725,833,-1,245,-1,949,-1,270,-1,112],[273,-1,-1,221,19,-1,997,-1,-1,-1,823,366,-1,993,818,-1,542,501,-1,-1,-1,-1,-1,695,447,946,-1,880,992,186,-1,-1,-1,596,949,-1,91,-1,768,273],[636,185,575,-1,450,54,662,225,-1,-1,391,191,-1,-1,639,390,-1,-1,-1,-1,-1,1,224,-1,-1,443,439,116,507,-1,327,-1,-1,445,-1,91,-1,248,-1,344],[-1,102,168,-1,-1,506,744,533,-1,730,-1,-1,929,-1,268,588,395,-1,654,889,457,-1,690,505,292,-1,938,775,48,36,134,555,451,-1,270,-1,248,-1,371,680],[-1,636,432,76,-1,386,686,770,828,582,-1,433,203,526,600,848,227,616,-1,217,117,707,369,109,586,205,809,-1,-1,240,-1,853,-1,-1,-1,768,-1,371,-1,540],[774,289,833,257,-1,381,239,722,711,468,933,-1,-1,17,-1,-1,148,-1,-1,853,-1,-1,-1,-1,264,194,260,947,-1,752,147,-1,-1,343,112,273,344,680,540,-1] +]; + +minimalNetwork(testNetwork); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-108-diophantine-reciprocals-i.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-108-diophantine-reciprocals-i.md index d216cfa9fd..3b8d6f014f 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-108-diophantine-reciprocals-i.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-108-diophantine-reciprocals-i.md @@ -10,19 +10,17 @@ dashedName: problem-108-diophantine-reciprocals-i In the following equation x, y, and n are positive integers. -1/`x` + 1/`y` = 1/`n` +$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$ For `n` = 4 there are exactly three distinct solutions: -1/5 + 1/20 = 1/4 -1/6 + 1/12 = 1/4 -1/8 + 1/8 = 1/4 +$$\begin{align} & \frac{1}{5} + \frac{1}{20} = \frac{1}{4}\\\\ \\\\ & \frac{1}{6} + \frac{1}{12} = \frac{1}{4}\\\\ \\\\ & \frac{1}{8} + \frac{1}{8} = \frac{1}{4} \end{align}$$ What is the least value of `n` for which the number of distinct solutions exceeds one-thousand? # --hints-- -`diophantineOne()` should return 180180. +`diophantineOne()` should return `180180`. ```js assert.strictEqual(diophantineOne(), 180180); diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-109-darts.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-109-darts.md index e7a580b45b..3b16fe7ac6 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-109-darts.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-109-darts.md @@ -10,28 +10,26 @@ dashedName: problem-109-darts In the game of darts a player throws three darts at a target board which is split into twenty equal sized sections numbered one to twenty. -The score of a dart is determined by the number of the region that the dart lands in. A dart landing outside the red/green outer ring scores zero. The black and cream regions inside this ring represent single scores. However, the red/green outer ring and middle ring score double and treble scores respectively. At the centre of the board are two concentric circles called the bull region, or bulls-eye. The outer bull is worth 25 points and the inner bull is a double, worth 50 points. There are many variations of rules but in the most popular game the players will begin with a score 301 or 501 and the first player to reduce their running total to zero is a winner. However, it is normal to play a "doubles out" system, which means that the player must land a double (including the double bulls-eye at the centre of the board) on their final dart to win; any other dart that would reduce their running total to one or lower means the score for that set of three darts is "bust". When a player is able to finish on their current score it is called a "checkout" and the highest checkout is 170: T20 T20 D25 (two treble 20s and double bull). There are exactly eleven distinct ways to checkout on a score of 6: +Darts board -D3 +The score of a dart is determined by the number of the region that the dart lands in. A dart landing outside the red/green outer ring scores zero. The black and cream regions inside this ring represent single scores. However, the red/green outer ring and middle ring score double and treble scores respectively. -D1 D2 +At the center of the board are two concentric circles called the bull region, or bulls-eye. The outer bull is worth 25 points and the inner bull is a double, worth 50 points. -S2 D2 +There are many variations of rules but in the most popular game the players will begin with a score of 301 or 501 and the first player to reduce their running total to zero is a winner. However, it is normal to play a "doubles out" system, which means that the player must land a double (including the double bulls-eye at the center of the board) on their final dart to win; any other dart that would reduce their running total to one or lower means the score for that set of three darts is "bust". -D2 D1 +When a player is able to finish on their current score it is called a "checkout" and the highest checkout is 170: T20 T20 D25 (two treble 20s and double bull). There are exactly eleven distinct ways to checkout on a score of 6: -S4 D1 +$$\begin{array} \text{D3} & & \\\\ D1 & D2 & \\\\ S2 & D2 & \\\\ D2 & D1 & \\\\ S4 & D1 & \\\\ S1 & S1 & D2 \\\\ S1 & T1 & D1 \\\\ S1 & S3 & D1 \\\\ D1 & D1 & D1 \\\\ D1 & S2 & D1 \\\\ S2 & S2 & D1 \end{array}$$ -S1 S1 D2 S1 T1 D1 S1 S3 D1 D1 D1 D1 D1 S2 D1 S2 S2 D1 - -Note that D1 D2 is considered different to D2 D1 as they finish on different doubles. However, the combination S1 T1 D1 is considered the same as T1 S1 D1. In addition we shall not include misses in considering combinations; for example, D3 is the same as 0 D3 and 0 0 D3. Incredibly there are 42336 distinct ways of checking out in total. How many distinct ways can a player checkout with a score less than 100? +Note that D1 D2 is considered different from D2 D1 as they finish on different doubles. However, the combination S1 T1 D1 is considered the same as T1 S1 D1. In addition, we shall not include misses in considering combinations; for example, D3 is the same as 0 D3 and 0 0 D3. Incredibly there are 42336 distinct ways of checking out in total. How many distinct ways can a player checkout with a score less than 100? # --hints-- -`euler109()` should return 38182. +`darts()` should return `38182`. ```js -assert.strictEqual(euler109(), 38182); +assert.strictEqual(darts(), 38182); ``` # --seed-- @@ -39,12 +37,12 @@ assert.strictEqual(euler109(), 38182); ## --seed-contents-- ```js -function euler109() { +function darts() { return true; } -euler109(); +darts(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-110-diophantine-reciprocals-ii.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-110-diophantine-reciprocals-ii.md index c50c81a164..79070c6654 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-110-diophantine-reciprocals-ii.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-110-diophantine-reciprocals-ii.md @@ -10,15 +10,17 @@ dashedName: problem-110-diophantine-reciprocals-ii In the following equation x, y, and n are positive integers. -1/`x` + 1/`y` = 1/`n` +$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$ It can be verified that when `n` = 1260 there are 113 distinct solutions and this is the least value of `n` for which the total number of distinct solutions exceeds one hundred. What is the least value of `n` for which the number of distinct solutions exceeds four million? +**Note:** This problem is a much more difficult version of Problem 108 and as it is well beyond the limitations of a brute force approach it requires a clever implementation. + # --hints-- -`diophantineTwo()` should return 9350130049860600. +`diophantineTwo()` should return `9350130049860600`. ```js assert.strictEqual(diophantineTwo(), 9350130049860600); diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-111-primes-with-runs.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-111-primes-with-runs.md index 920085b1f3..a6a9958de7 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-111-primes-with-runs.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-111-primes-with-runs.md @@ -10,24 +10,35 @@ dashedName: problem-111-primes-with-runs Considering 4-digit primes containing repeated digits it is clear that they cannot all be the same: 1111 is divisible by 11, 2222 is divisible by 22, and so on. But there are nine 4-digit primes containing three ones: -1117, 1151, 1171, 1181, 1511, 1811, 2111, 4111, 8111 +$$1117, 1151, 1171, 1181, 1511, 1811, 2111, 4111, 8111$$ -We shall say that M(n, d) represents the maximum number of repeated digits for an n-digit prime where d is the repeated digit, N(n, d) represents the number of such primes, and S(n, d) represents the sum of these primes. +We shall say that $M(n, d)$ represents the maximum number of repeated digits for an n-digit prime where d is the repeated digit, $N(n, d)$ represents the number of such primes, and $S(n, d)$ represents the sum of these primes. -So M(4, 1) = 3 is the maximum number of repeated digits for a 4-digit prime where one is the repeated digit, there are N(4, 1) = 9 such primes, and the sum of these primes is S(4, 1) = 22275. It turns out that for d = 0, it is only possible to have M(4, 0) = 2 repeated digits, but there are N(4, 0) = 13 such cases. +So $M(4, 1) = 3$ is the maximum number of repeated digits for a 4-digit prime where one is the repeated digit, there are $N(4, 1) = 9$ such primes, and the sum of these primes is $S(4, 1) = 22275$. It turns out that for d = 0, it is only possible to have $M(4, 0) = 2$ repeated digits, but there are $N(4, 0) = 13$ such cases. In the same way we obtain the following results for 4-digit primes. -Digit, d M(4, d) N(4, d) S(4, d) 0 2 13 67061 1 3 9 22275 2 3 1 2221 3 3 12 46214 4 3 2 8888 5 3 1 5557 6 3 1 6661 7 3 9 57863 8 3 1 8887 9 3 7 48073 +| Digit, d | $M(4, d)$ | $N(4, d)$ | $S(4, d)$ | +| -------- | --------- | --------- | --------- | +| 0 | 2 | 13 | 67061 | +| 1 | 3 | 9 | 22275 | +| 2 | 3 | 1 | 2221 | +| 3 | 3 | 12 | 46214 | +| 4 | 3 | 2 | 8888 | +| 5 | 3 | 1 | 5557 | +| 6 | 3 | 1 | 6661 | +| 7 | 3 | 9 | 57863 | +| 8 | 3 | 1 | 8887 | +| 9 | 3 | 7 | 48073 | -For d = 0 to 9, the sum of all S(4, d) is 273700. Find the sum of all S(10, d). +For d = 0 to 9, the sum of all $S(4, d)$ is 273700. Find the sum of all $S(10, d)$. # --hints-- -`euler111()` should return 612407567715. +`primesWithRuns()` should return `612407567715`. ```js -assert.strictEqual(euler111(), 612407567715); +assert.strictEqual(primesWithRuns(), 612407567715); ``` # --seed-- @@ -35,12 +46,12 @@ assert.strictEqual(euler111(), 612407567715); ## --seed-contents-- ```js -function euler111() { +function primesWithRuns() { return true; } -euler111(); +primesWithRuns(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-112-bouncy-numbers.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-112-bouncy-numbers.md index cd998d5bde..d2b8f07198 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-112-bouncy-numbers.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-112-bouncy-numbers.md @@ -22,10 +22,10 @@ Find the least number for which the proportion of bouncy numbers is exactly 99%. # --hints-- -`euler112()` should return 1587000. +`bouncyNumbers()` should return `1587000`. ```js -assert.strictEqual(euler112(), 1587000); +assert.strictEqual(bouncyNumbers(), 1587000); ``` # --seed-- @@ -33,12 +33,12 @@ assert.strictEqual(euler112(), 1587000); ## --seed-contents-- ```js -function euler112() { +function bouncyNumbers() { return true; } -euler112(); +bouncyNumbers(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-113-non-bouncy-numbers.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-113-non-bouncy-numbers.md index bc28697a24..a06f41a9a5 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-113-non-bouncy-numbers.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-113-non-bouncy-numbers.md @@ -14,16 +14,16 @@ Similarly if no digit is exceeded by the digit to its right it is called a decre We shall call a positive integer that is neither increasing nor decreasing a "bouncy" number; for example, 155349. -As n increases, the proportion of bouncy numbers below n increases such that there are only 12951 numbers below one-million that are not bouncy and only 277032 non-bouncy numbers below 1010. +As n increases, the proportion of bouncy numbers below n increases such that there are only 12951 numbers below one-million that are not bouncy and only 277032 non-bouncy numbers below ${10}^{10}$. -How many numbers below a googol (10100) are not bouncy? +How many numbers below a googol (${10}^{100}$) are not bouncy? # --hints-- -`euler113()` should return 51161058134250. +`nonBouncyNumbers()` should return `51161058134250`. ```js -assert.strictEqual(euler113(), 51161058134250); +assert.strictEqual(nonBouncyNumbers(), 51161058134250); ``` # --seed-- @@ -31,12 +31,12 @@ assert.strictEqual(euler113(), 51161058134250); ## --seed-contents-- ```js -function euler113() { +function nonBouncyNumbers() { return true; } -euler113(); +nonBouncyNumbers(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-114-counting-block-combinations-i.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-114-counting-block-combinations-i.md index c9ec66c9aa..c6690bddf5 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-114-counting-block-combinations-i.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-114-counting-block-combinations-i.md @@ -10,14 +10,18 @@ dashedName: problem-114-counting-block-combinations-i A row measuring seven units in length has red blocks with a minimum length of three units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square. There are exactly seventeen ways of doing this. -How many ways can a row measuring fifty units in length be filled? NOTE: Although the example above does not lend itself to the possibility, in general it is permitted to mix block sizes. For example, on a row measuring eight units in length you could use red (3), black (1), and red (4). +Possible ways of placing block with a minimum length of three units, on a row with length of seven units + +How many ways can a row measuring fifty units in length be filled? + +**Note:** Although the example above does not lend itself to the possibility, in general it is permitted to mix block sizes. For example, on a row measuring eight units in length you could use red (3), black (1), and red (4). # --hints-- -`euler114()` should return 16475640049. +`countingBlockOne()` should return `16475640049`. ```js -assert.strictEqual(euler114(), 16475640049); +assert.strictEqual(countingBlockOne(), 16475640049); ``` # --seed-- @@ -25,12 +29,12 @@ assert.strictEqual(euler114(), 16475640049); ## --seed-contents-- ```js -function euler114() { +function countingBlockOne() { return true; } -euler114(); +countingBlockOne(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-115-counting-block-combinations-ii.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-115-counting-block-combinations-ii.md index 069a8a2c38..1e65da5610 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-115-counting-block-combinations-ii.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-115-counting-block-combinations-ii.md @@ -8,26 +8,26 @@ dashedName: problem-115-counting-block-combinations-ii # --description-- -NOTE: This is a more difficult version of Problem 114. +A row measuring `n` units in length has red blocks with a minimum length of `m` units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square. -A row measuring n units in length has red blocks with a minimum length of m units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square. +Let the fill-count function, $F(m, n)$, represent the number of ways that a row can be filled. -Let the fill-count function, F(m, n), represent the number of ways that a row can be filled. - -For example, F(3, 29) = 673135 and F(3, 30) = 1089155. +For example, $F(3, 29) = 673135$ and $F(3, 30) = 1089155$. That is, for m = 3, it can be seen that n = 30 is the smallest value for which the fill-count function first exceeds one million. -In the same way, for m = 10, it can be verified that F(10, 56) = 880711 and F(10, 57) = 1148904, so n = 57 is the least value for which the fill-count function first exceeds one million. +In the same way, for m = 10, it can be verified that $F(10, 56) = 880711$ and $F(10, 57) = 1148904$, so n = 57 is the least value for which the fill-count function first exceeds one million. -For m = 50, find the least value of n for which the fill-count function first exceeds one million. +For m = 50, find the least value of `n` for which the fill-count function first exceeds one million. + +**Note:** This is a more difficult version of Problem 114. # --hints-- -`euler115()` should return 168. +`countingBlockTwo()` should return `168`. ```js -assert.strictEqual(euler115(), 168); +assert.strictEqual(countingBlockTwo(), 168); ``` # --seed-- @@ -35,12 +35,12 @@ assert.strictEqual(euler115(), 168); ## --seed-contents-- ```js -function euler115() { +function countingBlockTwo() { return true; } -euler115(); +countingBlockTwo(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-116-red-green-or-blue-tiles.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-116-red-green-or-blue-tiles.md index 1f61195dea..a88bc07a34 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-116-red-green-or-blue-tiles.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-116-red-green-or-blue-tiles.md @@ -12,18 +12,26 @@ A row of five black square tiles is to have a number of its tiles replaced with If red tiles are chosen there are exactly seven ways this can be done. +Possible ways to placing red oblong on a row with length of five units + If green tiles are chosen there are three ways. +Possible ways of placing green oblong on a row with length of five units + And if blue tiles are chosen there are two ways. -Assuming that colours cannot be mixed there are 7 + 3 + 2 = 12 ways of replacing the black tiles in a row measuring five units in length. How many different ways can the black tiles in a row measuring fifty units in length be replaced if colours cannot be mixed and at least one coloured tile must be used? NOTE: This is related to Problem 117. +Possible ways of placing blue oblong on a row with length of five units + +Assuming that colors cannot be mixed there are 7 + 3 + 2 = 12 ways of replacing the black tiles in a row measuring five units in length. How many different ways can the black tiles in a row measuring fifty units in length be replaced if colors cannot be mixed and at least one colored tile must be used? + +**Note:** This is related to Problem 117. # --hints-- -`euler116()` should return 20492570929. +`redGreenBlueOne()` should return `20492570929`. ```js -assert.strictEqual(euler116(), 20492570929); +assert.strictEqual(redGreenBlueOne(), 20492570929); ``` # --seed-- @@ -31,12 +39,12 @@ assert.strictEqual(euler116(), 20492570929); ## --seed-contents-- ```js -function euler116() { +function redGreenBlueOne() { return true; } -euler116(); +redGreenBlueOne(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-117-red-green-and-blue-tiles.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-117-red-green-and-blue-tiles.md index 80f46d1201..ed6d035559 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-117-red-green-and-blue-tiles.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-117-red-green-and-blue-tiles.md @@ -10,14 +10,18 @@ dashedName: problem-117-red-green-and-blue-tiles Using a combination of black square tiles and oblong tiles chosen from: red tiles measuring two units, green tiles measuring three units, and blue tiles measuring four units, it is possible to tile a row measuring five units in length in exactly fifteen different ways. -How many ways can a row measuring fifty units in length be tiled? NOTE: This is related to Problem 116. +Possible ways of placing red, green and blue oblongs on a row with length of five units + +How many ways can a row measuring fifty units in length be tiled? + +**Note**: This is related to Problem 116. # --hints-- -`euler117()` should return 100808458960497. +`redGreenBlueTilesTwo()` should return `100808458960497`. ```js -assert.strictEqual(euler117(), 100808458960497); +assert.strictEqual(redGreenBlueTilesTwo(), 100808458960497); ``` # --seed-- @@ -25,12 +29,12 @@ assert.strictEqual(euler117(), 100808458960497); ## --seed-contents-- ```js -function euler117() { +function redGreenBlueTilesTwo() { return true; } -euler117(); +redGreenBlueTilesTwo(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-118-pandigital-prime-sets.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-118-pandigital-prime-sets.md index 8bcd4b5dcd..00a0605319 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-118-pandigital-prime-sets.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-118-pandigital-prime-sets.md @@ -8,16 +8,16 @@ dashedName: problem-118-pandigital-prime-sets # --description-- -Using all of the digits 1 through 9 and concatenating them freely to form decimal integers, different sets can be formed. Interestingly with the set {2,5,47,89,631}, all of the elements belonging to it are prime. +Using all of the digits 1 through 9 and concatenating them freely to form decimal integers, different sets can be formed. Interestingly with the set $\\{2, 5, 47, 89, 631\\}$, all of the elements belonging to it are prime. How many distinct sets containing each of the digits one through nine exactly once contain only prime elements? # --hints-- -`euler118()` should return 44680. +`pandigitalPrimeSets()` should return `44680`. ```js -assert.strictEqual(euler118(), 44680); +assert.strictEqual(pandigitalPrimeSets(), 44680); ``` # --seed-- @@ -25,12 +25,12 @@ assert.strictEqual(euler118(), 44680); ## --seed-contents-- ```js -function euler118() { +function pandigitalPrimeSets() { return true; } -euler118(); +pandigitalPrimeSets(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-119-digit-power-sum.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-119-digit-power-sum.md index 40853a1314..72ed8397d7 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-119-digit-power-sum.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-119-digit-power-sum.md @@ -8,20 +8,20 @@ dashedName: problem-119-digit-power-sum # --description-- -The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with this property is 614656 = 284. +The number 512 is interesting because it is equal to the sum of its digits raised to some power: $5 + 1 + 2 = 8$, and $8^3 = 512$. Another example of a number with this property is $614656 = 28^4$. -We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a sum. +We shall define an to be the $n-th$ term of this sequence and insist that a number must contain at least two digits to have a sum. -You are given that a2 = 512 and a10 = 614656. +You are given that $a_2 = 512$ and $a_{10} = 614656$. -Find a30. +Find $a_{30}$. # --hints-- -`euler119()` should return 248155780267521. +`digitPowerSum()` should return `248155780267521`. ```js -assert.strictEqual(euler119(), 248155780267521); +assert.strictEqual(digitPowerSum(), 248155780267521); ``` # --seed-- @@ -29,12 +29,12 @@ assert.strictEqual(euler119(), 248155780267521); ## --seed-contents-- ```js -function euler119() { +function digitPowerSum() { return true; } -euler119(); +digitPowerSum(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-120-square-remainders.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-120-square-remainders.md index 6bcf398e78..828f12b906 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-120-square-remainders.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-120-square-remainders.md @@ -8,18 +8,18 @@ dashedName: problem-120-square-remainders # --description-- -Let r be the remainder when (a−1)n + (a+1)n is divided by a2. +Let `r` be the remainder when ${(a − 1)}^n + {(a + 1)}^n$ is divided by $a^2$. -For example, if a = 7 and n = 3, then r = 42: 63 + 83 = 728 ≡ 42 mod 49. And as n varies, so too will r, but for a = 7 it turns out that rmax = 42. +For example, if $a = 7$ and $n = 3$, then $r = 42: 6^3 + 8^3 = 728 ≡ 42 \\ \text{mod}\\ 49$. And as `n` varies, so too will `r`, but for $a = 7$ it turns out that $r_{max} = 42$. -For 3 ≤ a ≤ 1000, find ∑ rmax. +For $3 ≤ a ≤ 1000$, find $\sum{r}_{max}$. # --hints-- -`euler120()` should return 333082500. +`squareRemainders()` should return `333082500`. ```js -assert.strictEqual(euler120(), 333082500); +assert.strictEqual(squareRemainders(), 333082500); ``` # --seed-- @@ -27,12 +27,12 @@ assert.strictEqual(euler120(), 333082500); ## --seed-contents-- ```js -function euler120() { +function squareRemainders() { return true; } -euler120(); +squareRemainders(); ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-15-lattice-paths.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-15-lattice-paths.md index b3b0a499c3..225a31ee93 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-15-lattice-paths.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-15-lattice-paths.md @@ -10,7 +10,7 @@ dashedName: problem-15-lattice-paths Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner. -a diagram of 6 2 by 2 grids showing all the routes to the bottom right corner +a diagram of 6 2 by 2 grids showing all the routes to the bottom right corner How many such routes are there through a given `gridSize`? diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.md index b632361a8b..fa659c2f46 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.md @@ -1,8 +1,7 @@ --- id: 5900f4031000cf542c50ff15 title: >- - Problem 150: Searching a triangular array for a sub-triangle having - minimum-sum + Problem 150: Searching a triangular array for a sub-triangle having minimum-sum challengeType: 5 forumTopicId: 301781 dashedName: problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md index c447c7ce9f..6b979cb0d7 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md @@ -1,8 +1,7 @@ --- id: 5900f40a1000cf542c50ff1d title: >- - Problem 158: Exploring strings for which only one character comes - lexicographically after its neighbour to the left + Problem 158: Exploring strings for which only one character comes lexicographically after its neighbour to the left challengeType: 5 forumTopicId: 301789 dashedName: >- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value.md index e511646823..8082f00bff 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value.md @@ -1,8 +1,7 @@ --- id: 5900f4111000cf542c50ff23 title: >- - Problem 164: Numbers for which no three consecutive digits have a sum greater - than a given value + Problem 164: Numbers for which no three consecutive digits have a sum greater than a given value challengeType: 5 forumTopicId: 301798 dashedName: >- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-169-exploring-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-169-exploring-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md index 0cfb0034f4..e0bf8ea804 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-169-exploring-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-169-exploring-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md @@ -1,8 +1,7 @@ --- id: 5900f4151000cf542c50ff28 title: >- - Problem 169: Exploring the number of different ways a number can be expressed - as a sum of powers of 2 + Problem 169: Exploring the number of different ways a number can be expressed as a sum of powers of 2 challengeType: 5 forumTopicId: 301803 dashedName: >- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-170-find-the-largest-0-to-9-pandigital-that-can-be-formed-by-concatenating-products.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-170-find-the-largest-0-to-9-pandigital-that-can-be-formed-by-concatenating-products.md index f12d0490f2..7a7e20558b 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-170-find-the-largest-0-to-9-pandigital-that-can-be-formed-by-concatenating-products.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-170-find-the-largest-0-to-9-pandigital-that-can-be-formed-by-concatenating-products.md @@ -1,8 +1,7 @@ --- id: 5900f4161000cf542c50ff29 title: >- - Problem 170: Find the largest 0 to 9 pandigital that can be formed by - concatenating products + Problem 170: Find the largest 0 to 9 pandigital that can be formed by concatenating products challengeType: 5 forumTopicId: 301805 dashedName: >- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square.md index d03ddf909b..2b355e111f 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square.md @@ -1,8 +1,7 @@ --- id: 5900f4181000cf542c50ff2a title: >- - Problem 171: Finding numbers for which the sum of the squares of the digits is - a square + Problem 171: Finding numbers for which the sum of the squares of the digits is a square challengeType: 5 forumTopicId: 301806 dashedName: >- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-173-using-up-to-one-million-tiles-how-many-different-hollow-square-laminae-can-be-formed.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-173-using-up-to-one-million-tiles-how-many-different-hollow-square-laminae-can-be-formed.md index a07789fd1d..700b710e80 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-173-using-up-to-one-million-tiles-how-many-different-hollow-square-laminae-can-be-formed.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-173-using-up-to-one-million-tiles-how-many-different-hollow-square-laminae-can-be-formed.md @@ -1,8 +1,7 @@ --- id: 5900f41a1000cf542c50ff2c title: >- - Problem 173: Using up to one million tiles how many different "hollow" square - laminae can be formed? + Problem 173: Using up to one million tiles how many different "hollow" square laminae can be formed? challengeType: 5 forumTopicId: 301808 dashedName: >- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-174-counting-the-number-of-hollow-square-laminae-that-can-form-one-two-three-...-distinct-arrangements.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-174-counting-the-number-of-hollow-square-laminae-that-can-form-one-two-three-...-distinct-arrangements.md index e7183612d5..1327791938 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-174-counting-the-number-of-hollow-square-laminae-that-can-form-one-two-three-...-distinct-arrangements.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-174-counting-the-number-of-hollow-square-laminae-that-can-form-one-two-three-...-distinct-arrangements.md @@ -1,8 +1,7 @@ --- id: 5900f41a1000cf542c50ff2d title: >- - Problem 174: Counting the number of "hollow" square laminae that can form one, - two, three, ... distinct arrangements + Problem 174: Counting the number of "hollow" square laminae that can form one, two, three, ... distinct arrangements challengeType: 5 forumTopicId: 301809 dashedName: >- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-175-fractions-involving-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-175-fractions-involving-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md index 8f32fcb4bd..cd3abbf807 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-175-fractions-involving-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-175-fractions-involving-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md @@ -1,8 +1,7 @@ --- id: 5900f41c1000cf542c50ff2e title: >- - Problem 175: Fractions involving the number of different ways a number can be - expressed as a sum of powers of 2 + Problem 175: Fractions involving the number of different ways a number can be expressed as a sum of powers of 2 challengeType: 5 forumTopicId: 301810 dashedName: >- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-181-investigating-in-how-many-ways-objects-of-two-different-colours-can-be-grouped.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-181-investigating-in-how-many-ways-objects-of-two-different-colours-can-be-grouped.md index 01c3730a1a..1aa8a4d087 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-181-investigating-in-how-many-ways-objects-of-two-different-colours-can-be-grouped.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-181-investigating-in-how-many-ways-objects-of-two-different-colours-can-be-grouped.md @@ -1,8 +1,7 @@ --- id: 5900f4231000cf542c50ff34 title: >- - Problem 181: Investigating in how many ways objects of two different colours - can be grouped + Problem 181: Investigating in how many ways objects of two different colours can be grouped challengeType: 5 forumTopicId: 301817 dashedName: >- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-182-rsa-encryption.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-182-rsa-encryption.md index 7ffc6ae376..c739b6384a 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-182-rsa-encryption.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-182-rsa-encryption.md @@ -10,26 +10,15 @@ dashedName: problem-182-rsa-encryption The RSA encryption is based on the following procedure: -Generate two distinct primes `p` and `q`. -Compute `n=p*q` and `φ=(p-1)(q-1)`. -Find an integer `e`, `1 < e < φ`, such that `gcd(e,φ) = 1` +Generate two distinct primes `p` and `q`. Compute `n=p*q` and `φ=(p-1)(q-1)`. Find an integer `e`, `1 < e < φ`, such that `gcd(e,φ) = 1` -A message in this system is a number in the interval `[0,n-1]`. -A text to be encrypted is then somehow converted to messages (numbers in the interval `[0,n-1]`). -To encrypt the text, for each message, `m`, c=me mod n is calculated. +A message in this system is a number in the interval `[0,n-1]`. A text to be encrypted is then somehow converted to messages (numbers in the interval `[0,n-1]`). To encrypt the text, for each message, `m`, c=me mod n is calculated. To decrypt the text, the following procedure is needed: calculate `d` such that `ed=1 mod φ`, then for each encrypted message, `c`, calculate m=cd mod n. -There exist values of `e` and `m` such that me mod n = m. -We call messages `m` for which me mod n=m unconcealed messages. +There exist values of `e` and `m` such that me mod n = m. We call messages `m` for which me mod n=m unconcealed messages. -An issue when choosing `e` is that there should not be too many unconcealed messages. -For instance, let `p=19` and `q=37`. -Then `n=19*37=703` and `φ=18*36=648`. -If we choose `e=181`, then, although `gcd(181,648)=1` it turns out that all possible messages -m `(0≤m≤n-1)` are unconcealed when calculating me mod n. -For any valid choice of `e` there exist some unconcealed messages. -It's important that the number of unconcealed messages is at a minimum. +An issue when choosing `e` is that there should not be too many unconcealed messages. For instance, let `p=19` and `q=37`. Then `n=19*37=703` and `φ=18*36=648`. If we choose `e=181`, then, although `gcd(181,648)=1` it turns out that all possible messages m `(0≤m≤n-1)` are unconcealed when calculating me mod n. For any valid choice of `e` there exist some unconcealed messages. It's important that the number of unconcealed messages is at a minimum. For any given `p` and `q`, find the sum of all values of `e`, `1 < e < φ(p,q)` and `gcd(e,φ)=1`, so that the number of unconcealed messages for this value of `e` is at a minimum. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-199-iterative-circle-packing.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-199-iterative-circle-packing.md index 28479e80b7..0194bbb44d 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-199-iterative-circle-packing.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-199-iterative-circle-packing.md @@ -10,7 +10,7 @@ dashedName: problem-199-iterative-circle-packing Three circles of equal radius are placed inside a larger circle such that each pair of circles is tangent to one another and the inner circles do not overlap. There are four uncovered "gaps" which are to be filled iteratively with more tangent circles. -a diagram of non-overlapping concentric circles +a diagram of non-overlapping concentric circles At each iteration, a maximally sized circle is placed in each gap, which creates more gaps for the next iteration. After 3 iterations (pictured), there are 108 gaps and the fraction of the area which is not covered by circles is 0.06790342, rounded to eight decimal places. @@ -60,7 +60,7 @@ function iterativeCirclePacking(n) { a1 += 3 * getArea(k0, k1, k1, n); a1 += getArea(k1, k1, k1, n); let final = ((a0 - a1) / a0).toFixed(8); - + return parseFloat(final); function getArea(k1, k2, k3, depth) { if (depth == 0) return 0.0; diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-200-find-the-200th-prime-proof-sqube-containing-the-contiguous-sub-string-200.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-200-find-the-200th-prime-proof-sqube-containing-the-contiguous-sub-string-200.md index bacbb306a1..c6458059ce 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-200-find-the-200th-prime-proof-sqube-containing-the-contiguous-sub-string-200.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-200-find-the-200th-prime-proof-sqube-containing-the-contiguous-sub-string-200.md @@ -1,8 +1,7 @@ --- id: 5900f4351000cf542c50ff47 title: >- - Problem 200: Find the 200th prime-proof sqube containing the contiguous - sub-string "200" + Problem 200: Find the 200th prime-proof sqube containing the contiguous sub-string "200" challengeType: 5 forumTopicId: 301840 dashedName: >- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-268-counting-numbers-with-at-least-four-distinct-prime-factors-less-than-100.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-268-counting-numbers-with-at-least-four-distinct-prime-factors-less-than-100.md index c703c2b10f..d11cb99eef 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-268-counting-numbers-with-at-least-four-distinct-prime-factors-less-than-100.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-268-counting-numbers-with-at-least-four-distinct-prime-factors-less-than-100.md @@ -1,8 +1,7 @@ --- id: 5900f4791000cf542c50ff8b title: >- - Problem 268: Counting numbers with at least four distinct prime factors less - than 100 + Problem 268: Counting numbers with at least four distinct prime factors less than 100 challengeType: 5 forumTopicId: 301917 dashedName: >- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-283-integer-sided-triangles-for-which-the-area--perimeter-ratio-is-integral.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-283-integer-sided-triangles-for-which-the-area--perimeter-ratio-is-integral.md index 7073e7c431..e15776ec08 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-283-integer-sided-triangles-for-which-the-area--perimeter-ratio-is-integral.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-283-integer-sided-triangles-for-which-the-area--perimeter-ratio-is-integral.md @@ -1,8 +1,7 @@ --- id: 5900f4881000cf542c50ff9a title: >- - Problem 283: Integer sided triangles for which the area * perimeter ratio is - integral + Problem 283: Integer sided triangles for which the area * perimeter ratio is integral challengeType: 5 forumTopicId: 301934 dashedName: >- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-349-langtons-ant.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-349-langtons-ant.md index e73c284fff..239ba5a6a1 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-349-langtons-ant.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-349-langtons-ant.md @@ -16,7 +16,7 @@ The ant is always oriented in one of the cardinal directions (left, right, up or \- if it is on a white square, it flips the color of the square to black, rotates 90 degrees clockwise and moves forward one square. -Starting with a grid that is entirely white, how many squares are black after 1018 moves of the ant? +Starting with a grid that is entirely white, how many squares are black after 1018 moves of the ant? # --hints-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-35-circular-primes.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-35-circular-primes.md index 9abfdee8ae..d3d74989d6 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-35-circular-primes.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-35-circular-primes.md @@ -14,7 +14,7 @@ There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73 How many circular primes are there below `n`, whereas 100 ≤ `n` ≤ 1000000? -**Note:** +**Note:** Circular primes individual rotation can exceed `n`. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-38-pandigital-multiples.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-38-pandigital-multiples.md index e385d29d0f..1c3f0c56c6 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-38-pandigital-multiples.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-38-pandigital-multiples.md @@ -10,11 +10,7 @@ dashedName: problem-38-pandigital-multiples Take the number 192 and multiply it by each of 1, 2, and 3: -$$\begin{align} - 192 × 1 = 192\\\\ - 192 × 2 = 384\\\\ - 192 × 3 = 576\\\\ -\end{align}$$ +$$\begin{align} 192 × 1 = 192\\\\ 192 × 2 = 384\\\\ 192 × 3 = 576\\\\ \end{align}$$ By concatenating each product we get the 1 to 9 pandigital, 192384576. We will call 192384576 the concatenated product of 192 and (1, 2, 3). diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-428-necklace-of-circles.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-428-necklace-of-circles.md index e3b2460e6d..5919151606 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-428-necklace-of-circles.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-428-necklace-of-circles.md @@ -20,7 +20,7 @@ The triplet (`a`, `b`, `c`) is called a *necklace triplet* if you can place `k`
        • Ci has no common interior points with any Cj for 1 ≤ i, jk and ij,
        • Ci is tangent to both Cin and Cout for 1 ≤ ik,
        • Ci is tangent to Ci+1 for 1 ≤ i < k, and
        • Ck is tangent to C1.
        For example, (5, 5, 5) and (4, 3, 21) are necklace triplets, while it can be shown that (2, 2, 5) is not. -a visual representation of a necklace triplet +a visual representation of a necklace triplet Let T(`n`) be the number of necklace triplets (`a`, `b`, `c`) such that `a`, `b` and `c` are positive integers, and `b` ≤ `n`. For example, T(1) = 9, T(20) = 732 and T(3000) = 438106. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-461-almost-pi.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-461-almost-pi.md index 10a83e63f8..9903fbe010 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-461-almost-pi.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-461-almost-pi.md @@ -56,7 +56,7 @@ assert.strictEqual(almostPi(200), 64658); ```js function almostPi(n) { - + return true; } ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-51-prime-digit-replacements.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-51-prime-digit-replacements.md index 7190e580ae..d890d42133 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-51-prime-digit-replacements.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-51-prime-digit-replacements.md @@ -12,20 +12,32 @@ By replacing the 1st digit of the 2-digit number \*3, it turns out that six of t By replacing the 3rd and 4th digits of 56\*\*3 with the same digit, this 5-digit number is the first example having seven primes among the ten generated numbers, yielding the family: 56003, 56113, 56333, 56443, 56663, 56773, and 56993. Consequently 56003, being the first member of this family, is the smallest prime with this property. -Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an eight prime value family. +Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an `n` prime value family. # --hints-- -`primeDigitReplacements()` should return a number. +`primeDigitReplacements(6)` should return a number. ```js -assert(typeof primeDigitReplacements() === 'number'); +assert(typeof primeDigitReplacements(6) === 'number'); ``` -`primeDigitReplacements()` should return 121313. +`primeDigitReplacements(6)` should return `13`. ```js -assert.strictEqual(primeDigitReplacements(), 121313); +assert.strictEqual(primeDigitReplacements(6), 13); +``` + +`primeDigitReplacements(7)` should return `56003`. + +```js +assert.strictEqual(primeDigitReplacements(7), 56003); +``` + +`primeDigitReplacements(8)` should return `121313`. + +```js +assert.strictEqual(primeDigitReplacements(8), 121313); ``` # --seed-- @@ -33,16 +45,81 @@ assert.strictEqual(primeDigitReplacements(), 121313); ## --seed-contents-- ```js -function primeDigitReplacements() { +function primeDigitReplacements(n) { return true; } -primeDigitReplacements(); +primeDigitReplacements(6); ``` # --solutions-- ```js -// solution required +function primeDigitReplacements(n) { + function isNFamily(number, primesMap, n) { + const prime = number.toString(); + const lastDigit = prime[prime.length - 1]; + return ( + doesReplacingMakeFamily(prime, '0', primesMap, n) || + (lastDigit !== '1' && + doesReplacingMakeFamily(prime, '1', primesMap, n)) || + doesReplacingMakeFamily(prime, '2', primesMap, n) + ); + } + + function doesReplacingMakeFamily(prime, digitToReplace, primesMap, family) { + let count = 0; + const replaceWith = '0123456789'; + + for (let i = 0; i < replaceWith.length; i++) { + const nextNumber = parseInt( + prime.replace(new RegExp(digitToReplace, 'g'), replaceWith[i]), + 10 + ); + + if (isPartOfFamily(nextNumber, prime, primesMap)) { + count++; + } + } + return count === family; + } + + function isPartOfFamily(number, prime, primesMap) { + return ( + isPrime(number, primesMap) && number.toString().length === prime.length + ); + } + + function getSievePrimes(max) { + const primesMap = new Array(max).fill(true); + primesMap[0] = false; + primesMap[1] = false; + + for (let i = 2; i < max; i++) { + if (primesMap[i]) { + let j = i * i; + for (j; j < max; j += i) { + primesMap[j] = false; + } + } + } + return primesMap; + } + + function isPrime(num, primesMap) { + return primesMap[num]; + } + + const primesMap = getSievePrimes(1000000); + + for (let number = 1; number < 300000; number++) { + if (primesMap[number]) { + if (isNFamily(number, primesMap, n)) { + return number; + } + } + } + return -1; +} ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-54-poker-hands.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-54-poker-hands.md index 16e04a9885..fd260cddf9 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-54-poker-hands.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-54-poker-hands.md @@ -29,11 +29,11 @@ If two players have the same ranked hands then the rank made up of the highest v Consider the following five hands dealt to two players: -| Hand | Player 1 | Player 2 | Winner | -| ------------------ | --------------------------------------------------------- | ---------------------------------------------------------- | -------- | -| 1 | 5H 5C 6S 7S KD
        Pair of Fives | 2C 3S 8S 8D TD
        Pair of Eights | Player 2 | -| 2 | 5D 8C 9S JS AC
        Highest card Ace | 2C 5C 7D 8S QH
        Highest card Queen | Player 1 | -| 3 | 2D 9C AS AH AC
        Three Aces | 3D 6D 7D TD QD
        Flush with Diamonds | Player 2 | +| Hand | Player 1 | Player 2 | Winner | +| ------------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------- | -------- | +| 1 | 5H 5C 6S 7S KD
        Pair of Fives | 2C 3S 8S 8D TD
        Pair of Eights | Player 2 | +| 2 | 5D 8C 9S JS AC
        Highest card Ace | 2C 5C 7D 8S QH
        Highest card Queen | Player 1 | +| 3 | 2D 9C AS AH AC
        Three Aces | 3D 6D 7D TD QD
        Flush with Diamonds | Player 2 | | 4 | 4D 6S 9H QH QC
        Pair of Queens
        Highest card Nine | 3D 6D 7H QD QS
        Pair of Queens
        Highest card Seven | Player 1 | | 5 | 2H 2D 4C 4D 4S
        Full House
        with Three Fours | 3C 3D 3S 9S 9D
        Full House
        with Three Threes | Player 1 | diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-61-cyclical-figurate-numbers.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-61-cyclical-figurate-numbers.md index 3f1e157026..8989f4171c 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-61-cyclical-figurate-numbers.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-61-cyclical-figurate-numbers.md @@ -10,14 +10,14 @@ dashedName: problem-61-cyclical-figurate-numbers Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae: -| Type of Number | Formula | Sequence | -| -------------- | ---------------------------- | --------------------- | +| Type of Number | Formula | Sequence | +| -------------- | ----------------------------- | --------------------- | | Triangle | $P_3(n) = \frac{n(n+1)}{2}$ | 1, 3, 6, 10, 15, ... | -| Square | $P_4(n) = n^2$ | 1, 4, 9, 16, 25, ... | +| Square | $P_4(n) = n^2$ | 1, 4, 9, 16, 25, ... | | Pentagonal | $P_5(n) = \frac{n(3n−1)}2$ | 1, 5, 12, 22, 35, ... | -| Hexagonal | $P_6(n) = n(2n−1)$ | 1, 6, 15, 28, 45, ... | +| Hexagonal | $P_6(n) = n(2n−1)$ | 1, 6, 15, 28, 45, ... | | Heptagonal | $P_7(n) = \frac{n(5n−3)}{2}$ | 1, 7, 18, 34, 55, ... | -| Octagonal | $P_8(n) = n(3n−2)$ | 1, 8, 21, 40, 65, ... | +| Octagonal | $P_8(n) = n(3n−2)$ | 1, 8, 21, 40, 65, ... | The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-68-magic-5-gon-ring.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-68-magic-5-gon-ring.md index 1492709e24..1ae580513f 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-68-magic-5-gon-ring.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-68-magic-5-gon-ring.md @@ -10,7 +10,7 @@ dashedName: problem-68-magic-5-gon-ring Consider the following "magic" 3-gon ring, filled with the numbers 1 to 6, and each line adding to nine. -a completed example of a 3-gon ring +a completed example of a 3-gon ring Working **clockwise**, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above solution can be described by the set: 4,3,2; 6,2,1; 5,1,3. @@ -18,7 +18,7 @@ It is possible to complete the ring with four different totals: 9, 10, 11, and 1
        -|
        Total
        |
        Solution Set
        | +| !!crwdBlockTags_6_sgaTkcolBdwrc!! |!!crwdBlockTags_7_sgaTkcolBdwrc!! | | -------------------------------------- | --------------------------------------------- | | 9 | 4,2,3; 5,3,1; 6,1,2 | | 9 | 4,3,2; 6,2,1; 5,1,3 | @@ -35,7 +35,7 @@ By concatenating each group it is possible to form 9-digit strings; the maximum Using the numbers 1 to 10, and depending on arrangements, it is possible to form 16- and 17-digit strings. What is the maximum **16-digit** string for a "magic" 5-gon ring? -a blank diagram of a 5-gon ring +a blank diagram of a 5-gon ring # --hints-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-74-digit-factorial-chains.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-74-digit-factorial-chains.md index f8645892aa..eb9a6e9d13 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-74-digit-factorial-chains.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-74-digit-factorial-chains.md @@ -14,19 +14,11 @@ $$1! + 4! + 5! = 1 + 24 + 120 = 145$$ Perhaps less well known is 169, in that it produces the longest chain of numbers that link back to 169; it turns out that there are only three such loops that exist: -$$\begin{align} -&169 → 363601 → 1454 → 169\\\\ -&871 → 45361 → 871\\\\ -&872 → 45362 → 872\\\\ -\end{align}$$ +$$\begin{align} &169 → 363601 → 1454 → 169\\\\ &871 → 45361 → 871\\\\ &872 → 45362 → 872\\\\ \end{align}$$ It is not difficult to prove that EVERY starting number will eventually get stuck in a loop. For example, -$$\begin{align} -&69 → 363600 → 1454 → 169 → 363601\\ (→ 1454)\\\\ -&78 → 45360 → 871 → 45361\\ (→ 871)\\\\ -&540 → 145\\ (→ 145)\\\\ -\end{align}$$ +$$\begin{align} &69 → 363600 → 1454 → 169 → 363601\\ (→ 1454)\\\\ &78 → 45360 → 871 → 45361\\ (→ 871)\\\\ &540 → 145\\ (→ 145)\\\\ \end{align}$$ Starting with 69 produces a chain of five non-repeating terms, but the longest non-repeating chain with a starting number below one million is sixty terms. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-81-path-sum-two-ways.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-81-path-sum-two-ways.md index 1a34ca9936..542d6ce39a 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-81-path-sum-two-ways.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-81-path-sum-two-ways.md @@ -10,13 +10,7 @@ dashedName: problem-81-path-sum-two-ways In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by **only moving to the right and down**, is indicated in bold red and is equal to `2427`. - $$\begin{pmatrix} - \color{red}{131} & 673 & 234 & 103 & 18\\\\ - \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\ - 630 & 803 & \color{red}{746} & \color{red}{422} & 111\\\\ - 537 & 699 & 497 & \color{red}{121} & 956\\\\ - 805 & 732 & 524 & \color{red}{37} & \color{red}{331} - \end{pmatrix}$$ + $$\begin{pmatrix} \color{red}{131} & 673 & 234 & 103 & 18\\\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\ 630 & 803 & \color{red}{746} & \color{red}{422} & 111\\\\ 537 & 699 & 497 & \color{red}{121} & 956\\\\ 805 & 732 & 524 & \color{red}{37} & \color{red}{331} \end{pmatrix}$$ Find the minimal path sum from the top left to the bottom right by only moving right and down in `matrix`, a 2D array representing a matrix. The maximum matrix size used in the tests will be 80 by 80. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-82-path-sum-three-ways.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-82-path-sum-three-ways.md index 27e015ed2f..ec68b544e2 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-82-path-sum-three-ways.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-82-path-sum-three-ways.md @@ -12,13 +12,7 @@ dashedName: problem-82-path-sum-three-ways The minimal path sum in the 5 by 5 matrix below, by starting in any cell in the left column and finishing in any cell in the right column, and only moving up, down, and right, is indicated in red and bold; the sum is equal to `994`. - $$\begin{pmatrix} - 131 & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\ - \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\ - 630 & 803 & 746 & 422 & 111\\\\ - 537 & 699 & 497 & 121 & 956\\\\ - 805 & 732 & 524 & 37 & 331 - \end{pmatrix}$$ + $$\begin{pmatrix} 131 & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\ 630 & 803 & 746 & 422 & 111\\\\ 537 & 699 & 497 & 121 & 956\\\\ 805 & 732 & 524 & 37 & 331 \end{pmatrix}$$ Find the minimal path sum from the left column to the right column in `matrix`, a 2D array representing a matrix. The maximum matrix size used in tests will be 80 by 80. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-83-path-sum-four-ways.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-83-path-sum-four-ways.md index bd3b6f085a..ce957c019f 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-83-path-sum-four-ways.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-83-path-sum-four-ways.md @@ -12,13 +12,7 @@ dashedName: problem-83-path-sum-four-ways In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by moving left, right, up, and down, is indicated in bold red and is equal to `2297`. - $$\begin{pmatrix} - \color{red}{131} & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\ - \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & \color{red}{150}\\\\ - 630 & 803 & 746 & \color{red}{422} & \color{red}{111}\\\\ - 537 & 699 & 497 & \color{red}{121} & 956\\\\ - 805 & 732 & 524 & \color{red}{37} & \color{red}{331} - \end{pmatrix}$$ + $$\begin{pmatrix} \color{red}{131} & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & \color{red}{150}\\\\ 630 & 803 & 746 & \color{red}{422} & \color{red}{111}\\\\ 537 & 699 & 497 & \color{red}{121} & 956\\\\ 805 & 732 & 524 & \color{red}{37} & \color{red}{331} \end{pmatrix}$$ Find the minimal path sum from the top left to the bottom right by moving left, right, up, and down in `matrix`, a 2D array representing a matrix. The maximum matrix size used in tests will be 80 by 80. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-85-counting-rectangles.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-85-counting-rectangles.md index 5db9e13fec..c6d4c9c2c6 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-85-counting-rectangles.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-85-counting-rectangles.md @@ -10,7 +10,7 @@ dashedName: problem-85-counting-rectangles By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles: -a diagram of the different rectangles found within a 3 by 2 rectangular grid +a diagram of the different rectangles found within a 3 by 2 rectangular grid Although there may not exists a rectangular grid that contains exactly `n` rectangles, find the area of the grid with the nearest solution. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-86-cuboid-route.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-86-cuboid-route.md index caa496a114..bcd935b24d 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-86-cuboid-route.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-86-cuboid-route.md @@ -10,7 +10,7 @@ dashedName: problem-86-cuboid-route A spider, S, sits in one corner of a cuboid room, measuring 6 by 5 by 3, and a fly, F, sits in the opposite corner. By travelling on the surfaces of the room the shortest "straight line" distance from S to F is 10 and the path is shown on the diagram. -a diagram of a spider and fly's path from one corner of a cuboid room to the opposite corner +a diagram of a spider and fly's path from one corner of a cuboid room to the opposite corner However, there are up to three "shortest" path candidates for any given cuboid and the shortest route doesn't always have integer length. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-90-cube-digit-pairs.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-90-cube-digit-pairs.md index c07bf97f28..ef2182b215 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-90-cube-digit-pairs.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-90-cube-digit-pairs.md @@ -12,7 +12,7 @@ Each of the six faces on a cube has a different digit (0 to 9) written on it; th For example, the square number 64 could be formed: -two cubes, one with the number 6 and the other with number 4 +two cubes, one with the number 6 and the other with number 4 In fact, by carefully choosing the digits on both cubes it is possible to display all of the square numbers below one-hundred: 01, 04, 09, 16, 25, 36, 49, 64, and 81. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-91-right-triangles-with-integer-coordinates.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-91-right-triangles-with-integer-coordinates.md index b38a0eb1bc..b920e69678 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-91-right-triangles-with-integer-coordinates.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-91-right-triangles-with-integer-coordinates.md @@ -10,11 +10,11 @@ dashedName: problem-91-right-triangles-with-integer-coordinates The points ${P}(x_1, y_1)$ and ${Q}(x_2, y_2)$ are plotted at integer co-ordinates and are joined to the origin, ${O}(0, 0)$, to form ${\Delta}OPQ$. -a graph plotting points P (x_1, y_1) and Q(x_2, y_2) at integer coordinates that are joined to the origin O (0, 0) +a graph plotting points P (x_1, y_1) and Q(x_2, y_2) at integer coordinates that are joined to the origin O (0, 0) There are exactly fourteen triangles containing a right angle that can be formed when each co-ordinate lies between 0 and 2 inclusive; that is, $0 ≤ x_1, y_1, x_2, y_2 ≤ 2$. -a diagram showing the 14 triangles containing a right angle that can be formed when each coordinate is between 0 and 2 +a diagram showing the 14 triangles containing a right angle that can be formed when each coordinate is between 0 and 2 Given that $0 ≤ x_1, y_1, x_2, y_2 ≤ limit$, how many right triangles can be formed? diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-92-square-digit-chains.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-92-square-digit-chains.md index 065f0b748d..5f62bd9da7 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-92-square-digit-chains.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-92-square-digit-chains.md @@ -12,10 +12,7 @@ A number chain is created by continuously adding the square of the digits in a n For example, -$$\begin{align} - & 44 → 32 → 13 → 10 → \boldsymbol{1} → \boldsymbol{1}\\\\ - & 85 → \boldsymbol{89} → 145 → 42 → 20 → 4 → 16 → 37 → 58 → \boldsymbol{89}\\\\ -\end{align}$$ +$$\begin{align} & 44 → 32 → 13 → 10 → \boldsymbol{1} → \boldsymbol{1}\\\\ & 85 → \boldsymbol{89} → 145 → 42 → 20 → 4 → 16 → 37 → 58 → \boldsymbol{89}\\\\ \end{align}$$ Therefore any chain that arrives at 1 or 89 will become stuck in an endless loop. What is most amazing is that EVERY starting number will eventually arrive at 1 or 89. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-95-amicable-chains.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-95-amicable-chains.md index 9d42e7c6f5..19d2301062 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-95-amicable-chains.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-95-amicable-chains.md @@ -14,9 +14,7 @@ Interestingly the sum of the proper divisors of 220 is 284 and the sum of the pr Perhaps less well known are longer chains. For example, starting with 12496, we form a chain of five numbers: -$$ - 12496 → 14288 → 15472 → 14536 → 14264 \\,(→ 12496 → \cdots) -$$ +$$ 12496 → 14288 → 15472 → 14536 → 14264 \\,(→ 12496 → \cdots) $$ Since this chain returns to its starting point, it is called an amicable chain. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/24-game.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/24-game.md index 80b03ca6a5..7bf28fe4df 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/24-game.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/24-game.md @@ -24,10 +24,10 @@ Implement a function that takes a string of four digits as its argument, with ea
      • The order of the digits when given does not have to be preserved.
      -| Example input | Example output | -| ----------------------------- | ------------------------- | -| solve24("4878"); | (7-8/8)\*4 | -| solve24("1234"); | 3\*1\*4\*2 | +| Example input | Example output | +| ------------------------- | ------------------------- | +| solve24("4878"); | (7-8/8)\*4 | +| solve24("1234"); | 3\*1\*4\*2 | | solve24("6789"); | (6\*8)/(9-7) | | solve24("1127"); | (1+7)\*(2+1) | diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer.md index 66eecef2be..125236ca75 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer.md @@ -8,7 +8,7 @@ dashedName: 9-billion-names-of-god-the-integer # --description-- -This task is a variation of the [short story by Arthur C. Clarke]( "wp: The Nine Billion Names of God#Plot_summary"). +This task is a variation of the [short story by Arthur C. Clarke](https://en.wikipedia.org/wiki/The Nine Billion Names of God#Plot_summary "wp: The Nine Billion Names of God#Plot_summary"). (Solvers should be aware of the consequences of completing this task.) diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/align-columns.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/align-columns.md index 45ff5fa2f3..2b58a1e1d8 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/align-columns.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/align-columns.md @@ -8,35 +8,43 @@ dashedName: align-columns # --description-- -Given a text file of many lines, where fields within a line are delineated by a single `$` character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, or center justified within its column. +Given an array of many lines, where fields within a line are delineated by a single `$` character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, or center justified within its column. # --instructions-- Use the following text to test your programs: -
      -Given$a$text$file$of$many$lines
      -where$fields$within$a$line$
      -are$delineated$by$a$single$'dollar'$character
      -write$a$program
      -that$aligns$each$column$of$fields
      -by$ensuring$that$words$in$each$
      -column$are$separated$by$at$least$one$space.
      -Further,$allow$for$each$word$in$a$column$to$be$either$left$
      -justified,$right$justified
      -or$center$justified$within$its$column.
      -
      +```js +const testText = [ + 'Given$a$text$file$of$many$lines', + 'where$fields$within$a$line$', + 'are$delineated$by$a$single$"dollar"$character', + 'write$a$program', + 'that$aligns$each$column$of$fields', + 'by$ensuring$that$words$in$each$', + 'column$are$separated$by$at$least$one$space.', + 'Further,$allow$for$each$word$in$a$column$to$be$either$left$', + 'justified,$right$justified', + 'or$center$justified$within$its$column.' +]; +``` **Note that:** -
        -
      • The example input texts lines may, or may not, have trailing dollar characters.
      • -
      • All columns should share the same alignment.
      • -
      • Consecutive space characters produced adjacent to the end of lines are insignificant for the purposes of the task.
      • -
      • Output text will be viewed in a mono-spaced font on a plain text editor or basic terminal.
      • -
      • The minimum space between columns should be computed from the text and not hard-coded.
      • -
      • It is not a requirement to add separating characters between or around columns.
      • -
      +- The example input texts lines may, or may not, have trailing dollar characters. +- All columns should share the same alignment. +- Consecutive space characters produced adjacent to the end of lines are insignificant for the purposes of the task. +- Output text will be viewed in a mono-spaced font on a plain text editor or basic terminal. Lines in it should be joined using new line character (`\n`). +- The minimum space between columns should be computed from the text and not hard-coded. +- It is not a requirement to add separating characters between or around columns. + +For example, one of the lines from the `testText`, after jusitifing to the right, left and center respectivelly: + +```js +' column are separated by at least one space.\n' +'column are separated by at least one space.\n' +' column are separated by at least one space.\n' +``` # --hints-- @@ -46,22 +54,22 @@ or$center$justified$within$its$column. assert(typeof formatText === 'function'); ``` -`formatText` with the above input and "right" justification should produce the following: +`formatText(testText, 'right')` should produce text with columns justified to the right. ```js -assert.strictEqual(formatText(testInput, 'right'), rightAligned); +assert.strictEqual(formatText(_testText, 'right'), rightAligned); ``` -`formatText` with the above input and "left" justification should produce the following: +`formatText(testText, 'left')` should produce text with columns justified to the left. ```js -assert.strictEqual(formatText(testInput, 'left'), leftAligned); +assert.strictEqual(formatText(_testText, 'left'), leftAligned); ``` -`formatText` with the above input and "center" justification should produce the following: +`formatText(testText, 'center')` should produce text with columns justified to the center. ```js -assert.strictEqual(formatText(testInput, 'center'), centerAligned); +assert.strictEqual(formatText(_testText, 'center'), centerAligned); ``` # --seed-- @@ -69,10 +77,10 @@ assert.strictEqual(formatText(testInput, 'center'), centerAligned); ## --after-user-code-- ```js -const testInput = [ +const _testText = [ 'Given$a$text$file$of$many$lines', 'where$fields$within$a$line$', - 'are$delineated$by$a$single$\"dollar\"$character', + 'are$delineated$by$a$single$"dollar"$character', 'write$a$program', 'that$aligns$each$column$of$fields$', 'by$ensuring$that$words$in$each$', @@ -119,7 +127,11 @@ const centerAligned = ' Given a text file of many ## --seed-contents-- ```js -const testArr = [ +function formatText(input, justification) { + +} + +const testText = [ 'Given$a$text$file$of$many$lines', 'where$fields$within$a$line$', 'are$delineated$by$a$single$"dollar"$character', @@ -131,28 +143,11 @@ const testArr = [ 'justified,$right$justified', 'or$center$justified$within$its$column.' ]; - -function formatText(input, justification) { - -} ``` # --solutions-- ```js -const testArr = [ - 'Given$a$text$file$of$many$lines', - 'where$fields$within$a$line$', - 'are$delineated$by$a$single$"dollar"$character', - 'write$a$program', - 'that$aligns$each$column$of$fields$', - 'by$ensuring$that$words$in$each$', - 'column$are$separated$by$at$least$one$space.', - 'Further,$allow$for$each$word$in$a$column$to$be$either$left$', - 'justified,$right$justified', - 'or$center$justified$within$its$column.' -]; - String.prototype.repeat = function (n) { return new Array(1 + parseInt(n)).join(this); }; function formatText(input, justification) { diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/amicable-pairs.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/amicable-pairs.md index 3fe512a48f..207ab439f3 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/amicable-pairs.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/amicable-pairs.md @@ -8,7 +8,7 @@ dashedName: amicable-pairs # --description-- -Two integers $N$ and $M$ are said to be [amicable pairs]( "wp: Amicable numbers") if $N \\neq M$ and the sum of the [proper divisors]( "Proper divisors") of $N$ ($\\mathrm{sum}(\\mathrm{propDivs}(N))$) $= M$ as well as $\\mathrm{sum}(\\mathrm{propDivs}(M)) = N$. +Two integers $N$ and $M$ are said to be [amicable pairs](https://en.wikipedia.org/wiki/Amicable numbers "wp: Amicable numbers") if $N \\neq M$ and the sum of the [proper divisors](https://rosettacode.org/wiki/Proper divisors "Proper divisors") of $N$ ($\\mathrm{sum}(\\mathrm{propDivs}(N))$) $= M$ as well as $\\mathrm{sum}(\\mathrm{propDivs}(M)) = N$. **Example:** diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/averages-mode.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/averages-mode.md index e9f98a9187..166050bd51 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/averages-mode.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/averages-mode.md @@ -8,7 +8,7 @@ dashedName: averagesmode # --description-- -Write a program to find the [mode]( "wp: Mode (statistics)") value of a collection. +Write a program to find the [mode](https://en.wikipedia.org/wiki/Mode (statistics) "wp: Mode (statistics)") value of a collection. The case where the collection is empty may be ignored. Care must be taken to handle the case where the mode is non-unique. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/averages-pythagorean-means.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/averages-pythagorean-means.md index daac04f1a5..45425141e3 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/averages-pythagorean-means.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/averages-pythagorean-means.md @@ -8,7 +8,7 @@ dashedName: averagespythagorean-means # --description-- -Compute all three of the [Pythagorean means]( "wp: Pythagorean means") of the set of integers $1$ through $10$ (inclusive). +Compute all three of the [Pythagorean means](https://en.wikipedia.org/wiki/Pythagorean means "wp: Pythagorean means") of the set of integers $1$ through $10$ (inclusive). Show that $A(x_1,\\ldots,x_n) \\geq G(x_1,\\ldots,x_n) \\geq H(x_1,\\ldots,x_n)$ for this set of positive integers. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/averages-root-mean-square.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/averages-root-mean-square.md index 080f3e6eea..d7bb3ef969 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/averages-root-mean-square.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/averages-root-mean-square.md @@ -8,7 +8,7 @@ dashedName: averagesroot-mean-square # --description-- -Compute the [Root mean square]( "wp: Root mean square") of the numbers 1 through 10 inclusive. +Compute the [Root mean square](https://en.wikipedia.org/wiki/Root mean square "wp: Root mean square") of the numbers 1 through 10 inclusive. The *root mean square* is also known by its initials RMS (or rms), and as the **quadratic mean**. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/balanced-brackets.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/balanced-brackets.md index e32338e301..5045fbd2ca 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/balanced-brackets.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/balanced-brackets.md @@ -13,11 +13,11 @@ Determine whether a generated string of brackets is balanced; that is, whether i **Examples:** | Input | Output | | ------------------------- | ------ | -| \[] | true | -| ]\[ | false | -| [][] | true | -| ]\[] | false | -| \[]]\[\[] | false | +| \[] | true | +| ]\[ | false | +| [][] | true | +| ]\[] | false | +| \[]]\[\[] | false | | \[\[\[\[]]]] | true | # --hints-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration.md index 740d69b7b0..e050e0d7d2 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration.md @@ -19,10 +19,10 @@ Demonstrate that it passes the following three test-cases:
      Test Cases
      -| Input number | Output number | -| ------------ | ------------------------------------- | -| 7259 | 2 hr, 59 sec | -| 86400 | 1 d | +| Input number | Output number | +| ------------ | ------------------------- | +| 7259 | 2 hr, 59 sec | +| 86400 | 1 d | | 6000000 | 9 wk, 6 d, 10 hr, 40 min |
      Details
      @@ -32,11 +32,11 @@ Demonstrate that it passes the following three test-cases: | Unit | Suffix used in Output | Conversion | | ------ | --------------------- | --------------------- | -| week | wk | 1 week = 7 days | -| day | d | 1 day = 24 hours | -| hour | hr | 1 hour = 60 minutes | -| minute | min | 1 minute = 60 seconds | -| second | sec | --- | +| week |!!crwdBlockTags_18_sgaTkcolBdwrc!! | 1 week = 7 days | +| day |!!crwdBlockTags_19_sgaTkcolBdwrc!! | 1 day = 24 hours | +| hour |!!crwdBlockTags_20_sgaTkcolBdwrc!! | 1 hour = 60 minutes | +| minute |!!crwdBlockTags_21_sgaTkcolBdwrc!! | 1 minute = 60 seconds | +| second |!!crwdBlockTags_22_sgaTkcolBdwrc!! | --- |
    • diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/cramers-rule.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/cramers-rule.md index 9b49a3fac2..7580e28c50 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/cramers-rule.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/cramers-rule.md @@ -8,7 +8,7 @@ dashedName: cramers-rule # --description-- -In [linear algebra]( "wp: linear algebra"), [Cramer's rule]( "wp: Cramer's rule") is an explicit formula for the solution of a [system of linear equations]( "wp: system of linear equations") with as many equations as unknowns, valid whenever the system has a unique solution. It expresses the solution in terms of the determinants of the (square) coefficient matrix and of matrices obtained from it by replacing one column by the vector of right hand sides of the equations. +In [linear algebra](https://en.wikipedia.org/wiki/linear algebra "wp: linear algebra"), [Cramer's rule](https://en.wikipedia.org/wiki/Cramer's rule "wp: Cramer's rule") is an explicit formula for the solution of a [system of linear equations](https://en.wikipedia.org/wiki/system of linear equations "wp: system of linear equations") with as many equations as unknowns, valid whenever the system has a unique solution. It expresses the solution in terms of the determinants of the (square) coefficient matrix and of matrices obtained from it by replacing one column by the vector of right hand sides of the equations. Given diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/cumulative-standard-deviation.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/cumulative-standard-deviation.md index 4ca5496cb7..28aa14710d 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/cumulative-standard-deviation.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/cumulative-standard-deviation.md @@ -8,7 +8,7 @@ dashedName: cumulative-standard-deviation # --description-- -Write a function that takes an array of numbers as parameter and returns the [standard deviation]() of the series. +Write a function that takes an array of numbers as parameter and returns the [standard deviation](https://en.wikipedia.org/wiki/Standard Deviation) of the series. # --hints-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/deal-cards-for-freecell.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/deal-cards-for-freecell.md index e74d1883eb..f998915595 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/deal-cards-for-freecell.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/deal-cards-for-freecell.md @@ -12,7 +12,7 @@ dashedName: deal-cards-for-freecell As the game became popular, Jim Horne disclosed the algorithm, and other implementations of FreeCell began to reproduce the Microsoft deals. These deals are numbered from 1 to 32000. Newer versions from Microsoft have 1 million deals, numbered from 1 to 1000000; some implementations allow numbers outside that range. -The algorithm uses this [linear congruential generator]( "linear congruential generator") from Microsoft C: +The algorithm uses this [linear congruential generator](https://rosettacode.org/wiki/linear congruential generator "linear congruential generator") from Microsoft C:
      • $state_{n + 1} \equiv 214013 \times state_n + 2531011 \pmod{2^{31}}$
      • diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/discordian-date.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/discordian-date.md index 217c79db1c..811a3b867e 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/discordian-date.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/discordian-date.md @@ -8,7 +8,7 @@ dashedName: discordian-date # --description-- -Convert a given date from the [Gregorian calendar]( "wp: Gregorian calendar") to the [Discordian calendar]( "wp: Discordian calendar"). +Convert a given date from the [Gregorian calendar](https://en.wikipedia.org/wiki/Gregorian calendar "wp: Gregorian calendar") to the [Discordian calendar](https://en.wikipedia.org/wiki/Discordian calendar "wp: Discordian calendar"). # --hints-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/dot-product.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/dot-product.md index 5584a7e26a..c1c61d1b12 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/dot-product.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/dot-product.md @@ -8,7 +8,7 @@ dashedName: dot-product # --description-- -Create a function, to compute the **[dot product]()**, also known as the **scalar product** of two vectors. +Create a function, to compute the **[dot product](https://en.wikipedia.org/wiki/Dot product)**, also known as the **scalar product** of two vectors. # --hints-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/euler-method.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/euler-method.md index 86f2d9c75e..4a17c09a25 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/euler-method.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/euler-method.md @@ -8,7 +8,7 @@ dashedName: euler-method # --description-- -Euler's method numerically approximates solutions of first-order ordinary differential equations (ODEs) with a given initial value. It is an explicit method for solving initial value problems (IVPs), as described in [the wikipedia page]( "wp: Euler method"). +Euler's method numerically approximates solutions of first-order ordinary differential equations (ODEs) with a given initial value. It is an explicit method for solving initial value problems (IVPs), as described in [the wikipedia page](https://en.wikipedia.org/wiki/Euler method "wp: Euler method"). The ODE has to be provided in the following form: @@ -89,7 +89,7 @@ and compare with the analytical solution.
      • room temperature $T_R$ shall be 20 °C
      • cooling constant $k$ shall be 0.07
      • time interval to calculate shall be from 0 s to 100 s
      • -
      +
    First parameter to the function is initial time, second parameter is initial temperature, third parameter is elapsed time and fourth parameter is step size. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md index 5dffbaf6cb..cdc024dab4 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md @@ -8,7 +8,7 @@ dashedName: execute-a-markov-algorithm # --description-- -Create an interpreter for a [Markov Algorithm]( "wp: Markov algorithm"). +Create an interpreter for a [Markov Algorithm](https://en.wikipedia.org/wiki/Markov algorithm "wp: Markov algorithm"). Rules have the syntax: diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/execute-brain.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/execute-brain.md index a1dc29757d..7504589e58 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/execute-brain.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/execute-brain.md @@ -16,16 +16,16 @@ Below are links to each of the versions of RCBF. An implementation need only properly implement the following instructions: -| Command | Description | -| ----------------- | ---------------------------------------------------------------------------------- | -| > | Move the pointer to the right | -| < | Move the pointer to the left | -| + | Increment the memory cell under the pointer | -| - | Decrement the memory cell under the pointer | -| . | Output the character signified by the cell at the pointer | -| , | Input a character and store it in the cell at the pointer | -| \[ | Jump past the matching ] if the cell under the pointer is 0 | -| ] | Jump back to the matching \[ if the cell under the pointer is nonzero | +| Command | Description | +| ------------------------- | ------------------------------------------------------------------------------------------ | +| > | Move the pointer to the right | +| < | Move the pointer to the left | +| + | Increment the memory cell under the pointer | +| - | Decrement the memory cell under the pointer | +| . | Output the character signified by the cell at the pointer | +| , | Input a character and store it in the cell at the pointer | +| \[ | Jump past the matching ] if the cell under the pointer is 0 | +| ] | Jump back to the matching \[ if the cell under the pointer is nonzero | Any cell size is allowed, EOF (*E*nd-*O*-*F*ile) support is optional, as is whether you have bounded or unbounded memory. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md index 273062a0cf..0e5a414555 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md @@ -12,7 +12,7 @@ A Mersenne number is a number in the form of 2P-1. If `P` is prime, the Mersenne number may be a Mersenne prime. (If `P` is not prime, the Mersenne number is also not prime.) -In the search for Mersenne prime numbers it is advantageous to eliminate exponents by finding a small factor before starting a, potentially lengthy, [Lucas-Lehmer test]( "Lucas-Lehmer test"). +In the search for Mersenne prime numbers it is advantageous to eliminate exponents by finding a small factor before starting a, potentially lengthy, [Lucas-Lehmer test](https://rosettacode.org/wiki/Lucas-Lehmer test "Lucas-Lehmer test"). There are very efficient algorithms for determining if a number divides 2P-1 (or equivalently, if 2P mod (the number) = 1). @@ -48,7 +48,7 @@ Further properties of Mersenne numbers allow us to refine the process even more. Any factor `q` of 2P-1 must be of the form `2kP+1`, `k` being a positive integer or zero. Furthermore, `q` must be `1` or `7 mod 8`. -Finally any potential factor `q` must be [prime]( "Primality by Trial Division"). +Finally any potential factor `q` must be [prime](https://rosettacode.org/wiki/Primality by Trial Division "Primality by Trial Division"). As in other trial division algorithms, the algorithm stops when `2kP+1 > sqrt(N)`.These primarily tests only work on Mersenne numbers where `P` is prime. For example, M4=15 yields no factors using these techniques, but factors into 3 and 5, neither of which fit `2kP+1`. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/farey-sequence.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/farey-sequence.md index 8e508d134c..59b4edc9a5 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/farey-sequence.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/farey-sequence.md @@ -8,7 +8,7 @@ dashedName: farey-sequence # --description-- -The [Farey sequence]( "wp: Farey sequence") Fn of order `n` is the sequence of completely reduced fractions between `0` and `1` which, when in lowest terms, have denominators less than or equal to `n`, arranged in order of increasing size. +The [Farey sequence](https://en.wikipedia.org/wiki/Farey sequence "wp: Farey sequence") Fn of order `n` is the sequence of completely reduced fractions between `0` and `1` which, when in lowest terms, have denominators less than or equal to `n`, arranged in order of increasing size. The *Farey sequence* is sometimes incorrectly called a *Farey series*. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences.md index 6791320f73..456b87de79 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences.md @@ -8,7 +8,7 @@ dashedName: fibonacci-n-step-number-sequences # --description-- -These number series are an expansion of the ordinary [Fibonacci sequence]( "Fibonacci sequence") where: +These number series are an expansion of the ordinary [Fibonacci sequence](https://rosettacode.org/wiki/Fibonacci sequence "Fibonacci sequence") where:
    1. For $n = 2$ we have the Fibonacci sequence; with initial values $[1, 1]$ and $F_k^2 = F_{k-1}^2 + F_{k-2}^2$
    2. @@ -17,7 +17,7 @@ These number series are an expansion of the ordinary [Fibonacci sequence](For general $n>2$ we have the Fibonacci $n$-step sequence - $F_k^n$; with initial values of the first $n$ values of the $(n-1)$'th Fibonacci $n$-step sequence $F_k^{n-1}$; and $k$'th value of this $n$'th sequence being $F_k^n = \sum_{i=1}^{(n)} {F_{k-i}^{(n)}}$
    -For small values of $n$, [Greek numeric prefixes]( "wp: Number prefix#Greek_series") are sometimes used to individually name each series. +For small values of $n$, [Greek numeric prefixes](https://en.wikipedia.org/wiki/Number prefix#Greek_series "wp: Number prefix#Greek_series") are sometimes used to individually name each series. Fibonacci $n$-step sequences: @@ -33,7 +33,7 @@ Fibonacci $n$-step sequences: | 9 | nonanacci | 1 1 2 4 8 16 32 64 128 256 511 1021 2040 4076 8144 ... | | 10 | decanacci | 1 1 2 4 8 16 32 64 128 256 512 1023 2045 4088 8172 ... | -Allied sequences can be generated where the initial values are changed: The [Lucas series]( "wp: Lucas number") sums the two preceding values like the fibonacci series for $n=2$ but uses $\[2, 1]$ as its initial values. +Allied sequences can be generated where the initial values are changed: The [Lucas series](https://en.wikipedia.org/wiki/Lucas number "wp: Lucas number") sums the two preceding values like the fibonacci series for $n=2$ but uses $\[2, 1]$ as its initial values. # --instructions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/fractran.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/fractran.md index e8e4d35925..0bcda09bde 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/fractran.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/fractran.md @@ -8,7 +8,7 @@ dashedName: fractran # --description-- -[FRACTRAN](https://en.wikipedia.org/wiki/FRACTRAN "wp: FRACTRAN") is a Turing-complete esoteric programming language invented by the mathematician [John Horton Conway]( "wp: John Horton Conway"). +[FRACTRAN](https://en.wikipedia.org/wiki/FRACTRAN "wp: FRACTRAN") is a Turing-complete esoteric programming language invented by the mathematician [John Horton Conway](https://en.wikipedia.org/wiki/John Horton Conway "wp: John Horton Conway"). A FRACTRAN program is an ordered list of positive fractions $P = (f_1, f_2, \\ldots, f_m)$, together with an initial positive integer input $n$. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/gamma-function.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/gamma-function.md index d764232158..f105a0a1bd 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/gamma-function.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/gamma-function.md @@ -8,7 +8,7 @@ dashedName: gamma-function # --description-- -Implement one algorithm (or more) to compute the [Gamma]() ($\\Gamma$) function (in the real field only). +Implement one algorithm (or more) to compute the [Gamma](https://en.wikipedia.org/wiki/Gamma function) ($\\Gamma$) function (in the real field only). The Gamma function can be defined as: diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/gray-code.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/gray-code.md index 4e5c523737..f46350f0be 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/gray-code.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/gray-code.md @@ -8,11 +8,11 @@ dashedName: gray-code # --description-- -[Gray code]() is a form of binary encoding where transitions between consecutive numbers differ by only one bit. +[Gray code](https://en.wikipedia.org/wiki/Gray code) is a form of binary encoding where transitions between consecutive numbers differ by only one bit. This is a useful encoding for reducing hardware data hazards with values that change rapidly and/or connect to slower hardware as inputs. -It is also useful for generating inputs for [Karnaugh maps]() in order from left to right or top to bottom. +It is also useful for generating inputs for [Karnaugh maps](https://en.wikipedia.org/wiki/Karnaugh map) in order from left to right or top to bottom. # --instructions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/hash-join.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/hash-join.md index d2d5cabf4f..7dc6b729cb 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/hash-join.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/hash-join.md @@ -8,7 +8,7 @@ dashedName: hash-join # --description-- -An [inner join](https://en.wikipedia.org/wiki/Join_(SQL)#Inner_join "wp: Join\_(SQL)#Inner_join") is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the [nested loop join]( "wp: Nested loop join") algorithm, but a more scalable alternative is the [hash join]( "wp: hash join") algorithm. +An [inner join](https://en.wikipedia.org/wiki/Join_(SQL)#Inner_join "wp: Join\_(SQL)#Inner_join") is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the [nested loop join](https://en.wikipedia.org/wiki/Nested loop join "wp: Nested loop join") algorithm, but a more scalable alternative is the [hash join](https://en.wikipedia.org/wiki/hash join "wp: hash join") algorithm. The "hash join" algorithm consists of two steps: diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/heronian-triangles.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/heronian-triangles.md index 7cfd2e6caa..2162dc57eb 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/heronian-triangles.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/heronian-triangles.md @@ -8,7 +8,7 @@ dashedName: heronian-triangles # --description-- -[Hero's formula]( "wp: Heron's formula") for the area of a triangle given the length of its three sides `a`, `b`, and `c` is given by: +[Hero's formula](https://en.wikipedia.org/wiki/Heron's formula "wp: Heron's formula") for the area of a triangle given the length of its three sides `a`, `b`, and `c` is given by: $A = \\sqrt{s(s-a)(s-b)(s-c)},$ diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/hofstadter-q-sequence.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/hofstadter-q-sequence.md index 06d4fb69b2..c8ab7d438c 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/hofstadter-q-sequence.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/hofstadter-q-sequence.md @@ -12,7 +12,7 @@ The [Hofstadter Q sequence](https://en.wikipedia.org/wiki/Hofstadter_sequence#Ho $Q(1)=Q(2)=1, \\\\ Q(n)=Q\\big(n-Q(n-1)\\big)+Q\\big(n-Q(n-2)), \\quad n>2.$ -It is defined like the [Fibonacci sequence]( "Fibonacci sequence"), but whereas the next term in the Fibonacci sequence is the sum of the previous two terms, in the Q sequence the previous two terms tell you how far to go back in the Q sequence to find the two numbers to sum to make the next term of the sequence. +It is defined like the [Fibonacci sequence](https://rosettacode.org/wiki/Fibonacci sequence "Fibonacci sequence"), but whereas the next term in the Fibonacci sequence is the sum of the previous two terms, in the Q sequence the previous two terms tell you how far to go back in the Q sequence to find the two numbers to sum to make the next term of the sequence. # --instructions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/i-before-e-except-after-c.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/i-before-e-except-after-c.md index 9fd1d6f6f6..afac6dc512 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/i-before-e-except-after-c.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/i-before-e-except-after-c.md @@ -8,7 +8,7 @@ dashedName: i-before-e-except-after-c # --description-- -The phrase ["I before E, except after C"]() is a widely known mnemonic which is supposed to help when spelling English words. +The phrase ["I before E, except after C"](https://en.wikipedia.org/wiki/I before E except after C) is a widely known mnemonic which is supposed to help when spelling English words. Using the words provided, check if the two sub-clauses of the phrase are plausible individually: diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/josephus-problem.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/josephus-problem.md index 245b3ed352..6e8314e204 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/josephus-problem.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/josephus-problem.md @@ -8,7 +8,7 @@ dashedName: josephus-problem # --description-- -[Josephus problem]() is a math puzzle with a grim description: $n$ prisoners are standing on a circle, sequentially numbered from $0$ to $n-1$. +[Josephus problem](https://en.wikipedia.org/wiki/Josephus problem) is a math puzzle with a grim description: $n$ prisoners are standing on a circle, sequentially numbered from $0$ to $n-1$. An executioner walks along the circle, starting from prisoner $0$, removing every $k$-th prisoner and killing him. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/kaprekar-numbers.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/kaprekar-numbers.md index 59e368bc52..7b2530f4c6 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/kaprekar-numbers.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/kaprekar-numbers.md @@ -8,7 +8,7 @@ dashedName: kaprekar-numbers # --description-- -A positive integer is a [Kaprekar number]() if: +A positive integer is a [Kaprekar number](https://en.wikipedia.org/wiki/Kaprekar number) if:
    • It is 1, or,
    • diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/least-common-multiple.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/least-common-multiple.md index 403e448d2f..aa27446cbe 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/least-common-multiple.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/least-common-multiple.md @@ -8,7 +8,7 @@ dashedName: least-common-multiple # --description-- -The least common multiple of 12 and 18 is 36, because 12 is a factor (12 × 3 = 36), and 18 is a factor (18 × 2 = 36), and there is no positive integer less than 36 that has both factors. As a special case, if either *m* or *n* is zero, then the least common multiple is zero. One way to calculate the least common multiple is to iterate all the multiples of *m*, until you find one that is also a multiple of *n*. If you already have *gcd* for [greatest common divisor](), then this formula calculates *lcm*. ( \\operatorname{lcm}(m, n) = \\frac{|m \\times n|}{\\operatorname{gcd}(m, n)} ) +The least common multiple of 12 and 18 is 36, because 12 is a factor (12 × 3 = 36), and 18 is a factor (18 × 2 = 36), and there is no positive integer less than 36 that has both factors. As a special case, if either *m* or *n* is zero, then the least common multiple is zero. One way to calculate the least common multiple is to iterate all the multiples of *m*, until you find one that is also a multiple of *n*. If you already have *gcd* for [greatest common divisor](https://rosettacode.org/wiki/greatest common divisor), then this formula calculates *lcm*. ( \\operatorname{lcm}(m, n) = \\frac{|m \\times n|}{\\operatorname{gcd}(m, n)} ) # --instructions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/levenshtein-distance.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/levenshtein-distance.md index 104543d9d0..2737ad5436 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/levenshtein-distance.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/levenshtein-distance.md @@ -8,7 +8,7 @@ dashedName: levenshtein-distance # --description-- -In information theory and computer science, the **Levenshtein distance** is a [metric]() for measuring the amount of difference between two sequences (i.e. an [edit distance]()). The Levenshtein distance between two strings is defined as the minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character. +In information theory and computer science, the **Levenshtein distance** is a [metric](https://en.wikipedia.org/wiki/string metric) for measuring the amount of difference between two sequences (i.e. an [edit distance](https://en.wikipedia.org/wiki/edit distance)). The Levenshtein distance between two strings is defined as the minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character. Example: diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/linear-congruential-generator.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/linear-congruential-generator.md index 96bf1cf079..0448399ccb 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/linear-congruential-generator.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/linear-congruential-generator.md @@ -8,7 +8,7 @@ dashedName: linear-congruential-generator # --description-- -The [linear congruential generator]() is a very simple example of a [random number generator](). All linear congruential generators use this formula: +The [linear congruential generator](https://en.wikipedia.org/wiki/linear congruential generator) is a very simple example of a [random number generator](http://rosettacode.org/wiki/random number generator). All linear congruential generators use this formula: $$r_{n + 1} = (a \times r_n + c) \bmod m$$ @@ -22,7 +22,7 @@ Where: If one chooses the values of $a$, $c$ and $m$ with care, then the generator produces a uniform distribution of integers from $0$ to $m - 1$. -LCG numbers have poor quality. $r_n$ and $r\_{n + 1}$ are not independent, as true random numbers would be. Anyone who knows $r_n$ can predict $r\_{n + 1}$, therefore LCG is not cryptographically secure. The LCG is still good enough for simple tasks like [Miller-Rabin primality test](), or [FreeCell deals](). Among the benefits of the LCG, one can easily reproduce a sequence of numbers, from the same $r_0$. One can also reproduce such sequence with a different programming language, because the formula is so simple. +LCG numbers have poor quality. $r_n$ and $r\_{n + 1}$ are not independent, as true random numbers would be. Anyone who knows $r_n$ can predict $r\_{n + 1}$, therefore LCG is not cryptographically secure. The LCG is still good enough for simple tasks like [Miller-Rabin primality test](http://rosettacode.org/wiki/Miller-Rabin primality test), or [FreeCell deals](http://rosettacode.org/wiki/deal cards for FreeCell). Among the benefits of the LCG, one can easily reproduce a sequence of numbers, from the same $r_0$. One can also reproduce such sequence with a different programming language, because the formula is so simple. # --instructions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/long-multiplication.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/long-multiplication.md index 431f88eeb8..fb4e2456cf 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/long-multiplication.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/long-multiplication.md @@ -8,7 +8,7 @@ dashedName: long-multiplication # --description-- -Explicitly implement [long multiplication](). +Explicitly implement [long multiplication](https://en.wikipedia.org/wiki/long multiplication). This is one possible approach to arbitrary-precision integer algebra. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/longest-increasing-subsequence.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/longest-increasing-subsequence.md index 4de5521d55..0ba5661f6c 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/longest-increasing-subsequence.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/longest-increasing-subsequence.md @@ -18,7 +18,7 @@ Longest increasing sequence is: $\\{3, 10, 20\\}$ -For more information on this problem please see [Wikipedia](). +For more information on this problem please see [Wikipedia](https://en.wikipedia.org/wiki/Longest increasing subsequence). # --instructions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/look-and-say-sequence.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/look-and-say-sequence.md index 073e41920d..ed09269a09 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/look-and-say-sequence.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/look-and-say-sequence.md @@ -8,7 +8,7 @@ dashedName: look-and-say-sequence # --description-- -The [Look and say sequence]() is a recursively defined sequence of numbers. +The [Look and say sequence](https://en.wikipedia.org/wiki/Look and say sequence) is a recursively defined sequence of numbers. Sequence Definition diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/lu-decomposition.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/lu-decomposition.md index f7a900174e..1b2442f305 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/lu-decomposition.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/lu-decomposition.md @@ -8,13 +8,13 @@ dashedName: lu-decomposition # --description-- -Every square matrix $A$ can be decomposed into a product of a lower triangular matrix $L$ and a upper triangular matrix $U$, as described in [LU decomposition](). +Every square matrix $A$ can be decomposed into a product of a lower triangular matrix $L$ and a upper triangular matrix $U$, as described in [LU decomposition](https://en.wikipedia.org/wiki/LU decomposition). $A = LU$ It is a modified form of Gaussian elimination. -While the [Cholesky decomposition]() only works for symmetric, positive definite matrices, the more general LU decomposition works for any square matrix. +While the [Cholesky decomposition](http://rosettacode.org/wiki/Cholesky decomposition) only works for symmetric, positive definite matrices, the more general LU decomposition works for any square matrix. There are several algorithms for calculating $L$ and $U$. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/luhn-test-of-credit-card-numbers.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/luhn-test-of-credit-card-numbers.md index 0a44e1da79..4fcc90502a 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/luhn-test-of-credit-card-numbers.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/luhn-test-of-credit-card-numbers.md @@ -8,7 +8,7 @@ dashedName: luhn-test-of-credit-card-numbers # --description-- -The [Luhn test]() is used by some credit card companies to distinguish valid credit card numbers from what could be a random selection of digits. +The [Luhn test](https://en.wikipedia.org/wiki/Luhn algorithm) is used by some credit card companies to distinguish valid credit card numbers from what could be a random selection of digits. Those companies using credit card numbers that can be validated by the Luhn test have numbers that pass the following test: diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/self-describing-numbers.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/self-describing-numbers.md index 5ff2f5c992..df2a88508f 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/self-describing-numbers.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/self-describing-numbers.md @@ -89,7 +89,7 @@ function isSelfDescribing(n) { if (digits.length != count.length) { return false; } - + for (let i=0; i< digits.length; i++){ if (digits[i] !== count[i]) { return false; diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/self-referential-sequence.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/self-referential-sequence.md index 0cc45a42ff..11beda8ba0 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/self-referential-sequence.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/self-referential-sequence.md @@ -8,7 +8,7 @@ dashedName: self-referential-sequence # --description-- -There are several ways to generate a self-referential sequence. One very common one (the [Look-and-say sequence]()) is to start with a positive integer, then generate the next term by concatenating enumerated groups of adjacent alike digits: +There are several ways to generate a self-referential sequence. One very common one (the [Look-and-say sequence](https://rosettacode.org/wiki/Look-and-say sequence)) is to start with a positive integer, then generate the next term by concatenating enumerated groups of adjacent alike digits:
      0, 10, 1110, 3110, 132110, 1113122110, 311311222110 ...
      diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sha-256.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sha-256.md index ba3af1f527..9ce0ca4260 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sha-256.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sha-256.md @@ -8,8 +8,7 @@ dashedName: sha-256 # --description-- -The `SHA-2` family is a stronger alternative to `SHA-1`. The main difference between them is the length of the hash. -Meaning `SHA-1` provides a shorter code with fewer possibilities for unique combinations. `SHA-2` or `SHA-256` creates a longer and thus more complex hash with more possibilities. +The `SHA-2` family is a stronger alternative to `SHA-1`. The main difference between them is the length of the hash. Meaning `SHA-1` provides a shorter code with fewer possibilities for unique combinations. `SHA-2` or `SHA-256` creates a longer and thus more complex hash with more possibilities. # --instructions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md index 86aeeda4c8..f4c1b63f68 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md @@ -8,7 +8,7 @@ dashedName: sorting-algorithmscocktail-sort # --description-- -The cocktail shaker sort is an improvement on the [Bubble Sort](). The improvement is basically that values "bubble" both directions through the array, because on each iteration the cocktail shaker sort bubble sorts once forwards and once backwards. Pseudocode for the algorithm (from [wikipedia]()): +The cocktail shaker sort is an improvement on the [Bubble Sort](https://rosettacode.org/wiki/Bubble Sort). The improvement is basically that values "bubble" both directions through the array, because on each iteration the cocktail shaker sort bubble sorts once forwards and once backwards. Pseudocode for the algorithm (from [wikipedia](https://en.wikipedia.org/wiki/Cocktail sort)):
      function cocktailSort( A : list of sortable items )
         do
      diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-comb-sort.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-comb-sort.md
      index 2b31fb98db..472ce20af5 100644
      --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-comb-sort.md
      +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-comb-sort.md
      @@ -10,9 +10,9 @@ dashedName: sorting-algorithmscomb-sort
       
       Implement a *comb sort*.
       
      -The **Comb Sort** is a variant of the [Bubble Sort]().
      +The **Comb Sort** is a variant of the [Bubble Sort](https://rosettacode.org/wiki/Bubble Sort).
       
      -Like the [Shell sort](), the Comb Sort increases the gap used in comparisons and exchanges.
      +Like the [Shell sort](https://rosettacode.org/wiki/Shell sort), the Comb Sort increases the gap used in comparisons and exchanges.
       
       Dividing the gap by $(1-e^{-\\varphi})^{-1} \\approx 1.247330950103979$ works best, but 1.3 may be more practical.
       
      diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md
      index 4aebdd0fe8..e3162404d9 100644
      --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md
      +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md
      @@ -8,7 +8,7 @@ dashedName: sorting-algorithmsgnome-sort
       
       # --description--
       
      -Gnome sort is a sorting algorithm which is similar to [Insertion sort](), except that moving an element to its proper place is accomplished by a series of swaps, as in [Bubble Sort]().
      +Gnome sort is a sorting algorithm which is similar to [Insertion sort](https://rosettacode.org/wiki/Insertion sort), except that moving an element to its proper place is accomplished by a series of swaps, as in [Bubble Sort](https://rosettacode.org/wiki/Bubble Sort).
       
       The pseudocode for the algorithm is:
       
      diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md
      index 1a4a28928c..f107df7b79 100644
      --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md
      +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md
      @@ -8,7 +8,7 @@ dashedName: sorting-algorithmspancake-sort
       
       # --description--
       
      -Write a function to sort an array of integers (of any convenient size) into ascending order using [Pancake sorting](). The function should return the sorted array.
      +Write a function to sort an array of integers (of any convenient size) into ascending order using [Pancake sorting](https://en.wikipedia.org/wiki/Pancake sorting). The function should return the sorted array.
       
       In short, instead of individual elements being sorted, the only operation allowed is to "flip" one end of the list, like so:
       
      diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md
      index 3d69051f4d..0940344732 100644
      --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md
      +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md
      @@ -8,7 +8,7 @@ dashedName: sorting-algorithmsshell-sort
       
       # --description--
       
      -Write a function to sort an array of elements using the [Shell sort]() algorithm, a diminishing increment sort. The function should return the sorted array.
      +Write a function to sort an array of elements using the [Shell sort](https://en.wikipedia.org/wiki/Shell sort) algorithm, a diminishing increment sort. The function should return the sorted array.
       
       The Shell sort (also known as Shellsort or Shell's method) is named after its inventor, Donald Shell, who published the algorithm in 1959.
       
      diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md
      index 04dee734ea..ec108886c1 100644
      --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md
      +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md
      @@ -8,7 +8,7 @@ dashedName: sorting-algorithmsstooge-sort
       
       # --description--
       
      -Write a function to perform [Stooge Sort]() on an array of integers. The function should return a sorted array.
      +Write a function to perform [Stooge Sort](https://en.wikipedia.org/wiki/Stooge sort) on an array of integers. The function should return a sorted array.
       
       The Stooge Sort algorithm is as follows:
       
      diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md
      index a603bbab95..d8408782db 100644
      --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md
      +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md
      @@ -8,7 +8,7 @@ dashedName: sorting-algorithmsstrand-sort
       
       # --description--
       
      -Write a function to sort an array using the [Strand sort](). The function should return the sorted array.
      +Write a function to sort an array using the [Strand sort](https://en.wikipedia.org/wiki/Strand sort). The function should return the sorted array.
       
       This is a way of sorting numbers by extracting shorter sequences of already sorted numbers from an unsorted list.
       
      diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md
      index 219db4002c..5558082298 100644
      --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md
      +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md
      @@ -8,7 +8,7 @@ dashedName: stern-brocot-sequence
       
       # --description--
       
      -For this task, the Stern-Brocot sequence is to be generated by an algorithm similar to that employed in generating the [Fibonacci sequence]().
      +For this task, the Stern-Brocot sequence is to be generated by an algorithm similar to that employed in generating the [Fibonacci sequence](https://rosettacode.org/wiki/Fibonacci sequence).
       
       
      1. The first and second members of the sequence are both 1:
      2. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sum-of-a-series.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sum-of-a-series.md index 3e7e0b4e4f..6ffa6d152f 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sum-of-a-series.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sum-of-a-series.md @@ -8,7 +8,7 @@ dashedName: sum-of-a-series # --description-- -Compute the **n**th term of a [series](), i.e. the sum of the **n** first terms of the corresponding [sequence](https://en.wikipedia.org/wiki/sequence). Informally this value, or its limit when **n** tends to infinity, is also called the *sum of the series*, thus the title of this task. For this task, use: $S_n = \displaystyle\sum_{k=1}^n \frac{1}{k^2}$. +Compute the **n**th term of a [series](https://en.wikipedia.org/wiki/Series (mathematics)), i.e. the sum of the **n** first terms of the corresponding [sequence](https://en.wikipedia.org/wiki/sequence). Informally this value, or its limit when **n** tends to infinity, is also called the *sum of the series*, thus the title of this task. For this task, use: $S_n = \displaystyle\sum_{k=1}^n \frac{1}{k^2}$. # --instructions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sutherland-hodgman-polygon-clipping.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sutherland-hodgman-polygon-clipping.md index c3b671bf5a..50fe64ed63 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sutherland-hodgman-polygon-clipping.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/sutherland-hodgman-polygon-clipping.md @@ -8,7 +8,7 @@ dashedName: sutherland-hodgman-polygon-clipping # --description-- -The [Sutherland-Hodgman clipping algorithm]() finds the polygon that is the intersection between an arbitrary polygon (the "subject polygon") and a convex polygon (the "clip polygon"). It is used in computer graphics (especially 2D graphics) to reduce the complexity of a scene being displayed by eliminating parts of a polygon that do not need to be displayed. Take the closed polygon defined by the points: +The [Sutherland-Hodgman clipping algorithm](https://en.wikipedia.org/wiki/Sutherland-Hodgman clipping algorithm) finds the polygon that is the intersection between an arbitrary polygon (the "subject polygon") and a convex polygon (the "clip polygon"). It is used in computer graphics (especially 2D graphics) to reduce the complexity of a scene being displayed by eliminating parts of a polygon that do not need to be displayed. Take the closed polygon defined by the points:
        [(50, 150), (200, 50), (350, 150), (350, 300), (250, 300), (200, 250), (150, 350), (100, 250), (100, 200)]
        diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/symmetric-difference.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/symmetric-difference.md index 422cb77cc2..7009bce461 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/symmetric-difference.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/symmetric-difference.md @@ -8,7 +8,7 @@ dashedName: symmetric-difference # --description-- -Given two [set](https://rosettacode.org/wiki/set)s *A* and *B*, compute $(A \\setminus B) \\cup (B \\setminus A).$ That is, enumerate the items that are in *A* or *B* but not both. This set is called the [symmetric difference]() of *A* and *B*. In other words: $(A \\cup B) \\setminus (A \\cap B)$ (the set of items that are in at least one of *A* or *B* minus the set of items that are in both *A* and *B*). +Given two [set](https://rosettacode.org/wiki/set)s *A* and *B*, compute $(A \\setminus B) \\cup (B \\setminus A).$ That is, enumerate the items that are in *A* or *B* but not both. This set is called the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric difference) of *A* and *B*. In other words: $(A \\cup B) \\setminus (A \\cap B)$ (the set of items that are in at least one of *A* or *B* minus the set of items that are in both *A* and *B*). # --instructions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/taxicab-numbers.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/taxicab-numbers.md index 54a2aa0e7f..895b46ef05 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/taxicab-numbers.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/taxicab-numbers.md @@ -8,7 +8,7 @@ dashedName: taxicab-numbers # --description-- -A [taxicab number]( "wp: Hardy–Ramanujan number") (the definition that is being used here) is a positive integer that can be expressed as the sum of two positive cubes in more than one way. +A [taxicab number](https://en.wikipedia.org/wiki/Hardy–Ramanujan number "wp: Hardy–Ramanujan number") (the definition that is being used here) is a positive integer that can be expressed as the sum of two positive cubes in more than one way. The first taxicab number is `1729`, which is: diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/y-combinator.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/y-combinator.md index 690e647586..f76ab91e3c 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/y-combinator.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/y-combinator.md @@ -8,7 +8,7 @@ dashedName: y-combinator # --description-- -In strict [functional programming]( "wp: functional programming") and the [lambda calculus]( "wp: lambda calculus"), functions (lambda expressions) don't have state and are only allowed to refer to arguments of enclosing functions. This rules out the usual definition of a recursive function wherein a function is associated with the state of a variable and this variable's state is used in the body of the function. The [Y combinator](https://mvanier.livejournal.com/2897.html) is itself a stateless function that, when applied to another stateless function, returns a recursive version of the function. The Y combinator is the simplest of the class of such functions, called [fixed-point combinators]( "wp: fixed-point combinator"). +In strict [functional programming](https://en.wikipedia.org/wiki/Functional programming "wp: functional programming") and the [lambda calculus](https://en.wikipedia.org/wiki/lambda calculus "wp: lambda calculus"), functions (lambda expressions) don't have state and are only allowed to refer to arguments of enclosing functions. This rules out the usual definition of a recursive function wherein a function is associated with the state of a variable and this variable's state is used in the body of the function. The [Y combinator](https://mvanier.livejournal.com/2897.html) is itself a stateless function that, when applied to another stateless function, returns a recursive version of the function. The Y combinator is the simplest of the class of such functions, called [fixed-point combinators](https://en.wikipedia.org/wiki/Fixed-point combinator "wp: fixed-point combinator"). # --instructions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md index 64d4e8b5d4..d3970f2f72 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md @@ -10,77 +10,56 @@ dashedName: zhang-suen-thinning-algorithm This is an algorithm used to thin a black and white i.e. one bit per pixel images. For example, with an input image of: - - -
        - #################                   #############
        - ##################               ################
        - ###################            ##################
        - ########     #######          ###################
        -   ######     #######         #######       ######
        -   ######     #######        #######
        -   #################         #######
        -   ################          #######
        -   #################         #######
        -   ######     #######        #######
        -   ######     #######        #######
        -   ######     #######         #######       ######
        - ########     #######          ###################
        - ########     ####### ######    ################## ######
        - ########     ####### ######      ################ ######
        - ########     ####### ######         ############# ######
        -
        +```js +const testImage1 = [ + ' ', + '######### ######## ', + '### #### #### #### ', + '### ### ### ### ', + '### #### ### ', + '######### ### ', + '### #### ### ### ', + '### #### ### #### #### ### ', + '### #### ### ######## ### ', + ' ' +]; +``` It produces the thinned output: -
        +```js
        +[ '                               ',
        +  '########         ######        ',
        +  '#      #        ##             ',
        +  '#       #       #              ',
        +  '#      #        #              ',
        +  '###### #        #              ',
        +  '#     ##        #              ',
        +  '#      #    #   ##    ##   #   ',
        +  '#       #         ####         ',
        +  '                               ' ];
        +```
         
        -    # ##########                       #######
        -     ##        #                   ####       #
        -     #          #                 ##
        -     #          #                #
        -     #          #                #
        -     #          #                #
        -     ############               #
        -     #          #               #
        -     #          #                #
        -     #          #                #
        -     #          #                #
        -     #                            ##
        -     #                             ############
        -                       ###                          ###
        -
        -
        - -

        Algorithm

        +## Algorithm Assume black pixels are one and white pixels zero, and that the input image is a rectangular N by M array of ones and zeroes. The algorithm operates on all black pixels P1 that can have eight neighbours. The neighbours are, in order, arranged as: - - - - -
        P9P2P3
        P8P1P4
        P7P6P5
        +$$\begin{array}{|c|c|c|} \\hline P9 & P2 & P3\\\\ \\hline P8 & \boldsymbol{P1} & P4\\\\ \\hline P7 & P6 & P5\\\\ \\hline \end{array}$$ Obviously the boundary pixels of the image cannot have the full eight neighbours. -
          -
        • Define $A(P1)$ = the number of transitions from white to black, (0 -> 1) in the sequence P2, P3, P4, P5, P6, P7, P8, P9, P2. (Note the extra P2 at the end - it is circular).
        • -
        • Define $B(P1)$ = the number of black pixel neighbours of P1. ( = sum(P2 .. P9) )
        • -
        +- Define $A(P1)$ = the number of transitions from white to black, ($0 \to 1$) in the sequence P2, P3, P4, P5, P6, P7, P8, P9, P2. (Note the extra P2 at the end - it is circular). +- Define $B(P1)$ = the number of black pixel neighbours of P1. ($= \\sum(P2 \ldots P9)$) **Step 1:** All pixels are tested and pixels satisfying all the following conditions (simultaneously) are just noted at this stage. -
          -
        1. The pixel is black and has eight neighbours
        2. -
        3. $2 <= B(P1) <= 6$
        4. -
        5. $A(P1) = 1$
        6. -
        7. At least one of P2, P4 and P6 is white
        8. -
        9. At least one of P4, P6 and P8 is white
        10. -
        +1. The pixel is black and has eight neighbours +2. $2 \le B(P1) \le 6$ +3. $A(P1) = 1$ +4. At least one of $P2$, $P4$ and $P6$ is white +5. At least one of $P4$, $P6$ and $P8$ is white After iterating over the image and collecting all the pixels satisfying all step 1 conditions, all these condition satisfying pixels are set to white. @@ -88,14 +67,12 @@ After iterating over the image and collecting all the pixels satisfying all step All pixels are again tested and pixels satisfying all the following conditions are just noted at this stage. -
          -
        1. The pixel is black and has eight neighbours
        2. -
        3. $2 <= B(P1) <= 6$
        4. -
        5. $A(P1) = 1$
        6. -
        7. At least one of P2, P4 and P8 is white
        8. -
        9. At least one of P2, P6 and P8 is white
        10. -
        - +1. The pixel is black and has eight neighbours +2. $2 \le B(P1) \le 6$ +3. $A(P1) = 1$ +4. At least one of $P2$, $P4$ and $P8$ is white +5. At least one of $P2$, $P6$ and $P8$ is white + After iterating over the image and collecting all the pixels satisfying all step 2 conditions, all these condition satisfying pixels are again set to white. **Iteration:** @@ -104,7 +81,7 @@ If any pixels were set in this round of either step 1 or step 2 then all steps a # --instructions-- -Write a routine to perform Zhang-Suen thinning on the provided image matrix. +Write a routine to perform Zhang-Suen thinning on the provided `image`, an array of strings, where each string represents single line of the image. In the string, `#` represents black pixel, and whitespace represents white pixel. Function should return thinned image, using the same representation. # --hints-- @@ -117,19 +94,25 @@ assert.equal(typeof thinImage, 'function'); `thinImage` should return an array. ```js -assert(Array.isArray(result)); +assert(Array.isArray(thinImage(_testImage1))); ``` `thinImage` should return an array of strings. ```js -assert.equal(typeof result[0], 'string'); +assert.equal(typeof thinImage(_testImage1)[0], 'string'); ``` -`thinImage` should return an array of strings. +`thinImage(testImage1)` should return a thinned image as in the example. ```js -assert.deepEqual(result, expected); +assert.deepEqual(thinImage(_testImage1), expected1); +``` + +`thinImage(testImage2)` should return a thinned image. + +```js +assert.deepEqual(thinImage(_testImage2), expected2); ``` # --seed-- @@ -137,7 +120,31 @@ assert.deepEqual(result, expected); ## --after-user-code-- ```js -const imageForTests = [ +const _testImage1 = [ + ' ', + '######### ######## ', + '### #### #### #### ', + '### ### ### ### ', + '### #### ### ', + '######### ### ', + '### #### ### ### ', + '### #### ### #### #### ### ', + '### #### ### ######## ### ', + ' ' +]; +const expected1 = [ + ' ', + '######## ###### ', + '# # ## ', + '# # # ', + '# # # ', + '###### # # ', + '# ## # ', + '# # # ## ## # ', + '# # #### ', + ' ' +]; +const _testImage2 = [ ' ', ' ################# ############# ', ' ################## ################ ', @@ -156,7 +163,7 @@ const imageForTests = [ ' ######## ####### ###### ################ ###### ', ' ######## ####### ###### ############# ###### ', ' ']; -const expected = [ +const expected2 = [ ' ', ' ', ' # ########## ####### ', @@ -176,35 +183,27 @@ const expected = [ ' ', ' ' ]; -const result = thinImage(imageForTests); ``` ## --seed-contents-- ```js -const testImage = [ - ' ', - ' ################# ############# ', - ' ################## ################ ', - ' ################### ################## ', - ' ######## ####### ################### ', - ' ###### ####### ####### ###### ', - ' ###### ####### ####### ', - ' ################# ####### ', - ' ################ ####### ', - ' ################# ####### ', - ' ###### ####### ####### ', - ' ###### ####### ####### ', - ' ###### ####### ####### ###### ', - ' ######## ####### ################### ', - ' ######## ####### ###### ################## ###### ', - ' ######## ####### ###### ################ ###### ', - ' ######## ####### ###### ############# ###### ', - ' ']; - function thinImage(image) { } + +const testImage1 = [ + ' ', + '######### ######## ', + '### #### #### #### ', + '### ### ### ### ', + '### #### ### ', + '######### ### ', + '### #### ### ### ', + '### #### ### #### #### ### ', + '### #### ### ######## ### ', + ' ' +]; ``` # --solutions-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/take-home-projects/build-a-simon-game.md b/curriculum/challenges/italian/10-coding-interview-prep/take-home-projects/build-a-simon-game.md index 9de29f1566..5bc458abb1 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/take-home-projects/build-a-simon-game.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/take-home-projects/build-a-simon-game.md @@ -8,7 +8,7 @@ dashedName: build-a-simon-game # --description-- -**Objective:** Build a [CodePen.io](https://codepen.io) app that is functionally similar to this: [https://codepen.io/freeCodeCamp/full/obYBjE](https://codepen.io/Em-Ant/full/QbRyqq/). +**Objective:** Build a [CodePen.io](https://codepen.io) app that is functionally similar to this: [https://codepen.io/freeCodeCamp/full/obYBjE](https://codepen.io/freeCodeCamp/full/obYBjE). Fulfill the below [user stories](https://en.wikipedia.org/wiki/User_story). Use whichever libraries or APIs you need. Give it your own personal style. diff --git a/curriculum/challenges/italian/10-coding-interview-prep/take-home-projects/build-the-game-of-life.md b/curriculum/challenges/italian/10-coding-interview-prep/take-home-projects/build-the-game-of-life.md index 10998f981d..498b2a027a 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/take-home-projects/build-the-game-of-life.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/take-home-projects/build-the-game-of-life.md @@ -26,7 +26,7 @@ Fulfill the below [user stories](https://en.wikipedia.org/wiki/User_story). Use **Hint:** Here's an explanation of Conway's Game of Life from John Conway himself: -**Hint:** Here's an overview of Conway's Game of Life with rules for your reference: +**Hint:** Here's an overview of Conway's Game of Life with rules for your reference: [https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) When you are finished, include a link to your project on CodePen and click the "I've completed this challenge" button. diff --git a/curriculum/challenges/italian/12-certificates/apis-and-microservices-certificate/apis-and-microservices-certificate.yml b/curriculum/challenges/italian/12-certificates/apis-and-microservices-certificate/apis-and-microservices-certificate.yml new file mode 100644 index 0000000000..4901216228 --- /dev/null +++ b/curriculum/challenges/italian/12-certificates/apis-and-microservices-certificate/apis-and-microservices-certificate.yml @@ -0,0 +1,21 @@ +--- +id: 561add10cb82ac38a17523bc +title: Certificato API e microservizi +challengeType: 7 +isPrivate: true +tests: + - + id: bd7158d8c443edefaeb5bdef + title: Microservizio Timestamp + - + id: bd7158d8c443edefaeb5bdff + title: Microservizio Parser di header della richiesta + - + id: bd7158d8c443edefaeb5bd0e + title: Microservizio Abbreviazione URL + - + id: 5a8b073d06fa14fcfde687aa + title: Monitor degli esercizi + - + id: bd7158d8c443edefaeb5bd0f + title: Microservizio Metadati di un file diff --git a/curriculum/challenges/italian/12-certificates/data-analysis-with-python-certificate/data-analysis-with-python-certificate.yml b/curriculum/challenges/italian/12-certificates/data-analysis-with-python-certificate/data-analysis-with-python-certificate.yml new file mode 100644 index 0000000000..238899200c --- /dev/null +++ b/curriculum/challenges/italian/12-certificates/data-analysis-with-python-certificate/data-analysis-with-python-certificate.yml @@ -0,0 +1,22 @@ +--- +id: 5e46fc95ac417301a38fb934 +title: Data Analysis with Python Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: 5e46f7e5ac417301a38fb928 + title: Mean-Variance-Standard Deviation Calculator + - + id: 5e46f7e5ac417301a38fb929 + title: Demographic Data Analyzer + - + id: 5e46f7f8ac417301a38fb92a + title: Medical Data Visualizer + - + id: 5e46f802ac417301a38fb92b + title: Page View Time Series Visualizer + - + id: 5e4f5c4b570f7e3a4949899f + title: Sea Level Predictor + diff --git a/curriculum/challenges/italian/12-certificates/information-security-certificate/information-security-certificate.yml b/curriculum/challenges/italian/12-certificates/information-security-certificate/information-security-certificate.yml new file mode 100644 index 0000000000..a6339cfb86 --- /dev/null +++ b/curriculum/challenges/italian/12-certificates/information-security-certificate/information-security-certificate.yml @@ -0,0 +1,21 @@ +--- +id: 5e6021435ac9d0ecd8b94b00 +title: Information Security Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: 587d824a367417b2b2512c44 + title: Stock Price Checker + - + id: 587d824a367417b2b2512c45 + title: Anonymous Message Board + - + id: 5e46f979ac417301a38fb932 + title: Port Scanner + - + id: 5e46f983ac417301a38fb933 + title: SHA-1 Password Cracker + - + id: 5e601c775ac9d0ecd8b94aff + title: Secure Real Time Multiplayer Game diff --git a/curriculum/challenges/italian/12-certificates/legacy-back-end-certificate/legacy-back-end-certificate.yml b/curriculum/challenges/italian/12-certificates/legacy-back-end-certificate/legacy-back-end-certificate.yml new file mode 100644 index 0000000000..d48ecd7921 --- /dev/null +++ b/curriculum/challenges/italian/12-certificates/legacy-back-end-certificate/legacy-back-end-certificate.yml @@ -0,0 +1,36 @@ +--- +id: 660add10cb82ac38a17513be +title: Legacy Back End Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: bd7158d8c443edefaeb5bdef + title: Timestamp Microservice + - + id: bd7158d8c443edefaeb5bdff + title: Request Header Parser Microservice + - + id: bd7158d8c443edefaeb5bd0e + title: URL Shortener Microservice + - + id: bd7158d8c443edefaeb5bdee + title: Image Search Abstraction Layer + - + id: bd7158d8c443edefaeb5bd0f + title: File Metadata Microservice + - + id: bd7158d8c443eddfaeb5bdef + title: Build a Voting App + - + id: bd7158d8c443eddfaeb5bdff + title: Build a Nightlife Coordination App + - + id: bd7158d8c443eddfaeb5bd0e + title: Chart the Stock Market + - + id: bd7158d8c443eddfaeb5bd0f + title: Manage a Book Trading Club + - + id: bd7158d8c443eddfaeb5bdee + title: Build a Pinterest Clone diff --git a/curriculum/challenges/italian/12-certificates/legacy-data-visualization-certificate/legacy-data-visualization-certificate.yml b/curriculum/challenges/italian/12-certificates/legacy-data-visualization-certificate/legacy-data-visualization-certificate.yml new file mode 100644 index 0000000000..1508cf30d8 --- /dev/null +++ b/curriculum/challenges/italian/12-certificates/legacy-data-visualization-certificate/legacy-data-visualization-certificate.yml @@ -0,0 +1,36 @@ +--- +id: 561add10cb82ac39a17513bc +title: Legacy Data Visualization Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: bd7157d8c242eddfaeb5bd13 + title: Build a Markdown Previewer + - + id: bd7156d8c242eddfaeb5bd13 + title: Build a Camper Leaderboard + - + id: bd7155d8c242eddfaeb5bd13 + title: Build a Recipe Box + - + id: bd7154d8c242eddfaeb5bd13 + title: Build the Game of Life + - + id: bd7153d8c242eddfaeb5bd13 + title: Build a Roguelike Dungeon Crawler Game + - + id: bd7168d8c242eddfaeb5bd13 + title: Visualize Data with a Bar Chart + - + id: bd7178d8c242eddfaeb5bd13 + title: Visualize Data with a Scatterplot Graph + - + id: bd7188d8c242eddfaeb5bd13 + title: Visualize Data with a Heat Map + - + id: bd7198d8c242eddfaeb5bd13 + title: Show National Contiguity with a Force Directed Graph + - + id: bd7108d8c242eddfaeb5bd13 + title: Map Data Across the Globe diff --git a/curriculum/challenges/italian/12-certificates/legacy-front-end-certificate/legacy-front-end-certificate.yml b/curriculum/challenges/italian/12-certificates/legacy-front-end-certificate/legacy-front-end-certificate.yml new file mode 100644 index 0000000000..93d72c9b7f --- /dev/null +++ b/curriculum/challenges/italian/12-certificates/legacy-front-end-certificate/legacy-front-end-certificate.yml @@ -0,0 +1,36 @@ +--- +id: 561add10cb82ac38a17513be +title: Legacy Front End Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: bd7158d8c242eddfaeb5bd13 + title: Build a Personal Portfolio Webpage + - + id: bd7158d8c442eddfaeb5bd13 + title: Build a Random Quote Machine + - + id: bd7158d8c442eddfaeb5bd0f + title: Build a 25 + 5 Clock + - + id: bd7158d8c442eddfaeb5bd17 + title: Build a JavaScript Calculator + - + id: bd7158d8c442eddfaeb5bd10 + title: Show the Local Weather + - + id: bd7158d8c442eddfaeb5bd1f + title: Use the Twitch JSON API + - + id: bd7158d8c442eddfaeb5bd18 + title: Stylize Stories on Camper News + - + id: bd7158d8c442eddfaeb5bd19 + title: Build a Wikipedia Viewer + - + id: bd7158d8c442eedfaeb5bd1c + title: Build a Tic Tac Toe Game + - + id: bd7158d8c442eddfaeb5bd1c + title: Build a Simon Game diff --git a/curriculum/challenges/italian/12-certificates/legacy-full-stack-certificate/legacy-full-stack-certificate.yml b/curriculum/challenges/italian/12-certificates/legacy-full-stack-certificate/legacy-full-stack-certificate.yml new file mode 100644 index 0000000000..97e2fcfc9d --- /dev/null +++ b/curriculum/challenges/italian/12-certificates/legacy-full-stack-certificate/legacy-full-stack-certificate.yml @@ -0,0 +1,24 @@ +--- +id: 561add10cb82ac38a17213bd +title: Legacy Full Stack Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: 561add10cb82ac38a17513bc + title: Responsive Web Design Certificate + - + id: 561abd10cb81ac38a17513bc + title: JavaScript Algorithms and Data Structures Certificate + - + id: 561acd10cb82ac38a17513bc + title: Front End Libraries Certificate + - + id: 5a553ca864b52e1d8bceea14 + title: Data Visualization Certificate + - + id: 561add10cb82ac38a17523bc + title: API's and Microservices Certificate + - + id: 561add10cb82ac38a17213bc + title: Legacy Information Security and Quality Assurance Certificate diff --git a/curriculum/challenges/italian/12-certificates/legacy-information-security-and-quality-assurance-certificate/legacy-information-security-and-quality-assurance-certificate.yml b/curriculum/challenges/italian/12-certificates/legacy-information-security-and-quality-assurance-certificate/legacy-information-security-and-quality-assurance-certificate.yml new file mode 100644 index 0000000000..1990a343ed --- /dev/null +++ b/curriculum/challenges/italian/12-certificates/legacy-information-security-and-quality-assurance-certificate/legacy-information-security-and-quality-assurance-certificate.yml @@ -0,0 +1,21 @@ +--- +id: 561add10cb82ac38a17213bc +title: Legacy Information Security and Quality Assurance Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: 587d8249367417b2b2512c41 + title: Metric-Imperial Converter + - + id: 587d8249367417b2b2512c42 + title: Issue Tracker + - + id: 587d824a367417b2b2512c43 + title: Personal Library + - + id: 587d824a367417b2b2512c44 + title: Stock Price Checker + - + id: 587d824a367417b2b2512c45 + title: Anonymous Message Board diff --git a/curriculum/challenges/italian/12-certificates/machine-learning-with-python-certificate/machine-learning-with-python-certificate.yml b/curriculum/challenges/italian/12-certificates/machine-learning-with-python-certificate/machine-learning-with-python-certificate.yml new file mode 100644 index 0000000000..266eb63948 --- /dev/null +++ b/curriculum/challenges/italian/12-certificates/machine-learning-with-python-certificate/machine-learning-with-python-certificate.yml @@ -0,0 +1,22 @@ +--- +id: 5e46fc95ac417301a38fb935 +title: Machine Learning with Python Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: 5e46f8d6ac417301a38fb92d + title: Rock Paper Scissors + - + id: 5e46f8dcac417301a38fb92e + title: Cat and Dog Image Classifier + - + id: 5e46f8e3ac417301a38fb92f + title: Book Recommendation Engine using KNN + - + id: 5e46f8edac417301a38fb930 + title: Linear Regression Health Costs Calculator + - + id: 5e46f8edac417301a38fb931 + title: Neural Network SMS Text Classifier + diff --git a/curriculum/challenges/italian/12-certificates/quality-assurance-certificate/quality-assurance-certificate.yml b/curriculum/challenges/italian/12-certificates/quality-assurance-certificate/quality-assurance-certificate.yml new file mode 100644 index 0000000000..5e229ba55c --- /dev/null +++ b/curriculum/challenges/italian/12-certificates/quality-assurance-certificate/quality-assurance-certificate.yml @@ -0,0 +1,22 @@ +--- +id: 5e611829481575a52dc59c0e +title: Quality Assurance Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: 587d8249367417b2b2512c41 + title: Metric-Imperial Converter + - + id: 587d8249367417b2b2512c42 + title: Issue Tracker + - + id: 587d824a367417b2b2512c43 + title: Personal Library + - + id: 5e601bf95ac9d0ecd8b94afd + title: Sudoku Solver + - + id: 5e601c0d5ac9d0ecd8b94afe + title: American British Translator + diff --git a/curriculum/challenges/italian/12-certificates/relational-databases-certificate/relational-databases-certificate.yml b/curriculum/challenges/italian/12-certificates/relational-databases-certificate/relational-databases-certificate.yml new file mode 100644 index 0000000000..1d01bf91d9 --- /dev/null +++ b/curriculum/challenges/italian/12-certificates/relational-databases-certificate/relational-databases-certificate.yml @@ -0,0 +1,21 @@ +--- +id: 606243f50267e718b1e755f4 +title: Relational Databases Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: 5f1a4ef5d5d6b5ab580fc6ae + title: Celestial Bodies Database + - + id: 5f9771307d4d22b9d2b75a94 + title: World Cup Database + - + id: 5f87ac112ae598023a42df1a + title: Salon Appointment Scheduler + - + id: 602d9ff222201c65d2a019f2 + title: Periodic Table Database + - + id: 602da04c22201c65d2a019f4 + title: Final Boss diff --git a/curriculum/challenges/italian/12-certificates/scientific-computing-with-python-certificate/scientific-computing-with-python-certificate.yml b/curriculum/challenges/italian/12-certificates/scientific-computing-with-python-certificate/scientific-computing-with-python-certificate.yml new file mode 100644 index 0000000000..1f2f103e94 --- /dev/null +++ b/curriculum/challenges/italian/12-certificates/scientific-computing-with-python-certificate/scientific-computing-with-python-certificate.yml @@ -0,0 +1,21 @@ +--- +id: 5e44431b903586ffb414c951 +title: Scientific Computing with Python Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: 5e44412c903586ffb414c94c + title: Arithmetic Formatter + - + id: 5e444136903586ffb414c94d + title: Time Calculator + - + id: 5e44413e903586ffb414c94e + title: Budget App + - + id: 5e444147903586ffb414c94f + title: Polygon Area Calculator + - + id: 5e44414f903586ffb414c950 + title: Probability Calculator diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.md index 23b048b60c..345353cb41 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.md @@ -1,6 +1,6 @@ --- id: a77dbc43c33f39daa4429b4f -title: Boo who +title: Verdadeiro ou falso challengeType: 5 forumTopicId: 16000 dashedName: boo-who @@ -8,67 +8,67 @@ dashedName: boo-who # --description-- -Check if a value is classified as a boolean primitive. Return `true` or `false`. +Verifica se um valor é classificado como booleano primitivo. Retorna `true` ou `false`. -Boolean primitives are `true` and `false`. +Primitivas booleanas são `true` e `false`. # --hints-- -`booWho(true)` should return `true`. +`booWho(true)` deve retornar `true`. ```js assert.strictEqual(booWho(true), true); ``` -`booWho(false)` should return `true`. +`booWho(false)` deve retornar `true`. ```js assert.strictEqual(booWho(false), true); ``` -`booWho([1, 2, 3])` should return `false`. +`booWho([1,2,3])` deve retornar `false`. ```js assert.strictEqual(booWho([1, 2, 3]), false); ``` -`booWho([].slice)` should return `false`. +`booWho([].slice)` deve retornar `false`. ```js assert.strictEqual(booWho([].slice), false); ``` -`booWho({ "a": 1 })` should return `false`. +`booWho({"a": 1})` deve retornar `false`. ```js assert.strictEqual(booWho({ a: 1 }), false); ``` -`booWho(1)` should return `false`. +`booWho(1)` deve retornar `false`. ```js assert.strictEqual(booWho(1), false); ``` -`booWho(NaN)` should return `false`. +`booWho(NaN)` deve retornar `false`. ```js assert.strictEqual(booWho(NaN), false); ``` -`booWho("a")` should return `false`. +`booWho("a")` deve retornar `false`. ```js assert.strictEqual(booWho('a'), false); ``` -`booWho("true")` should return `false`. +`booWho("true")` deve retornar `false`. ```js assert.strictEqual(booWho('true'), false); ``` -`booWho("false")` should return `false`. +`booWho("false")` deve retornar `false`. ```js assert.strictEqual(booWho('false'), false); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey.md index 9abbde07ab..61040786c5 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey.md @@ -1,6 +1,6 @@ --- id: a9bd25c716030ec90084d8a1 -title: Chunky Monkey +title: Macaco Robusto challengeType: 5 forumTopicId: 16005 dashedName: chunky-monkey @@ -8,11 +8,11 @@ dashedName: chunky-monkey # --description-- -Write a function that splits an array (first argument) into groups the length of `size` (second argument) and returns them as a two-dimensional array. +Escreva uma função que divida um array (primeiro argumento) em grupos de comprimento `size` (segundo argumento) e os retorne como um array bidimensional. # --hints-- -`chunkArrayInGroups(["a", "b", "c", "d"], 2)` should return `[["a", "b"], ["c", "d"]]`. +`chunkArrayInGroups(["a", "b", "c", "d"], 2)` deve retornar `[["a", "b"], ["c", "d"]]`. ```js assert.deepEqual(chunkArrayInGroups(['a', 'b', 'c', 'd'], 2), [ @@ -21,7 +21,7 @@ assert.deepEqual(chunkArrayInGroups(['a', 'b', 'c', 'd'], 2), [ ]); ``` -`chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)` should return `[[0, 1, 2], [3, 4, 5]]`. +`chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)` deve retornar `[[0, 1, 2], [3, 4, 5]]`. ```js assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3), [ @@ -30,7 +30,7 @@ assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3), [ ]); ``` -`chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)` should return `[[0, 1], [2, 3], [4, 5]]`. +`chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)` deve retornar `[[0, 1], [2, 3], [4, 5]]`. ```js assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2), [ @@ -40,7 +40,7 @@ assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2), [ ]); ``` -`chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)` should return `[[0, 1, 2, 3], [4, 5]]`. +`chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)` deve retornar `[[0, 1, 2, 3], [4, 5]]`. ```js assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4), [ @@ -49,7 +49,7 @@ assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4), [ ]); ``` -`chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)` should return `[[0, 1, 2], [3, 4, 5], [6]]`. +`chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)` deve retornar `[[0, 1, 2], [3, 4, 5], [6]]`. ```js assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3), [ @@ -59,7 +59,7 @@ assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3), [ ]); ``` -`chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)` should return `[[0, 1, 2, 3], [4, 5, 6, 7], [8]]`. +`chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)` deve retornar `[[0, 1, 2, 3], [4, 5, 6, 7], [8]]`. ```js assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [ @@ -69,7 +69,7 @@ assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [ ]); ``` -`chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)` should return `[[0, 1], [2, 3], [4, 5], [6, 7], [8]]`. +`chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)` deve retornar `[[0, 1], [2, 3], [4, 5], [6, 7], [8]]`. ```js assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2), [ diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index a793811b43..cf8607b8cd 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -1,6 +1,6 @@ --- id: acda2fb1324d9b0fa741e6b5 -title: Confirm the Ending +title: Confirme o final challengeType: 5 forumTopicId: 16006 dashedName: confirm-the-ending @@ -8,31 +8,31 @@ dashedName: confirm-the-ending # --description-- -Check if a string (first argument, `str`) ends with the given target string (second argument, `target`). +Verifique se uma string (primeiro argumento, `str`) termina com a sequência de caracteres de destino fornecida (segundo argumento, `target`). -This challenge *can* be solved with the `.endsWith()` method, which was introduced in ES2015. But for the purpose of this challenge, we would like you to use one of the JavaScript substring methods instead. +Este desafio *pode ser resolvido* com o método `.endsWith()`, que foi introduzido na ES2015. Mas para a finalidade deste desafio, gostaríamos que você usasse um dos métodos de substring JavaScript. # --hints-- -`confirmEnding("Bastian", "n")` should return `true`. +`confirmEnding("Bastian","n")` deve retornar `true`. ```js assert(confirmEnding('Bastian', 'n') === true); ``` -`confirmEnding("Congratulation", "on")` should return `true`. +`confirmEnding("Congratulation","on")` deve retornar `true`. ```js assert(confirmEnding('Congratulation', 'on') === true); ``` -`confirmEnding("Connor", "n")` should return `false`. +`confirmEnding("Connor","n")` deve retornar `false`. ```js assert(confirmEnding('Connor', 'n') === false); ``` -`confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification")` should return `false`. +`confirmEnding("Walking on water and developing software from a specifaction are easy if both are frozen","specification")` deve retornar `false`. ```js assert( @@ -43,31 +43,31 @@ assert( ); ``` -`confirmEnding("He has to give me a new name", "name")` should return `true`. +`confirmEnding("He has to give me a new name","name")` deve retornar `true`. ```js assert(confirmEnding('He has to give me a new name', 'name') === true); ``` -`confirmEnding("Open sesame", "same")` should return `true`. +`confirmEnding("Open sesame","same")` deve retornar `true`. ```js assert(confirmEnding('Open sesame', 'same') === true); ``` -`confirmEnding("Open sesame", "sage")` should return `false`. +`confirmEnding("Open sesame", "sage")` deve retornar `false`. ```js assert(confirmEnding('Open sesame', 'sage') === false); ``` -`confirmEnding("Open sesame", "game")` should return `false`. +`confirmEnding("Open sesame","game")` deve retornar `false`. ```js assert(confirmEnding('Open sesame', 'game') === false); ``` -`confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")` should return `false`. +`confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")` deve retornar `false`. ```js assert( @@ -78,13 +78,13 @@ assert( ); ``` -`confirmEnding("Abstraction", "action")` should return `true`. +`confirmEnding("Abstraction", "action")` deve retornar `true`. ```js assert(confirmEnding('Abstraction', 'action') === true); ``` -Your code should not use the built-in method `.endsWith()` to solve the challenge. +Seu código não deve usar o método embutido `.endsWith()` para resolver o desafio. ```js assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/convert-celsius-to-fahrenheit.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/convert-celsius-to-fahrenheit.md index 616f44a987..76d46b4962 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/convert-celsius-to-fahrenheit.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/convert-celsius-to-fahrenheit.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244b3 -title: Convert Celsius to Fahrenheit +title: Converta Celsius para Fahrenheit challengeType: 1 forumTopicId: 16806 dashedName: convert-celsius-to-fahrenheit @@ -8,43 +8,43 @@ dashedName: convert-celsius-to-fahrenheit # --description-- -The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times `9/5`, plus `32`. +O algoritmo para converter de Celsius para Fahrenheit é a temperatura em Celsius vezes `9/5`, mais `32`. -You are given a variable `celsius` representing a temperature in Celsius. Use the variable `fahrenheit` already defined and assign it the Fahrenheit temperature equivalent to the given Celsius temperature. Use the algorithm mentioned above to help convert the Celsius temperature to Fahrenheit. +Você tem uma variável `celsius` representando uma temperatura em Celsius. Use a variável `fahrenheit` já definida e atribua a ela a temperatura equivalente à temperatura Celsius indicada. Use o algoritmo mencionado acima para ajudar a converter a temperatura Celsius para Fahrenheit. # --hints-- -`convertToF(0)` should return a number +`convertToF(0)` deve retornar um número ```js assert(typeof convertToF(0) === 'number'); ``` -`convertToF(-30)` should return a value of `-22` +`convertToF(-30)` deve retornar um valor de `-22` ```js assert(convertToF(-30) === -22); ``` -`convertToF(-10)` should return a value of `14` +`convertToF(-10)` deve retornar um valor de `14` ```js assert(convertToF(-10) === 14); ``` -`convertToF(0)` should return a value of `32` +`convertToF(0)` deve retornar um valor de `32` ```js assert(convertToF(0) === 32); ``` -`convertToF(20)` should return a value of `68` +`convertToF(20)` deve retornar um valor de `68` ```js assert(convertToF(20) === 68); ``` -`convertToF(30)` should return a value of `86` +`convertToF(30)` deve retornar um valor de `86` ```js assert(convertToF(30) === 86); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.md index 5a884cff9d..aadc9b1bdd 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.md @@ -1,6 +1,6 @@ --- id: a302f7aae1aa3152a5b413bc -title: Factorialize a Number +title: Fatore um número challengeType: 5 forumTopicId: 16013 dashedName: factorialize-a-number @@ -8,43 +8,43 @@ dashedName: factorialize-a-number # --description-- -Return the factorial of the provided integer. +Retorne o fatorial do inteiro fornecido. -If the integer is represented with the letter `n`, a factorial is the product of all positive integers less than or equal to `n`. +Se o inteiro é representado com a letra `n`, o fatorial é o produto de todos os inteiros positivos menor ou igual a `n`. -Factorials are often represented with the shorthand notation `n!` +Fatoriais são frequentemente representados com notação abreviada `n!` -For example: `5! = 1 * 2 * 3 * 4 * 5 = 120` +Por exemplo: `5! = 1 * 2 * 3 * 4 * 5 = 120` -Only integers greater than or equal to zero will be supplied to the function. +Apenas números inteiros maiores ou iguais a zero serão fornecidos para a função. # --hints-- -`factorialize(5)` should return a number. +`factorialize(5)` deve retornar um número. ```js assert(typeof factorialize(5) === 'number'); ``` -`factorialize(5)` should return `120`. +`factorialize(5)` deve retornar `120`. ```js assert(factorialize(5) === 120); ``` -`factorialize(10)` should return `3628800`. +`factorialize(10)` deve retornar `3628800`. ```js assert(factorialize(10) === 3628800); ``` -`factorialize(20)` should return `2432902008176640000`. +`factorialize(20)` deve retornar `2432902008176640000`. ```js assert(factorialize(20) === 2432902008176640000); ``` -`factorialize(0)` should return `1`. +`factorialize(0)` deve retornar `1`. ```js assert(factorialize(0) === 1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer.md index 32ef7c3901..959fdc709f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer.md @@ -1,6 +1,6 @@ --- id: adf08ec01beb4f99fc7a68f2 -title: Falsy Bouncer +title: Removendo falsos challengeType: 5 forumTopicId: 16014 dashedName: falsy-bouncer @@ -8,33 +8,33 @@ dashedName: falsy-bouncer # --description-- -Remove all falsy values from an array. +Remover todos os valores falsos de um array. -Falsy values in JavaScript are `false`, `null`, `0`, `""`, `undefined`, and `NaN`. +Valores falsos (falsy) em JavaScript são `false`, `null`, `0`, `""`, `undefined`, e `NaN`. -Hint: Try converting each value to a Boolean. +Dica: tente converter cada valor para um booleano. # --hints-- -`bouncer([7, "ate", "", false, 9])` should return `[7, "ate", 9]`. +`bouncer([7, "ate", "", false, 9])` deve retornar `[7, "ate", 9]`. ```js assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9]); ``` -`bouncer(["a", "b", "c"])` should return `["a", "b", "c"]`. +`bouncer(["a", "b", "c"])` deve retornar `["a", "b", "c"]`. ```js assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c']); ``` -`bouncer([false, null, 0, NaN, undefined, ""])` should return `[]`. +`bouncer([false, null, 0, NaN, undefined, ""])` deve retornar `[]`. ```js assert.deepEqual(bouncer([false, null, 0, NaN, undefined, '']), []); ``` -`bouncer([null, NaN, 1, 2, undefined])` should return `[1, 2]`. +`bouncer([null, NaN, 1, 2, undefined])` deve retornar `[1, 2]`. ```js assert.deepEqual(bouncer([null, NaN, 1, 2, undefined]), [1, 2]); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.md index cc62bb4c9f..8b3311c813 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.md @@ -1,6 +1,6 @@ --- id: a26cbbe9ad8655a977e1ceb5 -title: Find the Longest Word in a String +title: Encontre a palavra mais longa em uma String challengeType: 5 forumTopicId: 16015 dashedName: find-the-longest-word-in-a-string @@ -8,13 +8,13 @@ dashedName: find-the-longest-word-in-a-string # --description-- -Return the length of the longest word in the provided sentence. +Retornar o comprimento da palavra mais comprida na frase fornecida. -Your response should be a number. +Sua resposta deve ser um número. # --hints-- -`findLongestWordLength("The quick brown fox jumped over the lazy dog")` should return a number. +`findLongestWordLength("The quick brown fox jumped over the lazy dog")` deve retornar um número. ```js assert( @@ -24,7 +24,7 @@ assert( ); ``` -`findLongestWordLength("The quick brown fox jumped over the lazy dog")` should return `6`. +`findLongestWordLength("The quick brown fox jumped over the lazy dog")` deve retornar `6`. ```js assert( @@ -32,19 +32,19 @@ assert( ); ``` -`findLongestWordLength("May the force be with you")` should return `5`. +`findLongestWordLength("May the force be with you")` deve retornar `5`. ```js assert(findLongestWordLength('May the force be with you') === 5); ``` -`findLongestWordLength("Google do a barrel roll")` should return `6`. +`findLongestWordLength("Google do a barrel roll")` deve retornar `6`. ```js assert(findLongestWordLength('Google do a barrel roll') === 6); ``` -`findLongestWordLength("What is the average airspeed velocity of an unladen swallow")` should return `8`. +`findLongestWordLength("What is the average airspeed velocity of an unladen swallow")` deve retornar `8`. ```js assert( @@ -54,7 +54,7 @@ assert( ); ``` -`findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")` should return `19`. +`findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")` deve retornar `19`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.md index 6bfd7139fc..dc5995b844 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.md @@ -1,6 +1,6 @@ --- id: a6e40f1041b06c996f7b2406 -title: Finders Keepers +title: Achado Não é Roubado challengeType: 5 forumTopicId: 16016 dashedName: finders-keepers @@ -8,11 +8,11 @@ dashedName: finders-keepers # --description-- -Create a function that looks through an array `arr` and returns the first element in it that passes a 'truth test'. This means that given an element `x`, the 'truth test' is passed if `func(x)` is `true`. If no element passes the test, return `undefined`. +Crie uma função que olhe através do array `arr` e retorne o primeiro elemento dentro do array que passe pelo 'teste de verdade' ('truth test'). Isso significa que dado um elemento `x`, o 'teste de verdade' é verdadeiro se `func(x)` é `true`. Se nenhum elemento passa no test, retorna `undefined`. # --hints-- -`findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })` should return `8`. +`findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })` deve retornar `8`. ```js assert.strictEqual( @@ -23,7 +23,7 @@ assert.strictEqual( ); ``` -`findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })` should return `undefined`. +`findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })` deve retornar `undefined`. ```js assert.strictEqual( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.md index 99da5fd90b..ae7be3b53b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.md @@ -1,6 +1,6 @@ --- id: af2170cad53daa0770fabdea -title: Mutations +title: Mutações challengeType: 5 forumTopicId: 16025 dashedName: mutations @@ -8,83 +8,83 @@ dashedName: mutations # --description-- -Return `true` if the string in the first element of the array contains all of the letters of the string in the second element of the array. +Retorne `true` se a string no primeiro elemento do array contém todas as letras da string no segundo elemento do array. -For example, `["hello", "Hello"]`, should return `true` because all of the letters in the second string are present in the first, ignoring case. +Por exemplo, `["hello", "Hello"]`, deve retornar `true` porque todas as letras na segunda string estão presentes no primeiro, ignorando diferenças entre maiúsculos e minúsculos. -The arguments `["hello", "hey"]` should return `false` because the string `hello` does not contain a `y`. +Os argumentos `["hello","hey"]` deve retornar `false` porque a string `hello` não contém o caracter `y`. -Lastly, `["Alien", "line"]`, should return `true` because all of the letters in `line` are present in `Alien`. +Por último, `["Alien", "line"]`, deve retornar `true` porque todas as letras em `line` estão presente em `Alien`. # --hints-- -`mutation(["hello", "hey"])` should return `false`. +`mutation(["hello", "hey"])` deve retornar `false`. ```js assert(mutation(['hello', 'hey']) === false); ``` -`mutation(["hello", "Hello"])` should return `true`. +`mutation(["hello","Hello"])` deve retornar `true`. ```js assert(mutation(['hello', 'Hello']) === true); ``` -`mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])` should return `true`. +`mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])` deve retornar `true`. ```js assert(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu']) === true); ``` -`mutation(["Mary", "Army"])` should return `true`. +`mutation(["Mary", "Army"])` deve retornar `true`. ```js assert(mutation(['Mary', 'Army']) === true); ``` -`mutation(["Mary", "Aarmy"])` should return `true`. +`mutation(["Mary", "Aarmy"])` deve retornar `true`. ```js assert(mutation(['Mary', 'Aarmy']) === true); ``` -`mutation(["Alien", "line"])` should return `true`. +`mutation(["Alien", "line"])` deve retornar `true`. ```js assert(mutation(['Alien', 'line']) === true); ``` -`mutation(["floor", "for"])` should return `true`. +`mutation(["floor", "for"])` deve retornar `true`. ```js assert(mutation(['floor', 'for']) === true); ``` -`mutation(["hello", "neo"])` should return `false`. +`mutation(["hello", "neo"])` deve retornar `false`. ```js assert(mutation(['hello', 'neo']) === false); ``` -`mutation(["voodoo", "no"])` should return `false`. +`mutation(["voodoo", "no"])` deve retornar `false`. ```js assert(mutation(['voodoo', 'no']) === false); ``` -`mutation(["ate", "date"])` should return `false`. +`mutation(["ate", "date"])` deve retornar `false`. ```js assert(mutation(['ate', 'date']) === false); ``` -`mutation(["Tiger", "Zebra"])` should return `false`. +`mutation(["Tiger", "Zebra"])` deve retornar `false`. ```js assert(mutation(['Tiger', 'Zebra']) === false); ``` -`mutation(["Noel", "Ole"])` should return `true`. +`mutation(["Noel", "Ole"])` deve retornar `true`. ```js assert(mutation(['Noel', 'Ole']) === true); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index d7349722c0..e58727595d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -1,6 +1,6 @@ --- id: afcc8d540bea9ea2669306b6 -title: Repeat a String Repeat a String +title: Repita uma String Repita uma String challengeType: 5 forumTopicId: 16041 dashedName: repeat-a-string-repeat-a-string @@ -8,53 +8,53 @@ dashedName: repeat-a-string-repeat-a-string # --description-- -Repeat a given string `str` (first argument) for `num` times (second argument). Return an empty string if `num` is not a positive number. For the purpose of this challenge, do *not* use the built-in `.repeat()` method. +Repita uma string passada `str` (primeiro argumento), `num` vezes (segundo argumento). Retorne uma string vazia se `num` não for um número positivo. Para o propósito do desafio, *Não* use o método embutido `.repeat()`. # --hints-- -`repeatStringNumTimes("*", 3)` should return the string `***`. +`repeatStringNumTimes("*", 3)` deve retornar a string `***`. ```js assert(repeatStringNumTimes('*', 3) === '***'); ``` -`repeatStringNumTimes("abc", 3)` should return the string `abcabcabc`. +`repeatStringNumTimes("abc", 3)` deve retornar a string `abcabcabc`. ```js assert(repeatStringNumTimes('abc', 3) === 'abcabcabc'); ``` -`repeatStringNumTimes("abc", 4)` should return the string `abcabcabcabc`. +`repeatStringNumTimes("abc", 4)` deve retornar a `abcabcabcabc`. ```js assert(repeatStringNumTimes('abc', 4) === 'abcabcabcabc'); ``` -`repeatStringNumTimes("abc", 1)` should return the string `abc`. +`repeatStringNumTimes("abc", 1)` deve retornar a string `abc`. ```js assert(repeatStringNumTimes('abc', 1) === 'abc'); ``` -`repeatStringNumTimes("*", 8)` should return the string `********`. +`repeatStringNumTimes("*", 8)` deve retornar a `********`. ```js assert(repeatStringNumTimes('*', 8) === '********'); ``` -`repeatStringNumTimes("abc", -2)` should return an empty string (`""`). +`repeatStringNumTimes("abc", -2)` deve retornar uma string vazia (`""`). ```js assert(repeatStringNumTimes('abc', -2) === ''); ``` -The built-in `repeat()` method should not be used. +O método embutido `repeat()` não deve ser usada. ```js assert(!/\.repeat/g.test(code)); ``` -`repeatStringNumTimes("abc", 0)` should return `""`. +`repeatStringNumTimes("abc", 0)` deve retornar `""`. ```js assert(repeatStringNumTimes('abc', 0) === ''); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/return-largest-numbers-in-arrays.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/return-largest-numbers-in-arrays.md index 2148b0cbd2..dc6d84ec0e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/return-largest-numbers-in-arrays.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/return-largest-numbers-in-arrays.md @@ -1,6 +1,6 @@ --- id: a789b3483989747d63b0e427 -title: Return Largest Numbers in Arrays +title: Retorne os Maior Número em Arrays challengeType: 5 forumTopicId: 16042 dashedName: return-largest-numbers-in-arrays @@ -8,13 +8,13 @@ dashedName: return-largest-numbers-in-arrays # --description-- -Return an array consisting of the largest number from each provided sub-array. For simplicity, the provided array will contain exactly 4 sub-arrays. +Retorna um array que consiste do maior número de cada sub-array fornecido. Por simplicidade, o array fornecido conterá exatamente 4 sub-arrays. -Remember, you can iterate through an array with a simple for loop, and access each member with array syntax `arr[i]`. +Lembre-se, você pode iterar através de um array com um loop simples, e acesse cada membro com a sintaxe de array `arr[i]`. # --hints-- -`largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])` should return an array. +`largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])` deve retornar um array. ```js assert( @@ -27,7 +27,7 @@ assert( ); ``` -`largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])` should return `[27, 5, 39, 1001]`. +`largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])` deve retornar `[27, 5, 39, 1001]`. ```js assert.deepEqual( @@ -41,7 +41,7 @@ assert.deepEqual( ); ``` -`largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])` should return `[9, 35, 97, 1000000]`. +`largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])` deve retornar `[9, 35, 97, 1000000]`. ```js assert.deepEqual( @@ -55,7 +55,7 @@ assert.deepEqual( ); ``` -`largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])` should return `[25, 48, 21, -3]`. +`largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])` deve retornar `[25, 48, 21, -3]`. ```js assert.deepEqual( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.md index 0e948fbe9f..fb0660270b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.md @@ -1,6 +1,6 @@ --- id: a202eed8fc186c8434cb6d61 -title: Reverse a String +title: Inverter uma String challengeType: 5 forumTopicId: 16043 dashedName: reverse-a-string @@ -8,33 +8,33 @@ dashedName: reverse-a-string # --description-- -Reverse the provided string. +Inverta a string fornecida. -You may need to turn the string into an array before you can reverse it. +Você pode ter que transformar a string em um array antes de você poder inverter. -Your result must be a string. +Seu resultado deve ser uma string. # --hints-- -`reverseString("hello")` should return a string. +`reverseString("hello")` deve retornar uma string. ```js assert(typeof reverseString('hello') === 'string'); ``` -`reverseString("hello")` should return the string `olleh`. +`reverseString("hello")` deve retornar a string `olleh`. ```js assert(reverseString('hello') === 'olleh'); ``` -`reverseString("Howdy")` should return the string `ydwoH`. +`reverseString("Howdy")` deve retornar a string `ydwoH`. ```js assert(reverseString('Howdy') === 'ydwoH'); ``` -`reverseString("Greetings from Earth")` should return the string `htraE morf sgniteerG`. +`reverseString("Greetings from Earth")` deve retornar a string `htraE morf sgniteerG`. ```js assert(reverseString('Greetings from Earth') === 'htraE morf sgniteerG'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice.md index aa06a9e5fa..87d1f7abcb 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice.md @@ -1,6 +1,6 @@ --- id: 579e2a2c335b9d72dd32e05c -title: Slice and Splice +title: Fatiar e Emendar challengeType: 5 forumTopicId: 301148 dashedName: slice-and-splice @@ -8,29 +8,29 @@ dashedName: slice-and-splice # --description-- -You are given two arrays and an index. +Você está recebendo dois arrays e um índice. -Copy each element of the first array into the second array, in order. +Copie cada elemento da primeira matriz para a segunda matriz, em ordem. -Begin inserting elements at index `n` of the second array. +Comece inserindo elementos no índice `n` do segundo array. -Return the resulting array. The input arrays should remain the same after the function runs. +Retorne o array resultante. Os arrays recebidos devem permanecer os mesmos após a função ser executada. # --hints-- -`frankenSplice([1, 2, 3], [4, 5], 1)` should return `[4, 1, 2, 3, 5]`. +`frankenSplice([1, 2, 3], [4, 5], 1)` deve retornar `[4, 1, 2, 3, 5]`. ```js assert.deepEqual(frankenSplice([1, 2, 3], [4, 5], 1), [4, 1, 2, 3, 5]); ``` -`frankenSplice([1, 2], ["a", "b"], 1)` should return `["a", 1, 2, "b"]`. +`frankenSplice([1, 2], ["a", "b"], 1)` deve retornar `["a", 1, 2, "b"]`. ```js assert.deepEqual(frankenSplice(testArr1, testArr2, 1), ['a', 1, 2, 'b']); ``` -`frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)` should return `["head", "shoulders", "claw", "tentacle", "knees", "toes"]`. +`frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)` deve retornar `["head", "shoulders", "claw", "tentacle", "knees", "toes"]`. ```js assert.deepEqual( @@ -43,20 +43,20 @@ assert.deepEqual( ); ``` -All elements from the first array should be added to the second array in their original order. +Todos os elementos do primeiro array devem ser adicionados no segundo array em suas ordens originais. ```js assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4]); ``` -The first array should remain the same after the function runs. +O primeiro array deve permanecer o mesmo após a função ser executada. ```js frankenSplice(testArr1, testArr2, 1); assert.deepEqual(testArr1, [1, 2]); ``` -The second array should remain the same after the function runs. +O segundo array deve permanecer o mesmo após a função ser executada. ```js frankenSplice(testArr1, testArr2, 1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.md index 0dc778c8a4..96a34be93a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.md @@ -1,6 +1,6 @@ --- id: ab6137d4e35944e21037b769 -title: Title Case a Sentence +title: Capitalização de Título de uma Frase challengeType: 5 forumTopicId: 16088 dashedName: title-case-a-sentence @@ -8,31 +8,31 @@ dashedName: title-case-a-sentence # --description-- -Return the provided string with the first letter of each word capitalized. Make sure the rest of the word is in lower case. +Retorne a string fornecida com a primeira letra de cada palavra em maiúscula. Certifique-se de que o resto da palavra esteja em minúsculo. -For the purpose of this exercise, you should also capitalize connecting words like `the` and `of`. +Para o propósito desse exercício, você também deve capitalizar as palavras conectoras como `the` e `of`. # --hints-- -`titleCase("I'm a little tea pot")` should return a string. +`titleCase("I'm a little tea pot")` deve retornar uma string. ```js assert(typeof titleCase("I'm a little tea pot") === 'string'); ``` -`titleCase("I'm a little tea pot")` should return the string `I'm A Little Tea Pot`. +`titleCase("I'm a little tea pot")` deve retornar a string `I'm A Little Tea Pot`. ```js assert(titleCase("I'm a little tea pot") === "I'm A Little Tea Pot"); ``` -`titleCase("sHoRt AnD sToUt")` should return the string `Short And Stout`. +`titleCase("sHoRt AnD sToUt")` deve retornar a string `Short And Stout`. ```js assert(titleCase('sHoRt AnD sToUt') === 'Short And Stout'); ``` -`titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")` should return the string `Here Is My Handle Here Is My Spout`. +`titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")` deve retornar a string `Here Is My Handle Here Is My Spout`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.md index bb6270d4a8..31c1e05b9d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.md @@ -1,6 +1,6 @@ --- id: ac6993d51946422351508a41 -title: Truncate a String +title: Truncar uma String challengeType: 5 forumTopicId: 16089 dashedName: truncate-a-string @@ -8,11 +8,11 @@ dashedName: truncate-a-string # --description-- -Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a `...` ending. +Truncar uma string (primeiro argumento) se ela for maior que o comprimento máximo da string (segundo argumento). Retorne a string truncada com `...` (reticências) ao final. # --hints-- -`truncateString("A-tisket a-tasket A green and yellow basket", 8)` should return the string `A-tisket...`. +`truncateString("A-tisket a-tasket A green and yellow basket", 8)` deve retornar a string `A-tisket...`. ```js assert( @@ -21,7 +21,7 @@ assert( ); ``` -`truncateString("Peter Piper picked a peck of pickled peppers", 11)` should return the string `Peter Piper...`. +`truncateString("Peter Piper picked a peck of pickled peppers", 11)` deve retornar a string `Peter Piper...`. ```js assert( @@ -30,7 +30,7 @@ assert( ); ``` -`truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)` should return the string `A-tisket a-tasket A green and yellow basket`. +`truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)` deve retornar a string `A-tisket a-tasket A green and yellow basket`. ```js assert( @@ -41,7 +41,7 @@ assert( ); ``` -`truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)` should return the string `A-tisket a-tasket A green and yellow basket`. +`truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)` deve retornar a string `A-tisket a-tasket A green and yellow basket`. ```js assert( @@ -52,13 +52,13 @@ assert( ); ``` -`truncateString("A-", 1)` should return the string `A...`. +`truncateString("A-", 1)` deve retornar a string `A...`. ```js assert(truncateString('A-', 1) === 'A...'); ``` -`truncateString("Absolutely Longer", 2)` should return the string `Ab...`. +`truncateString("Absolutely Longer", 2)` deve retornar a string `Ab...`. ```js assert(truncateString('Absolutely Longer', 2) === 'Ab...'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/where-do-i-belong.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/where-do-i-belong.md index 20f9427e64..f779c2fb6b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/where-do-i-belong.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/where-do-i-belong.md @@ -1,6 +1,6 @@ --- id: a24c1a4622e3c05097f71d67 -title: Where do I Belong +title: Aonde eu pertenço challengeType: 5 forumTopicId: 16094 dashedName: where-do-i-belong @@ -8,105 +8,105 @@ dashedName: where-do-i-belong # --description-- -Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted. The returned value should be a number. +Retorne o menor índice aonde um valor (segundo argumento) deve ser inserido no array (primeiro argumento) assim que tenha sido ordenado. O valor retornado deve ser um número. -For example, `getIndexToIns([1,2,3,4], 1.5)` should return `1` because it is greater than `1` (index 0), but less than `2` (index 1). +Por exemplo, `getIndexToIns([1,2,3,4], 1.5)` deve retornar `1` porque é maior que `1` (índice 0), mas menor que `2` (índice 1). -Likewise, `getIndexToIns([20,3,5], 19)` should return `2` because once the array has been sorted it will look like `[3,5,20]` and `19` is less than `20` (index 2) and greater than `5` (index 1). +Assim como, `getIndexToIns([20,3,5], 19)` deve retornar `2` pois uma vez que o array foi sorteado irá se parecer como `[3,5,20]` e `19` é menor que `20` (índice 2) e maior que `5` (índice 1). # --hints-- -`getIndexToIns([10, 20, 30, 40, 50], 35)` should return `3`. +`getIndexToIns([10, 20, 30, 40, 50], 35)` deve retornar `3`. ```js assert(getIndexToIns([10, 20, 30, 40, 50], 35) === 3); ``` -`getIndexToIns([10, 20, 30, 40, 50], 35)` should return a number. +`getIndexToIns([10, 20, 30, 40, 50], 35)` deve retornar um número. ```js assert(typeof getIndexToIns([10, 20, 30, 40, 50], 35) === 'number'); ``` -`getIndexToIns([10, 20, 30, 40, 50], 30)` should return `2`. +`getIndexToIns([10, 20, 30, 40, 50], 30)` deve retornar `2`. ```js assert(getIndexToIns([10, 20, 30, 40, 50], 30) === 2); ``` -`getIndexToIns([10, 20, 30, 40, 50], 30)` should return a number. +`getIndexToIns([10, 20, 30, 40, 50], 30)` deve retornar um número. ```js assert(typeof getIndexToIns([10, 20, 30, 40, 50], 30) === 'number'); ``` -`getIndexToIns([40, 60], 50)` should return `1`. +`getIndexToIns([40, 60], 50)` deve retornar `1`. ```js assert(getIndexToIns([40, 60], 50) === 1); ``` -`getIndexToIns([40, 60], 50)` should return a number. +`getIndexToIns([40, 60], 50)` deve retornar um número. ```js assert(typeof getIndexToIns([40, 60], 50) === 'number'); ``` -`getIndexToIns([3, 10, 5], 3)` should return `0`. +`getIndexToIns([3, 10, 5], 3)` deve retornar `0`. ```js assert(getIndexToIns([3, 10, 5], 3) === 0); ``` -`getIndexToIns([3, 10, 5], 3)` should return a number. +`getIndexToIns([3, 10, 5], 3)` deve retornar um número. ```js assert(typeof getIndexToIns([3, 10, 5], 3) === 'number'); ``` -`getIndexToIns([5, 3, 20, 3], 5)` should return `2`. +`getIndexToIns([5, 3, 20, 3], 5)` deve retornar `2`. ```js assert(getIndexToIns([5, 3, 20, 3], 5) === 2); ``` -`getIndexToIns([5, 3, 20, 3], 5)` should return a number. +`getIndexToIns([5, 3, 20, 3], 5)` deve retornar um número. ```js assert(typeof getIndexToIns([5, 3, 20, 3], 5) === 'number'); ``` -`getIndexToIns([2, 20, 10], 19)` should return `2`. +`getIndexToIns([2, 20, 10], 19)` deve retornar `2`. ```js assert(getIndexToIns([2, 20, 10], 19) === 2); ``` -`getIndexToIns([2, 20, 10], 19)` should return a number. +`getIndexToIns([2, 20, 10], 19)` deve retornar um número. ```js assert(typeof getIndexToIns([2, 20, 10], 19) === 'number'); ``` -`getIndexToIns([2, 5, 10], 15)` should return `3`. +`getIndexToIns([2, 5, 10], 15)` deve retornar `3`. ```js assert(getIndexToIns([2, 5, 10], 15) === 3); ``` -`getIndexToIns([2, 5, 10], 15)` should return a number. +`getIndexToIns([2, 5, 10], 15)` deve retornar um número. ```js assert(typeof getIndexToIns([2, 5, 10], 15) === 'number'); ``` -`getIndexToIns([], 1)` should return `0`. +`getIndexToIns([], 1)` deve retornar `0`. ```js assert(getIndexToIns([], 1) === 0); ``` -`getIndexToIns([], 1)` should return a number. +`getIndexToIns([], 1)` deve retornar um número. ```js assert(typeof getIndexToIns([], 1) === 'number'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.md index 4f03872562..9f578bb140 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.md @@ -1,6 +1,6 @@ --- id: 5a661e0f1068aca922b3ef17 -title: Access an Array's Contents Using Bracket Notation +title: Acesse o Conteúdo de uma Lista Utilizando a Notação de Colchetes challengeType: 1 forumTopicId: 301149 dashedName: access-an-arrays-contents-using-bracket-notation @@ -8,55 +8,55 @@ dashedName: access-an-arrays-contents-using-bracket-notation # --description-- -The fundamental feature of any data structure is, of course, the ability to not only store data, but to be able to retrieve that data on command. So, now that we've learned how to create an array, let's begin to think about how we can access that array's information. +A funcionalidade fundamental de qualquer estrutura de dados é, evidentemente, não só a capacidade de armazenar informação, como também a possibilidade de acessar esta informação quando necessário. Então, agora que aprendemos como criar um vetor, vamos começar a pensar em como podemos acessar as informações desse vetor. -When we define a simple array as seen below, there are 3 items in it: +Quando definimos uma matriz simples como vista abaixo, existem 3 itens nela: ```js let ourArray = ["a", "b", "c"]; ``` -In an array, each array item has an index. This index doubles as the position of that item in the array, and how you reference it. However, it is important to note, that JavaScript arrays are zero-indexed, meaning that the first element of an array is actually at the ***zeroth*** position, not the first. In order to retrieve an element from an array we can enclose an index in brackets and append it to the end of an array, or more commonly, to a variable which references an array object. This is known as bracket notation. For example, if we want to retrieve the `a` from `ourArray` and assign it to a variable, we can do so with the following code: +Em um array, cada item do array possui um índice . Esse índice possui dois papéis, é a posição daquele item no array e como você o referencia. No entanto, é importante notar que arrays em JavaScript são indexados a zero, o que significa que o primeiro elemento do array está, na verdade, na posição ***zero***, e não na primeira. Para recuperar um elemento de um array, nós podemos ao final de um array adicionar um índice encapsulado com colchetes (por exemplo [0]), ou mais comumente, no final de uma variável que faz referência a um objeto array. Isso é conhecido como notação de colchetes. Por exemplo, se queremos recuperar o `a` de um array `ourArray` e atribuir a uma variável, nós podemos fazer isso com o código a seguir: ```js let ourVariable = ourArray[0]; ``` -Now `ourVariable` has the value of `a`. +Agora `ourVariable` possui o valor de `a`. -In addition to accessing the value associated with an index, you can also *set* an index to a value using the same notation: +Além de acessar o valor associado ao índice, você também pode *definir* um índice para um valor usando a mesma notação: ```js ourArray[1] = "not b anymore"; ``` -Using bracket notation, we have now reset the item at index 1 from the string `b`, to `not b anymore`. Now `ourArray` is `["a", "not b anymore", "c"]`. +Usando a notação de colchetes, agora nos redefinimos o item no índice 1, alterando a string `b`, para `not b anymore`. Agora `ourArray` é `["a", "not b anymore", "c"]`. # --instructions-- -In order to complete this challenge, set the 2nd position (index `1`) of `myArray` to anything you want, besides the letter `b`. +A fim de concluir esse desafio, defina a segunda posição (index `1`) do `myArray` como qualquer coisa que deseja, exceto a letra `b`. # --hints-- -`myArray[0]` should be equal to the letter `a` +`myArray[0]` deve ser igual à letra `a` ```js assert.strictEqual(myArray[0], 'a'); ``` -`myArray[1]` should not be equal to the letter `b` +`myArray[1]` não deve ser igual à letra `b` ```js assert.notStrictEqual(myArray[1], 'b'); ``` -`myArray[2]` should be equal to the letter `c` +`myArray[2]` deve ser igual à letra `c` ```js assert.strictEqual(myArray[2], 'c'); ``` -`myArray[3]` should be equal to the letter `d` +`myArray[3]` deve ser igual à letra `d` ```js assert.strictEqual(myArray[3], 'd'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-property-names-with-bracket-notation.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-property-names-with-bracket-notation.md index 32bf0bb356..9046be2619 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-property-names-with-bracket-notation.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-property-names-with-bracket-notation.md @@ -1,6 +1,6 @@ --- id: 587d7b7c367417b2b2512b1a -title: Access Property Names with Bracket Notation +title: Acesse Nomes de Propriedades com Notação de Colchetes challengeType: 1 forumTopicId: 301150 dashedName: access-property-names-with-bracket-notation @@ -8,28 +8,28 @@ dashedName: access-property-names-with-bracket-notation # --description-- -In the first object challenge we mentioned the use of bracket notation as a way to access property values using the evaluation of a variable. For instance, imagine that our `foods` object is being used in a program for a supermarket cash register. We have some function that sets the `selectedFood` and we want to check our `foods` object for the presence of that food. This might look like: +No primeiro desafio, nós mencionamos o uso da notação de colchetes como uma forma de acessar valores das propriedades usando a avaliação de uma variável. Por exemplo, imagine que nosso objeto `foods` está sendo usado em um programa para a caixa-registradora de um supermercado. Nós temos algumas funções que definem `selectedFood` e nós queremos checar a presença da `selectedFood` em nosso objeto `foods`. Isso pode parecer assim: ```js let selectedFood = getCurrentFood(scannedItem); let inventory = foods[selectedFood]; ``` -This code will evaluate the value stored in the `selectedFood` variable and return the value of that key in the `foods` object, or `undefined` if it is not present. Bracket notation is very useful because sometimes object properties are not known before runtime or we need to access them in a more dynamic way. +Esse código irá avaliar o valor armazenado na variável `selectedFood` e retorna o valor daquela chave no objeto `foods`, ou `undefined` se não estiver presente. Notação de colchetes é muito útil porque às vezes as propriedades de um objeto não são conhecidas antes da execução ou nós precisamos acessá-las de uma forma mais dinâmica. # --instructions-- -We've defined a function, `checkInventory`, which receives a scanned item as an argument. Return the current value of the `scannedItem` key in the `foods` object. You can assume that only valid keys will be provided as an argument to `checkInventory`. +Nós definimos uma função, `checkInventory`, a qual recebe um item escaneado como argumento. Retornar o valor atual da chave `scannedItem` no objeto `foods`. Você pode assumir que apenas chaves válidas serão fornecidas como um argumento para `checkInventory`. # --hints-- -`checkInventory` should be a function. +`checkInventory` deve ser uma função. ```js assert.strictEqual(typeof checkInventory, 'function'); ``` -The `foods` object should have only the following key-value pairs: `apples: 25`, `oranges: 32`, `plums: 28`, `bananas: 13`, `grapes: 35`, `strawberries: 27`. +O objeto `foods` deve ter apenas as duplas de chaves e valores a seguir: `apples: 25`, `oranges: 32`, `plums: 28`, `bananas: 13`, `grapes: 35`, `strawberries: 27`. ```js assert.deepEqual(foods, { @@ -42,19 +42,19 @@ assert.deepEqual(foods, { }); ``` -`checkInventory("apples")` should return `25`. +`checkInventory("apples")` deve retornar `25`. ```js assert.strictEqual(checkInventory('apples'), 25); ``` -`checkInventory("bananas")` should return `13`. +`checkInventory("bananas")` deve retornar `13`. ```js assert.strictEqual(checkInventory('bananas'), 13); ``` -`checkInventory("strawberries")` should return `27`. +`checkInventory("strawberries")` deve retornar `27`. ```js assert.strictEqual(checkInventory('strawberries'), 27); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.md index 81963c6d7e..e23b0ff65e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.md @@ -1,6 +1,6 @@ --- id: 587d78b2367417b2b2512b0e -title: Add Items to an Array with push() and unshift() +title: Adicione itens em um Array com push() e unshift() challengeType: 1 forumTopicId: 301151 dashedName: add-items-to-an-array-with-push-and-unshift @@ -8,9 +8,9 @@ dashedName: add-items-to-an-array-with-push-and-unshift # --description-- -An array's length, like the data types it can contain, is not fixed. Arrays can be defined with a length of any number of elements, and elements can be added or removed over time; in other words, arrays are mutable. In this challenge, we will look at two methods with which we can programmatically modify an array: `Array.push()` and `Array.unshift()`. +O comprimento de um array, como os tipos de dados que pode conter, não são fixos. Arrays podem ser definidos com um comprimento de qualquer número de elementos e elementos podem ser adicionados e removidos ao decorrer do tempo; em outras palavras, arrays são mutáveis. Nesse desafio, nós olharemos dois métodos com os quais podemos modificar programaticamente um array: `Array.push()` e `Array.unshift()`. -Both methods take one or more elements as parameters and add those elements to the array the method is being called on; the `push()` method adds elements to the end of an array, and `unshift()` adds elements to the beginning. Consider the following: +Ambos os métodos recebem 1 ou mais elementos como parâmetros e adiciona esses elementos ao array no qual o método está sendo chamado; o método `push()` adiciona elementos ao final do array, e `unshift()` adiciona no início. Considere o seguinte: ```js let twentyThree = 'XXIII'; @@ -19,21 +19,21 @@ let romanNumerals = ['XXI', 'XXII']; romanNumerals.unshift('XIX', 'XX'); ``` -`romanNumerals` would have the value `['XIX', 'XX', 'XXI', 'XXII']`. +`romanNumerals` teria os valores `['XIX', 'XX', 'XXI', 'XXII']`. ```js romanNumerals.push(twentyThree); ``` -`romanNumerals` would have the value `['XIX', 'XX', 'XXI', 'XXII', 'XXIII']`. Notice that we can also pass variables, which allows us even greater flexibility in dynamically modifying our array's data. +`romanNumerals` teria os valores `['XIX', 'XX', 'XXI', 'XXII', 'XXIII']`. Note que nós também podemos passar variáveis, as quais nos permitem uma flexibilidade ainda maior na modificação dinâmica dos dados de nosso array. # --instructions-- -We have defined a function, `mixedNumbers`, which we are passing an array as an argument. Modify the function by using `push()` and `unshift()` to add `'I', 2, 'three'` to the beginning of the array and `7, 'VIII', 9` to the end so that the returned array contains representations of the numbers 1-9 in order. +Nos definimos uma função, `mixedNumbers`, na qual estamos passando o array como um argumento. Modifique a função usando `push()` e `unshift()` para adicionar `'1', 2, 'three'` no início do array e `7, 'VIII', 9` ao final para que o array retornado contenha a representação dos números de 1 a 9 em ordem. # --hints-- -`mixedNumbers(["IV", 5, "six"])` should now return `["I", 2, "three", "IV", 5, "six", 7, "VIII", 9]` +`mixedNumbers(["IV", 5, "six"])` agora deve retornar `["I", 2, "three", "IV", 5, "six", 7, "VIII", 9]` ```js assert.deepEqual(mixedNumbers(['IV', 5, 'six']), [ @@ -49,13 +49,13 @@ assert.deepEqual(mixedNumbers(['IV', 5, 'six']), [ ]); ``` -The `mixedNumbers` function should utilize the `push()` method +A função `mixedNumbers` deve usar o método `push()` ```js assert(mixedNumbers.toString().match(/\.push/)); ``` -The `mixedNumbers` function should utilize the `unshift()` method +A função `mixedNumbers` deve usar o método `unshift()` ```js assert(mixedNumbers.toString().match(/\.unshift/)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index ec9575f325..c8e34b93f7 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -1,6 +1,6 @@ --- id: 587d78b3367417b2b2512b11 -title: Add Items Using splice() +title: Adicione Itens Usando splice() challengeType: 1 forumTopicId: 301152 dashedName: add-items-using-splice @@ -8,7 +8,7 @@ dashedName: add-items-using-splice # --description-- -Remember in the last challenge we mentioned that `splice()` can take up to three parameters? Well, you can use the third parameter, comprised of one or more element(s), to add to the array. This can be incredibly useful for quickly switching out an element, or a set of elements, for another. +Se lembra que no último desafio mencionamos que `splice()` pode receber até três parâmetros? Bem, você pode usar o terceiro parâmetro, composto por um ou mais elementos, para adicioná-los ao array. Isso pode ser incrivelmente útil para mudar rapidamente um elemento, ou um conjunto de elementos, para outro. ```js const numbers = [10, 11, 12, 12, 15]; @@ -19,17 +19,17 @@ numbers.splice(startIndex, amountToDelete, 13, 14); console.log(numbers); ``` -The second occurrence of `12` is removed, and we add `13` and `14` at the same index. The `numbers` array would now be `[ 10, 11, 12, 13, 14, 15 ]`. +A segunda ocorrência de `12` é removida, e adicionamos `13` e `14` no mesmo índice. O array `numbers` agora seria `[ 10, 11, 12, 13, 14, 15 ]`. -Here, we begin with an array of numbers. Then, we pass the following to `splice()`: The index at which to begin deleting elements (3), the number of elements to be deleted (1), and the remaining arguments (13, 14) will be inserted starting at that same index. Note that there can be any number of elements (separated by commas) following `amountToDelete`, each of which gets inserted. +Aqui, começamos com um array de números. Em seguida, passamos o seguinte para `splice()`: O índice no qual começar a deletar os elementos (3), o número de elementos a serem deletados (1) e os argumentos restantes (13, 14) serão inseridos com início no mesmo índice. Note que três pode ser qualquer número de elementos (separado por vírgulas) seguindo `amountToDelete`, cada um dos quais são inseridos. # --instructions-- -We have defined a function, `htmlColorNames`, which takes an array of HTML colors as an argument. Modify the function using `splice()` to remove the first two elements of the array and add `'DarkSalmon'` and `'BlanchedAlmond'` in their respective places. +Definimos uma função, `htmlColorNames`, a qual recebe um array de cores HTML como argumento. Modifique a função usando `splice()` para remover os dois primeiros elementos do array e adicionar `'DarkSalmon'` e `'BlanchedAlmond'` em seus respectivos lugares. # --hints-- -`htmlColorNames` should return `["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurquoise", "FireBrick"]` +`htmlColorNames` deve retornar `["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurquoise", "FireBrick"]` ```js assert.deepEqual( @@ -50,19 +50,19 @@ assert.deepEqual( ); ``` -The `htmlColorNames` function should utilize the `splice()` method +A função `htmlColorNames` deve utilizar o método `splice()` ```js assert(/.splice/.test(code)); ``` -You should not use `shift()` or `unshift()`. +Você não deve usar `shift()` ou `unshift()`. ```js assert(!/shift|unshift/.test(code)); ``` -You should not use array bracket notation. +Você não deve usar a notação de colchetes de array. ```js assert(!/\[\d\]\s*=/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index 5bec1202db..cb1a45a9f8 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -1,6 +1,6 @@ --- id: 587d7b7c367417b2b2512b18 -title: Add Key-Value Pairs to JavaScript Objects +title: Adicione Pares de Chave-Valor a objetos JavaScript challengeType: 1 forumTopicId: 301153 dashedName: add-key-value-pairs-to-javascript-objects @@ -8,7 +8,7 @@ dashedName: add-key-value-pairs-to-javascript-objects # --description-- -At their most basic, objects are just collections of key-value pairs. In other words, they are pieces of data (values) mapped to unique identifiers called properties (keys). Take a look at an example: +Em suas formas mais básicas, objetos são apenas coleções de pares de chave-valor. Em outras palavras, eles são pedaços de dados (valores) mapeados para identificadores únicos chamados propriedades (chaves). Dê uma olhada no exemplo: ```js const tekkenCharacter = { @@ -18,19 +18,19 @@ const tekkenCharacter = { }; ``` -The above code defines a Tekken video game character object called `tekkenCharacter`. It has three properties, each of which map to a specific value. If you want to add an additional property, such as "origin", it can be done by assigning `origin` to the object: +O código acima define um objeto de caractere de jogo Tekken chamado `tekkenCharacter`. Tem três propriedades, em que cada uma é mapeada para um valor específico. Se você quer adicionar uma propriedade adicional, como "origin", pode ser feito ao atribuir `origin` ao objeto: ```js tekkenCharacter.origin = 'South Korea'; ``` -This uses dot notation. If you were to observe the `tekkenCharacter` object, it will now include the `origin` property. Hwoarang also had distinct orange hair. You can add this property with bracket notation by doing: +Isso usa notação de ponto. Se você observar o objeto `tekkenCharacter`, agora incluirá a propriedade `origin`. Hwoarang também tinha distintos cabelos laranja. Você pode adicionar essa propriedade com notação de colchetes fazendo: ```js tekkenCharacter['hair color'] = 'dyed orange'; ``` -Bracket notation is required if your property has a space in it or if you want to use a variable to name the property. In the above case, the property is enclosed in quotes to denote it as a string and will be added exactly as shown. Without quotes, it will be evaluated as a variable and the name of the property will be whatever value the variable is. Here's an example with a variable: +A notação de colchete é necessária se sua propriedade tem um espaço nele ou se você deseja usar uma variável para nomear a propriedade. No caso acima, a propriedade está entre aspas para denotá-la como uma string e será adicionada exatamente como mostrada. Sem aspas, ele será avaliado como uma variável e o nome da propriedade será qualquer valor que a variável seja. Aqui está um exemplo com uma variável: ```js const eyes = 'eye color'; @@ -38,7 +38,7 @@ const eyes = 'eye color'; tekkenCharacter[eyes] = 'brown'; ``` -After adding all the examples, the object will look like this: +Após adicionar todos os exemplos, o objeto ficará assim: ```js { @@ -53,35 +53,35 @@ After adding all the examples, the object will look like this: # --instructions-- -A `foods` object has been created with three entries. Using the syntax of your choice, add three more entries to it: `bananas` with a value of `13`, `grapes` with a value of `35`, and `strawberries` with a value of `27`. +O objeto `foods` foi criado com três entradas. Usando a sintaxe de sua escolha, adicione mais três entradas a ele: `bananas` com um valor de `13`, `uvas` com um valor de `35` e `morangos` com um valor de `27`. # --hints-- -`foods` should be an object. +`foods` deve ser um objeto. ```js assert(typeof foods === 'object'); ``` -The `foods` object should have a key `bananas` with a value of `13`. +O objeto `foods` deve ter a chave `bananas` com o valor de `13`. ```js assert(foods.bananas === 13); ``` -The `foods` object should have a key `grapes` with a value of `35`. +O objeto `foods` deve ter a chave `grapes` com o valor de `35`. ```js assert(foods.grapes === 35); ``` -The `foods` object should have a key `strawberries` with a value of `27`. +O objeto `foods` deve ter a chave `strawberries` com o valor de `35`. ```js assert(foods.strawberries === 27); ``` -The key-value pairs should be set using dot or bracket notation. +Os pares de chave-valor devem serem definidos usando a notação de ponto ou de colchetes. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.md index e9a2f2dbb1..e8a672217b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.md @@ -1,6 +1,6 @@ --- id: 587d7b7b367417b2b2512b14 -title: Check For The Presence of an Element With indexOf() +title: Verifique a Presença de um Elemento com indexOf() challengeType: 1 forumTopicId: 301154 dashedName: check-for-the-presence-of-an-element-with-indexof @@ -8,9 +8,9 @@ dashedName: check-for-the-presence-of-an-element-with-indexof # --description-- -Since arrays can be changed, or *mutated*, at any time, there's no guarantee about where a particular piece of data will be on a given array, or if that element even still exists. Luckily, JavaScript provides us with another built-in method, `indexOf()`, that allows us to quickly and easily check for the presence of an element on an array. `indexOf()` takes an element as a parameter, and when called, it returns the position, or index, of that element, or `-1` if the element does not exist on the array. +Já que arrays podem ser alterados, ou *mutadas*, a qualquer momentos, não há garantia de onde um pedaço de dado estará em um determinado array, ou se esse elemento se quer existe. Felizmente, JavaScript nos fornece com outro método embutido, `indexOf()`, que nos permite rapidamente e facilmente checar pela presença de um elemento em um array. `indexOf()` recebe um elemento como parâmetro, e quando chamado, retorna a posição, ou índice, daquele elemento, ou `-1` se o elemento não existe no array. -For example: +Por exemplo: ```js let fruits = ['apples', 'pears', 'oranges', 'peaches', 'pears']; @@ -20,21 +20,21 @@ fruits.indexOf('oranges'); fruits.indexOf('pears'); ``` -`indexOf('dates')` returns `-1`, `indexOf('oranges')` returns `2`, and `indexOf('pears')` returns `1` (the first index at which each element exists). +`indexOf('dates')` retorna `-1`, `indexOf('oranges')` retorna `2` e `indexOf('pears')` retorna `1` (o primeiro índice no qual cada elemento existe). # --instructions-- -`indexOf()` can be incredibly useful for quickly checking for the presence of an element on an array. We have defined a function, `quickCheck`, that takes an array and an element as arguments. Modify the function using `indexOf()` so that it returns `true` if the passed element exists on the array, and `false` if it does not. +`indexOf()` pode ser incrivelmente útil para verificar rapidamente a presença de um elemento em um array. Definimos uma função, `quickCheck`, que recebe um array e um elemento como argumentos. Modifique a função usando `indexOf()` para que retorne `true` se o elemento passado existe no array, e`false` caso não exista. # --hints-- -The `quickCheck` function should return a boolean (`true` or `false`), not a string (`"true"` or `"false"`) +A função `quickCheck` deve retornar um booleano (`true` ou `false`), e não uma string (`"true"` ou `"false"`) ```js assert.isBoolean(quickCheck(['squash', 'onions', 'shallots'], 'mushrooms')); ``` -`quickCheck(["squash", "onions", "shallots"], "mushrooms")` should return `false` +`quickCheck(["squash", "onions", "shallots"], "mushrooms")` deve retornar `false` ```js assert.strictEqual( @@ -43,7 +43,7 @@ assert.strictEqual( ); ``` -`quickCheck(["onions", "squash", "shallots"], "onions")` should return `true` +`quickCheck(["onions", "squash", "shallots"], "onions")` deve retornar `true` ```js assert.strictEqual( @@ -52,19 +52,19 @@ assert.strictEqual( ); ``` -`quickCheck([3, 5, 9, 125, 45, 2], 125)` should return `true` +`quickCheck([3, 5, 9, 125, 45, 2], 125)` deve retornar `true` ```js assert.strictEqual(quickCheck([3, 5, 9, 125, 45, 2], 125), true); ``` -`quickCheck([true, false, false], undefined)` should return `false` +`quickCheck([true, false, false], undefined)` deve retornar `false` ```js assert.strictEqual(quickCheck([true, false, false], undefined), false); ``` -The `quickCheck` function should utilize the `indexOf()` method +A função `quickCheck` deve utilizar o método `indexOf()` ```js assert.notStrictEqual(quickCheck.toString().search(/\.indexOf\(/), -1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index cbc206b8ab..db0e661811 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -1,6 +1,6 @@ --- id: 587d7b7d367417b2b2512b1c -title: Check if an Object has a Property +title: Verifique se um Objeto tem uma Propriedade challengeType: 1 forumTopicId: 301155 dashedName: check-if-an-object-has-a-property @@ -8,22 +8,22 @@ dashedName: check-if-an-object-has-a-property # --description-- -Now we can add, modify, and remove keys from objects. But what if we just wanted to know if an object has a specific property? JavaScript provides us with two different ways to do this. One uses the `hasOwnProperty()` method and the other uses the `in` keyword. If we have an object `users` with a property of `Alan`, we could check for its presence in either of the following ways: +Agora podemos adicionar, modificar e remover as chaves dos objetos. Mas e se apenas quiséssemos saber se um objeto tem uma propriedade específica? O JavaScript nos fornece duas maneiras diferentes de fazer isso. Um usa o método `hasOwnProperty()` e o outro usa a palavra-chave `in`. Se tivermos um objeto `usuários` com uma propriedade de `Alan`, poderíamos verificar a sua presença de qualquer uma das seguintes maneiras: ```js users.hasOwnProperty('Alan'); 'Alan' in users; ``` -Both of these would return `true`. +Ambos esses retornariam `true`. # --instructions-- -Finish writing the function so that it returns true if the object passed to it contains all four names, `Alan`, `Jeff`, `Sarah` and `Ryan` and returns false otherwise. +Termine de escrever a função para que ela retorne verdadeiro se o objeto passado a ela contiver todos os quatro nomes, `Alan`, `Jeff`, `Sarah` e `Ryan` e retorna falso caso contrário. # --hints-- -The `users` object should not be accessed directly +O objeto `users` não deve ser acessado diretamente ```js @@ -31,7 +31,7 @@ assert(code.match(/users/gm).length <= 2) ``` -The `users` object should only contain the keys `Alan`, `Jeff`, `Sarah`, and `Ryan` +O objeto `users` deve conter apenas as chaves `Alan`, `Jeff`, `Sarah` e `Ryan` ```js assert( @@ -43,13 +43,13 @@ assert( ); ``` -The function `isEveryoneHere` should return `true` if `Alan`, `Jeff`, `Sarah`, and `Ryan` are properties on the object passed to it. +A função `isEveryoneHere` deve retornar `true` se `Alan`, `Jeff`, `Sarah`, e `Ryan` forem propriedades do objeto passado como argumento. ```js assert(isEveryoneHere(users) === true); ``` -The function `isEveryoneHere` should return `false` if `Alan` is not a property on the object passed to it. +A função `isEveryoneHere` deve retornar `false` se `Alan` não for uma propriedade do objeto passado como argumento. ```js assert( @@ -60,7 +60,7 @@ assert( ); ``` -The function `isEveryoneHere` should return `false` if `Jeff` is not a property on the object passed to it. +A função `isEveryoneHere` deve retornar `false` se `Jeff` não for uma propriedade no objeto passado como argumento. ```js assert( @@ -71,7 +71,7 @@ assert( ); ``` -The function `isEveryoneHere` should return `false` if `Sarah` is not a property on the object passed to it. +A função `isEveryoneHere` deve retornar `false` se `Sarah` não for uma propriedade do objeto passado como argumento. ```js assert( @@ -82,7 +82,7 @@ assert( ); ``` -The function `isEveryoneHere` should return `false` if `Ryan` is not a property on the object passed to it. +A função `isEveryoneHere` deve retornar `false` se `Ryan` não for uma propriedade do objeto passado como argumento. ```js assert( @@ -119,7 +119,7 @@ let users = { function isEveryoneHere(userObj) { // Only change code below this line - + // Only change code above this line } diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.md index 6cec90e34d..f6e2adb758 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.md @@ -1,6 +1,6 @@ --- id: 587d7b7b367417b2b2512b17 -title: Combine Arrays with the Spread Operator +title: Combinar Arrays com o Operador Spread challengeType: 1 forumTopicId: 301156 dashedName: combine-arrays-with-the-spread-operator @@ -8,7 +8,7 @@ dashedName: combine-arrays-with-the-spread-operator # --description-- -Another huge advantage of the spread operator is the ability to combine arrays, or to insert all the elements of one array into another, at any index. With more traditional syntaxes, we can concatenate arrays, but this only allows us to combine arrays at the end of one, and at the start of another. Spread syntax makes the following operation extremely simple: +Outra grande vantagem do operador spread é a capacidade de combinar arrays, ou para inserir todos os elementos de um array em outro, em qualquer índice. Com sintaxe mais tradicional, podemos concatenar arrays, mas isso só nos permite combinar arrays no final de um e no início de outro. A sintaxe do spread torna a seguinte operação extremamente simples: ```js let thisArray = ['sage', 'rosemary', 'parsley', 'thyme']; @@ -16,23 +16,23 @@ let thisArray = ['sage', 'rosemary', 'parsley', 'thyme']; let thatArray = ['basil', 'cilantro', ...thisArray, 'coriander']; ``` -`thatArray` would have the value `['basil', 'cilantro', 'sage', 'rosemary', 'parsley', 'thyme', 'coriander']`. +`thatArray` teria o valor `['basil', 'cilantro', 'sage', 'rosemary', 'parsley', 'thyme', 'coriander']`. -Using spread syntax, we have just achieved an operation that would have been more complex and more verbose had we used traditional methods. +Usando a sintaxe de spread, acabamos de conseguir uma operação que teria sido mais complexa e mais verbosa se tivéssemos utilizado métodos tradicionais. # --instructions-- -We have defined a function `spreadOut` that returns the variable `sentence`. Modify the function using the spread operator so that it returns the array `['learning', 'to', 'code', 'is', 'fun']`. +Definimos uma função `spreadOut` que retorna a variável `sentença`. Modifique a função usando o operador spread para que ele retorne o array `['learning', 'to', 'code', 'is', 'fun']`. # --hints-- -`spreadOut` should return `["learning", "to", "code", "is", "fun"]` +`spreadOut` deve retornar `["learning", "to", "code", "is", "fun"]` ```js assert.deepEqual(spreadOut(), ['learning', 'to', 'code', 'is', 'fun']); ``` -The `spreadOut` function should utilize spread syntax +A função `spreadOut` deve utilizar a sintaxe spread ```js assert.notStrictEqual(spreadOut.toString().search(/[...]/), -1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index 9029b1b14b..1986a3f918 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -1,6 +1,6 @@ --- id: 587d7b7b367417b2b2512b13 -title: Copy an Array with the Spread Operator +title: Copiar um Array com o Operador Spread challengeType: 1 forumTopicId: 301157 dashedName: copy-an-array-with-the-spread-operator @@ -8,24 +8,24 @@ dashedName: copy-an-array-with-the-spread-operator # --description-- -While `slice()` allows us to be selective about what elements of an array to copy, among several other useful tasks, ES6's new spread operator allows us to easily copy *all* of an array's elements, in order, with a simple and highly readable syntax. The spread syntax simply looks like this: `...` +Enquanto `slice()` nos permite ser seletivo sobre quais elementos de um array copiar, entre várias outras tarefas úteis, o novo operador do spread da ES6 nos permite facilmente copiar *todos* os elementos de um array, em ordem, com uma sintaxe simples e altamente legível. A sintaxe de spread simplesmente se parece com isso: `...` -In practice, we can use the spread operator to copy an array like so: +Na prática, podemos usar o operador "spread" para copiar um array assim: ```js let thisArray = [true, true, undefined, false, null]; let thatArray = [...thisArray]; ``` -`thatArray` equals `[true, true, undefined, false, null]`. `thisArray` remains unchanged and `thatArray` contains the same elements as `thisArray`. +`thatArray` é igual a `[true, true, undefined, false, null]`. `thisArray` permanece inalterado e `thatArray` contém os mesmos elementos que `thisArray`. # --instructions-- -We have defined a function, `copyMachine` which takes `arr` (an array) and `num` (a number) as arguments. The function is supposed to return a new array made up of `num` copies of `arr`. We have done most of the work for you, but it doesn't work quite right yet. Modify the function using spread syntax so that it works correctly (hint: another method we have already covered might come in handy here!). +Definimos uma função, `copyMachine` que recebe `arr` (um array) e `num` (um número) como argumentos. A função deve retornar um novo array composto de `num` cópias de `arr`. Fizemos a maior parte do trabalho para você, mas ainda não funciona muito bem. Modifique a função usando a sintaxe spread para que ela funcione corretamente (dica: outro método já mencionado pode ser útil aqui!). # --hints-- -`copyMachine([true, false, true], 2)` should return `[[true, false, true], [true, false, true]]` +`copyMachine([true, false, true], 2)` deve retornar `[[true, false, true], [true, false, true]]` ```js assert.deepEqual(copyMachine([true, false, true], 2), [ @@ -34,7 +34,7 @@ assert.deepEqual(copyMachine([true, false, true], 2), [ ]); ``` -`copyMachine([1, 2, 3], 5)` should return `[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]` +`copyMachine([1, 2, 3], 5)` deve retornar `[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]` ```js assert.deepEqual(copyMachine([1, 2, 3], 5), [ @@ -46,13 +46,13 @@ assert.deepEqual(copyMachine([1, 2, 3], 5), [ ]); ``` -`copyMachine([true, true, null], 1)` should return `[[true, true, null]]` +`copyMachine([true, true, null], 1)` deve retornar `[[true, true, null]]` ```js assert.deepEqual(copyMachine([true, true, null], 1), [[true, true, null]]); ``` -`copyMachine(["it works"], 3)` should return `[["it works"], ["it works"], ["it works"]]` +`copyMachine(["it works"], 3)` deve retornar `[["it works"], ["it works"], ["it works"]]` ```js assert.deepEqual(copyMachine(['it works'], 3), [ @@ -62,7 +62,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ ]); ``` -The `copyMachine` function should utilize the `spread operator` with array `arr` +A função `copyMachine` deve utilizar o operador `spread` com array `arr` ```js assert(code.match(/\.\.\.arr/)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index 325439ea9a..22c4de90c2 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -1,6 +1,6 @@ --- id: 587d7b7a367417b2b2512b12 -title: Copy Array Items Using slice() +title: Copiar Itens de um Array Usando slice() challengeType: 1 forumTopicId: 301158 dashedName: copy-array-items-using-slice @@ -8,7 +8,7 @@ dashedName: copy-array-items-using-slice # --description-- -The next method we will cover is `slice()`. Rather than modifying an array, `slice()` copies or *extracts* a given number of elements to a new array, leaving the array it is called upon untouched. `slice()` takes only 2 parameters — the first is the index at which to begin extraction, and the second is the index at which to stop extraction (extraction will occur up to, but not including the element at this index). Consider this: +O próximo método que abordaremos é `slice()`. Em vez de modificar um array, `slice()` copia ou *extrai* um determinado número de elementos para um novo array, deixando o array em que o método é chamado inalterado. `slice()` recebe apenas 2 parâmetros — o primeiro é o índice aonde começar a extração e o segundo é o índice no qual parar a extração (extração ocorrerá até, mas não incluso, esse índice). Considere isto: ```js let weatherConditions = ['rain', 'snow', 'sleet', 'hail', 'clear']; @@ -16,17 +16,17 @@ let weatherConditions = ['rain', 'snow', 'sleet', 'hail', 'clear']; let todaysWeather = weatherConditions.slice(1, 3); ``` -`todaysWeather` would have the value `['snow', 'sleet']`, while `weatherConditions` would still have `['rain', 'snow', 'sleet', 'hail', 'clear']`. +`todaysWeather` teria o valor `['snow', 'sleet']`, enquanto `weatherConditions` ainda teria `['rain', 'snow', 'sleet', 'hail', 'clear']`. -In effect, we have created a new array by extracting elements from an existing array. +Assim, criamos um novo array extraindo elementos de um array existente. # --instructions-- -We have defined a function, `forecast`, that takes an array as an argument. Modify the function using `slice()` to extract information from the argument array and return a new array that contains the string elements `warm` and `sunny`. +Definimos uma função, `forecast`, que recebe um array como argumento. Modifique a função usando `slice()` para extrair a informação do array passado como argumento e retorne um novo array contendo os elementos strings `warm` e `sunny`. # --hints-- -`forecast` should return `["warm", "sunny"]` +`forecast` deve retornar `["warm", "sunny"]` ```js assert.deepEqual( @@ -35,7 +35,7 @@ assert.deepEqual( ); ``` -The `forecast` function should utilize the `slice()` method +A função `forecast` deve usar o método `slice()` ```js assert(/\.slice\(/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md index 4f33c93637..ca880e3810 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md @@ -1,6 +1,6 @@ --- id: 587d7b7b367417b2b2512b16 -title: Create complex multi-dimensional arrays +title: Crie array complexo multidimensional challengeType: 1 forumTopicId: 301159 dashedName: create-complex-multi-dimensional-arrays @@ -8,9 +8,9 @@ dashedName: create-complex-multi-dimensional-arrays # --description-- -Awesome! You have just learned a ton about arrays! This has been a fairly high level overview, and there is plenty more to learn about working with arrays, much of which you will see in later sections. But before moving on to looking at Objects, lets take one more look, and see how arrays can become a bit more complex than what we have seen in previous challenges. +Excelente! Você acabou de aprender uma tonelada sobre arrays! Esta foi uma visão geral de nível bastante elevado, e há muito mais para aprender a trabalhar com arrays, muitas das quais você verá em sessões posteriores. Mas antes de passar para a visão de objetos, vamos dar mais uma olhada e ver como é que as matrizes podem tornar-se um pouco mais complexas do que aquilo que vimos em desafios anteriores. -One of the most powerful features when thinking of arrays as data structures, is that arrays can contain, or even be completely made up of other arrays. We have seen arrays that contain arrays in previous challenges, but fairly simple ones. However, arrays can contain an infinite depth of arrays that can contain other arrays, each with their own arbitrary levels of depth, and so on. In this way, an array can very quickly become very complex data structure, known as a multi-dimensional, or nested array. Consider the following example: +Uma das características mais poderosas ao pensar em arrays como estruturas de dados, é que arrays podem conter, ou mesmo ser completamente compostas por outros arrays. Vimos arrays que contêm arrays em desafios anteriores, mas que são bastante simples. No entanto, os arrays podem conter uma profundidade infinita de matrizes que podem conter outras matrizes, cada uma com seus próprios níveis arbitrários de profundidade, e assim por diante. Desta forma, um array pode muito rapidamente se tornar uma estrutura de dados muito complexa, conhecida como array multi-dimensionalou array aninhado. Considere o seguinte exemplo: ```js let nestedArray = [ @@ -31,15 +31,15 @@ let nestedArray = [ ]; ``` -The `deep` array is nested 2 levels deep. The `deeper` arrays are 3 levels deep. The `deepest` arrays are 4 levels, and the `deepest-est?` is 5. +O array `deep` está aninhado com 2 níveis de profundidade. Os arrays `mais profundos` são de 3 níveis de profundidade. Os `arrays` mais profundos são de 4º níveis, e o ainda `mais profundos` é de 5º nível. -While this example may seem convoluted, this level of complexity is not unheard of, or even unusual, when dealing with large amounts of data. However, we can still very easily access the deepest levels of an array this complex with bracket notation: +Embora este exemplo possa parecer complicado, este nível de complexidade não é inédito, ou ainda fora do normal, quando tratando com grandes quantidades de dados. Entretanto, nós ainda podemos facilmente acessar os níveis mais profundos de um array complexo com a notação de colchetes: ```js console.log(nestedArray[2][1][0][0][0]); ``` -This logs the string `deepest-est?`. And now that we know where that piece of data is, we can reset it if we need to: +Isso exibe no console a string `deepest-est?`. Agora que sabemos aonde esse pedaço de dado está, nós podemos redefini-lo se precisarmos: ```js nestedArray[2][1][0][0][0] = 'deeper still'; @@ -47,15 +47,15 @@ nestedArray[2][1][0][0][0] = 'deeper still'; console.log(nestedArray[2][1][0][0][0]); ``` -Now it logs `deeper still`. +Agora ele mostra no console `deeper still`. # --instructions-- -We have defined a variable, `myNestedArray`, set equal to an array. Modify `myNestedArray`, using any combination of strings, numbers, and booleans for data elements, so that it has exactly five levels of depth (remember, the outer-most array is level 1). Somewhere on the third level, include the string `deep`, on the fourth level, include the string `deeper`, and on the fifth level, include the string `deepest`. +Definimos uma variável, `myNestedArray`, definida igual a um array. Modifique `myNestedArray`, usando qualquer combinação de strings, numbers, e booleans para elementos, para que tenha 5 níveis de profundidade (lembre-se, o array mais extremo é de nível 1). Em algum lugar no terceiro nível, inclua a string `deep`, no quarto nível, inclua a string `deeper`, e no quinto nível, inclua a string `deepest`. # --hints-- -`myNestedArray` should contain only numbers, booleans, and strings as data elements +`myNestedArray` deve conter apenas números, booleans e strings como elementos ```js assert.strictEqual( @@ -79,7 +79,7 @@ assert.strictEqual( ); ``` -`myNestedArray` should have exactly 5 levels of depth +`myNestedArray` deve ter exatamente 5 níveis de profundidade ```js assert.strictEqual( @@ -102,7 +102,7 @@ assert.strictEqual( ); ``` -`myNestedArray` should contain exactly one occurrence of the string `deep` on an array nested 3 levels deep +`myNestedArray` deve conter exatamente uma ocorrência da string `deep` no array aninhado de 3 níveis de profundidade ```js assert( @@ -131,7 +131,7 @@ assert( ); ``` -`myNestedArray` should contain exactly one occurrence of the string `deeper` on an array nested 4 levels deep +`myNestedArray` deve conter exatamente uma ocorrência da string `deeper` no array aninhado de 4 níveis de profundidade ```js assert( @@ -160,7 +160,7 @@ assert( ); ``` -`myNestedArray` should contain exactly one occurrence of the string `deepest` on an array nested 5 levels deep +`myNestedArray` deve conter exatamente uma ocorrência da string `deepest` no array aninhado de 5 níveis de profundidade ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/generate-an-array-of-all-object-keys-with-object.keys.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/generate-an-array-of-all-object-keys-with-object.keys.md index df6c8f9996..de8051a09a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/generate-an-array-of-all-object-keys-with-object.keys.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/generate-an-array-of-all-object-keys-with-object.keys.md @@ -1,6 +1,6 @@ --- id: 587d7b7d367417b2b2512b1e -title: Generate an Array of All Object Keys with Object.keys() +title: Gere um Array de Todas as Chaves de Objeto com Object.keys() challengeType: 1 forumTopicId: 301160 dashedName: generate-an-array-of-all-object-keys-with-object-keys @@ -8,15 +8,15 @@ dashedName: generate-an-array-of-all-object-keys-with-object-keys # --description-- -We can also generate an array which contains all the keys stored in an object using the `Object.keys()` method and passing in an object as the argument. This will return an array with strings representing each property in the object. Again, there will be no specific order to the entries in the array. +Também podemos gerar um array o qual contém todas as chaves armazenadas em um objeto usando o método `Object.keys()` e passando um objeto como argumento. Isso retornará um array com strings representando cada propriedade do objeto. Novamente, não terá uma ordem específica para as entradas no array. # --instructions-- -Finish writing the `getArrayOfUsers` function so that it returns an array containing all the properties in the object it receives as an argument. +Termine de escrever a função `getArrayOfUsers` para que retorne um array contendo todas as propriedades do objeto que receber como argumento. # --hints-- -The `users` object should only contain the keys `Alan`, `Jeff`, `Sarah`, and `Ryan` +O objeto `users` deve conter apenas as chaves `Alan`, `Jeff`, `Sarah` e `Ryan` ```js assert( @@ -28,7 +28,7 @@ assert( ); ``` -The `getArrayOfUsers` function should return an array which contains all the keys in the `users` object +A função `getArrayOfUsers` deve retornar um array o qual contém todas as chaves no objeto `users` ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.md index 25a7f5363c..0b77c9bae5 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.md @@ -1,6 +1,6 @@ --- id: 587d7b7b367417b2b2512b15 -title: Iterate Through All an Array's Items Using For Loops +title: Itere Através de Todos os Itens de um Array Usando Laços For challengeType: 1 forumTopicId: 301161 dashedName: iterate-through-all-an-arrays-items-using-for-loops @@ -8,9 +8,9 @@ dashedName: iterate-through-all-an-arrays-items-using-for-loops # --description-- -Sometimes when working with arrays, it is very handy to be able to iterate through each item to find one or more elements that we might need, or to manipulate an array based on which data items meet a certain set of criteria. JavaScript offers several built in methods that each iterate over arrays in slightly different ways to achieve different results (such as `every()`, `forEach()`, `map()`, etc.), however the technique which is most flexible and offers us the greatest amount of control is a simple `for` loop. +Às vezes quando trabalhando com arrays, é muito útil ser capaz de iterar sobre cada item para encontrar um ou mais elementos que podemos precisar, ou para manipular o array baseado em qual item atende a determinado critério. JavaScript oferece diversos métodos embutidos que fazem iteração sobre arrays de formas ligeiramente diferentes para alcançar resultados diferentes (como `every()`, `forEach()`, `map()`, etc.). Porém, a técnica mais flexível e que oferece-nos a maior capacidade de controle é o simples laço `for`. -Consider the following: +Considere o seguinte: ```js function greaterThanTen(arr) { @@ -26,15 +26,15 @@ function greaterThanTen(arr) { greaterThanTen([2, 12, 8, 14, 80, 0, 1]); ``` -Using a `for` loop, this function iterates through and accesses each element of the array, and subjects it to a simple test that we have created. In this way, we have easily and programmatically determined which data items are greater than `10`, and returned a new array, `[12, 14, 80]`, containing those items. +Usando o laço `for`, essa função itera o array e acessa cada elemento do array, e submete-o a um teste simples que nós criamos. Dessa forma, nós determinamos de forma fácil e programática qual item é maior que `10`, e retorna um novo array, `[12, 14, 80]`, contendo esses itens. # --instructions-- -We have defined a function, `filteredArray`, which takes `arr`, a nested array, and `elem` as arguments, and returns a new array. `elem` represents an element that may or may not be present on one or more of the arrays nested within `arr`. Modify the function, using a `for` loop, to return a filtered version of the passed array such that any array nested within `arr` containing `elem` has been removed. +Definimos uma função, `filteredArray`, a qual recebe `arr`, um array aninhado, e `elem` como argumentos, e retornar um novo array. `elem` representa um elemento que pode ou não estar presente em um ou mais dos arrays aninhados dentro de `arr`. Modifique a função, usando o laço `for`, para retornar uma versão filtrada do array recebido tal qual que qualquer array aninhado dentro de `arr` contendo `elem` seja removido. # --hints-- -`filteredArray([[10, 8, 3], [14, 6, 23], [3, 18, 6]], 18)` should return `[[10, 8, 3], [14, 6, 23]]` +`filteredArray([[10, 8, 3], [14, 6, 23], [3, 18, 6]], 18)` deve retornar `[[10, 8, 3], [14, 6, 23]]` ```js assert.deepEqual( @@ -53,7 +53,7 @@ assert.deepEqual( ); ``` -`filteredArray([["trumpets", 2], ["flutes", 4], ["saxophones", 2]], 2)` should return `[["flutes", 4]]` +`filteredArray([["trumpets", 2], ["flutes", 4], ["saxophones", 2]], 2)` deve retornar `[["flutes", 4]]` ```js assert.deepEqual( @@ -69,7 +69,7 @@ assert.deepEqual( ); ``` -`filteredArray([["amy", "beth", "sam"], ["dave", "sean", "peter"]], "peter")` should return `[["amy", "beth", "sam"]]` +`filteredArray([["amy", "beth", "sam"], ["dave", "sean", "peter"]], "peter")` deve retornar `[["amy", "beth", "sam"]]` ```js assert.deepEqual( @@ -84,7 +84,7 @@ assert.deepEqual( ); ``` -`filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3)` should return `[]` +`filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3)` deve retornar `[]` ```js assert.deepEqual( @@ -101,7 +101,7 @@ assert.deepEqual( ); ``` -The `filteredArray` function should utilize a `for` loop +A função `filteredArray` deve usar o laço `for` ```js assert.notStrictEqual(filteredArray.toString().search(/for/), -1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index 5f2b085b6b..faec173aa3 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -1,6 +1,6 @@ --- id: 587d7b7d367417b2b2512b1d -title: Iterate Through the Keys of an Object with a for...in Statement +title: Itere Através das Chaves de um Objeto com a declaração for...in challengeType: 1 forumTopicId: 301162 dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement @@ -8,7 +8,7 @@ dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement # --description-- -Sometimes you may need to iterate through all the keys within an object. This requires a specific syntax in JavaScript called a for...in statement. For our `users` object, this could look like: +Às vezes você pode precisar iterar através de todas as chaves dentro de um objeto. Isso requer uma sintaxe específica no JavaScript chamada de declaração for...in. Para nosso objeto `users`, isso pode se parecer como: ```js for (let user in users) { @@ -16,15 +16,15 @@ for (let user in users) { } ``` -This would log `Alan`, `Jeff`, `Sarah`, and `Ryan` - each value on its own line. +Isso iria exibir no console `Alan`, `Jeff`, `Sarah` e `Ryan` - cada valor em sua própria linha. -In this statement, we defined a variable `user`, and as you can see, this variable was reset during each iteration to each of the object's keys as the statement looped through the object, resulting in each user's name being printed to the console. +Nessa declaração, definimos uma variável `user` e, como você pode ver, essa variável é redefinida durante cada iteração para cada chave do objeto conforme o comando se repete através do objeto, resultando em cada nome de usuário sendo exibido no console. -**NOTE:** Objects do not maintain an ordering to stored keys like arrays do; thus a key's position on an object, or the relative order in which it appears, is irrelevant when referencing or accessing that key. +**Note:** Objetos não mantém uma ordem para as chaves armazenadas como arrays fazem; Portanto a posição de uma chave em um objeto, ou a ordem relativa na qual ela aparece, é irrelevante quando referenciando ou acessando aquela chave. # --instructions-- -We've defined a function `countOnline` which accepts one argument (a users object). Use a for...in statement within this function to loop through the users object passed into the function and return the number of users whose `online` property is set to `true`. An example of a users object which could be passed to `countOnline` is shown below. Each user will have an `online` property with either a `true` or `false` value. +Nós definimos uma função `countOnline` a qual aceita um argumento (um objeto usuário). Use a declaração for...in dentro dessa função para iterar o objeto users passado para a função, e retorne o número de users o qual possuam a propriedade `online` definida como `true`. Um exemplo de um objeto users o qual pode ser passado para `countOnline` é mostrado abaixo. Cada usuário terá a propriedade `online` com um valor `true` ou `false`. ```js { @@ -42,7 +42,7 @@ We've defined a function `countOnline` which accepts one argument (a users objec # --hints-- -The function `countOnline` should use a `for in` statement to iterate through the object keys of the object passed to it. +A função `countOnline` deve usar a instrução `for in` para iterar através das chaves de um objeto passado para ele. ```js assert( @@ -52,19 +52,19 @@ assert( ); ``` -The function `countOnline` should return `1` when the object `{ Alan: { online: false }, Jeff: { online: true }, Sarah: { online: false } }` is passed to it +A função `countOnline` deve retornar `1` quando o objeto `{ Alan: { online: false }, Jeff: { online: true }, Sarah: { online: false } }` for passado para ele ```js assert(countOnline(usersObj1) === 1); ``` -The function `countOnline` should return `2` when the object `{ Alan: { online: true }, Jeff: { online: false }, Sarah: { online: true } }` is passed to it +A função `countOnline` deve retornar `2` quando o objeto `{ Alan: { online: true }, Jeff: { online: false }, Sarah: { online: true } }` for passado para ele ```js assert(countOnline(usersObj2) === 2); ``` -The function `countOnline` should return `0` when the object `{ Alan: { online: false }, Jeff: { online: false }, Sarah: { online: false } }` is passed to it +A função `countOnline` deve retornar `0` quando o objeto `{ Alan: { online: false }, Jeff: { online: false }, Sarah: { online: false } }` for passado para ele ```js assert(countOnline(usersObj3) === 0); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-array-stored-in-an-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-array-stored-in-an-object.md index c3e256070e..98ec79ea11 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-array-stored-in-an-object.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-array-stored-in-an-object.md @@ -1,6 +1,6 @@ --- id: 587d7b7d367417b2b2512b1f -title: Modify an Array Stored in an Object +title: Modifique o Array Armazenado em um Objeto challengeType: 1 forumTopicId: 301163 dashedName: modify-an-array-stored-in-an-object @@ -8,21 +8,21 @@ dashedName: modify-an-array-stored-in-an-object # --description-- -Now you've seen all the basic operations for JavaScript objects. You can add, modify, and remove key-value pairs, check if keys exist, and iterate over all the keys in an object. As you continue learning JavaScript you will see even more versatile applications of objects. Additionally, the Data Structures lessons located in the Coding Interview Prep section of the curriculum also cover the ES6 Map and Set objects, both of which are similar to ordinary objects but provide some additional features. Now that you've learned the basics of arrays and objects, you're fully prepared to begin tackling more complex problems using JavaScript! +Agora você já viu todas as operações básicas para os objetos JavaScript. Você pode adicionar, modificar e remover pares de chave-valor, verifique se a chave existe e itere sobre todas as chaves em um objeto. Conforme continuar aprendendo JavaScript você verá aplicações de objetos ainda mais versáteis. Adicionalmente, as aulas de Estrutura de Dados localizadas na seção Preparação para Entrevista de Codificação do curriculum também cobrem os objetos ES6 Map e Set, ambos são semelhantes a objetos comuns, mas fornecem alguns recursos adicionais. Agora que você aprendeu o básico de arrays e objetos, você está totalmente preparado para começar a resolver problemas mais complexos usando JavaScript! # --instructions-- -Take a look at the object we've provided in the code editor. The `user` object contains three keys. The `data` key contains five keys, one of which contains an array of `friends`. From this, you can see how flexible objects are as data structures. We've started writing a function `addFriend`. Finish writing it so that it takes a `user` object and adds the name of the `friend` argument to the array stored in `user.data.friends` and returns that array. +Dê uma olhada no objeto que fornecemos no editor de código. O objeto `user` contém três chaves. A chave `data` contém 5 chaves, uma delas possui um array de `friends`. A partir disso, você pode ver como objetos são flexíveis assim como estruturas de dados. Nós começamos escrevendo a função `addFriend`. Termine de escrevê-la para que receba um objeto `user` e adicione o nome do argumento `friend` no array armazenado em `user.data.friends` e retorne esse array. # --hints-- -The `user` object should have `name`, `age`, and `data` keys. +O objeto `user` deve ter as chaves `name`, `age` e `data`. ```js assert('name' in user && 'age' in user && 'data' in user); ``` -The `addFriend` function should accept a `user` object and a `friend` string as arguments and add the friend to the array of `friends` in the `user` object. +A função `addFriend` deve aceitar o objeto `user` e a string `friend` como argumentos e adicionar friend ao array `friends` no objeto `user`. ```js assert( @@ -35,7 +35,7 @@ assert( ); ``` -`addFriend(user, "Pete")` should return `["Sam", "Kira", "Tomo", "Pete"]`. +`addFriend(user, "Pete")` deve retornar `["Sam", "Kira", "Tomo", "Pete"]`. ```js assert.deepEqual( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md index 731f95ff6a..4cad8b1242 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md @@ -1,6 +1,6 @@ --- id: 587d7b7c367417b2b2512b19 -title: Modify an Object Nested Within an Object +title: Modifique um Objeto Aninhado Dentro de um Objeto challengeType: 1 forumTopicId: 301164 dashedName: modify-an-object-nested-within-an-object @@ -8,7 +8,7 @@ dashedName: modify-an-object-nested-within-an-object # --description-- -Now let's take a look at a slightly more complex object. Object properties can be nested to an arbitrary depth, and their values can be any type of data supported by JavaScript, including arrays and even other objects. Consider the following: +Agora vamos dar uma olhada em um objeto ligeiramente mais complexo. Propriedades de objeto podem ser aninhadas para uma profundidade arbitrária e os seus valores podem ser de qualquer tipo de dado suportado pelo JavaScript, incluindo arrays e até mesmo objetos. Considere o seguinte: ```js let nestedObject = { @@ -26,7 +26,7 @@ let nestedObject = { }; ``` -`nestedObject` has three properties: `id` (value is a number), `date` (value is a string), and `data` (value is an object with its nested structure). While structures can quickly become complex, we can still use the same notations to access the information we need. To assign the value `10` to the `busy` property of the nested `onlineStatus` object, we use dot notation to reference the property: +`nestedObject` possui três propriedades: `id` (o valor é um número), `date` (o valor é uma string) e `data`(o valor é um objeto com sua estrutura aninhada). Enquanto estruturas podem se tornar rapidamente complexas, nós ainda podemos usar as mesmas notações para acessar as informações que precisamos. Para atribuir o valor `10` para a propriedade `busy` do objeto aninhado `onlineStatus`, nós usamos a notação de ponto para referenciar a propriedade: ```js nestedObject.data.onlineStatus.busy = 10; @@ -34,11 +34,11 @@ nestedObject.data.onlineStatus.busy = 10; # --instructions-- -Here we've defined an object `userActivity`, which includes another object nested within it. Set the value of the `online` key to `45`. +Aqui nós definimos um objeto `userActivity`, o qual inclui outro objeto aninhado dentro dele. Defina o valor da chave `online` para `45`. # --hints-- -`userActivity` should have `id`, `date` and `data` properties. +`userActivity` deve ter as propriedades `id`, `date` e `data`. ```js assert( @@ -46,19 +46,19 @@ assert( ); ``` -`userActivity` should have a `data` key set to an object with keys `totalUsers` and `online`. +`userActivity` deve ter uma chave `data` definida para um objeto com as chaves `totalUsers` e `online`. ```js assert('totalUsers' in userActivity.data && 'online' in userActivity.data); ``` -The `online` property nested in the `data` key of `userActivity` should be set to `45` +A propriedade `online` aninhada na chave `data` de `userActivity` deve ser definida para `45` ```js assert(userActivity.data.online === 45); ``` -The `online` property should be set using dot or bracket notation. +A propriedade `online` deve ser definindo usando a notação de ponto ou de colchetes. ```js assert.strictEqual(code.search(/online: 45/), -1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.md index 4c19f1418d..a4a2f55979 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.md @@ -1,6 +1,6 @@ --- id: 587d78b2367417b2b2512b0f -title: Remove Items from an Array with pop() and shift() +title: Remova Itens de um Array com pop() e shift() challengeType: 1 forumTopicId: 301165 dashedName: remove-items-from-an-array-with-pop-and-shift @@ -8,9 +8,9 @@ dashedName: remove-items-from-an-array-with-pop-and-shift # --description-- -Both `push()` and `unshift()` have corresponding methods that are nearly functional opposites: `pop()` and `shift()`. As you may have guessed by now, instead of adding, `pop()` *removes* an element from the end of an array, while `shift()` removes an element from the beginning. The key difference between `pop()` and `shift()` and their cousins `push()` and `unshift()`, is that neither method takes parameters, and each only allows an array to be modified by a single element at a time. +Tanto `push()` e `unshift()` possuem métodos correspondentes que são quase opostos funcionais: `pop()` e `shift()`. Como você já pode ter adivinhado, em vez de adicionar, `pop()` *remove* um elemento do fim de um array, enquanto `shift()` remove um elemento do início. A diferença chave entre `pop()` e `shift()` e seus primos `push()` e `unshift()`, é que nenhum dos métodos recebe parâmetros, e cada um só permite que seja modificado um elemento de cada vez de um array. -Let's take a look: +Vamos dar uma olhada: ```js let greetings = ['whats up?', 'hello', 'see ya!']; @@ -18,29 +18,29 @@ let greetings = ['whats up?', 'hello', 'see ya!']; greetings.pop(); ``` -`greetings` would have the value `['whats up?', 'hello']`. +`greetings` teria o valor `['whats up?', 'hello']`. ```js greetings.shift(); ``` -`greetings` would have the value `['hello']`. +`greetings` teria o valor `['hello']`. -We can also return the value of the removed element with either method like this: +Nós também podemos retornar o valor do elemento removido com qualquer método dessa forma: ```js let popped = greetings.pop(); ``` -`greetings` would have the value `[]`, and `popped` would have the value `hello`. +`greetings` teria o valor `[]` e `popped` teria o valor `hello`. # --instructions-- -We have defined a function, `popShift`, which takes an array as an argument and returns a new array. Modify the function, using `pop()` and `shift()`, to remove the first and last elements of the argument array, and assign the removed elements to their corresponding variables, so that the returned array contains their values. +Nós definimos uma função, `popShift`, a qual recebe um array como argumento e retorna um novo array. Modifique a função, usando `pop()` e `shift()`, para remover o primeiro e o último elemento do array passado como argumento, e atribua os valores removidos para suas variáveis correspondentes, para que o array retornado contenha seus valores. # --hints-- -`popShift(["challenge", "is", "not", "complete"])` should return `["challenge", "complete"]` +`popShift(["challenge", "is", "not", "complete"])` deve retornar `["challenge", "complete"]` ```js assert.deepEqual(popShift(['challenge', 'is', 'not', 'complete']), [ @@ -49,13 +49,13 @@ assert.deepEqual(popShift(['challenge', 'is', 'not', 'complete']), [ ]); ``` -The `popShift` function should utilize the `pop()` method +A função `popShift` deve utilizar o método `pop()` ```js assert.notStrictEqual(popShift.toString().search(/\.pop\(/), -1); ``` -The `popShift` function should utilize the `shift()` method +A função `popShift` deve utilizar o método `shift()` ```js assert.notStrictEqual(popShift.toString().search(/\.shift\(/), -1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index d1a989882d..c35f6fab91 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -1,6 +1,6 @@ --- id: 587d78b2367417b2b2512b10 -title: Remove Items Using splice() +title: Remova Itens Usando splice() challengeType: 1 forumTopicId: 301166 dashedName: remove-items-using-splice @@ -8,9 +8,9 @@ dashedName: remove-items-using-splice # --description-- -Ok, so we've learned how to remove elements from the beginning and end of arrays using `shift()` and `pop()`, but what if we want to remove an element from somewhere in the middle? Or remove more than one element at once? Well, that's where `splice()` comes in. `splice()` allows us to do just that: **remove any number of consecutive elements** from anywhere in an array. +Ok, então aprendemos como remover elementos do início e do fim de arrays usando `shift()` e `pop()`, mas e se quisermos remover um elemento de algum lugar do meio? Ou remover mais de um elemento de uma vez? Bem, é aí que `splice()` pode ser útil. `splice()` nos permite fazer isso: **remova qualquer número de elementos consecutivos** de qualquer lugar no array. -`splice()` can take up to 3 parameters, but for now, we'll focus on just the first 2. The first two parameters of `splice()` are integers which represent indexes, or positions, of the array that `splice()` is being called upon. And remember, arrays are *zero-indexed*, so to indicate the first element of an array, we would use `0`. `splice()`'s first parameter represents the index on the array from which to begin removing elements, while the second parameter indicates the number of elements to delete. For example: +`splice` pode receber 3 parâmetros, mas por agora, nós focaremos apenas nos 2 primeiros. Os dois primeiros parâmetros de `splice()` são inteiros que representam índices, ou posições, do array do qual o método `splice()` está sendo chamado. E lembre-se, arrays são *indexados a zero*, então para indicar o primeiro elemento do array, usaríamos `0`. O primeiro parâmetro de `splice()` representa o índice no array do qual começar a remover elementos, enquanto o segundo parâmetro indica o número de elementos a serem removidos. Por exemplo: ```js let array = ['today', 'was', 'not', 'so', 'great']; @@ -18,9 +18,9 @@ let array = ['today', 'was', 'not', 'so', 'great']; array.splice(2, 2); ``` -Here we remove 2 elements, beginning with the third element (at index 2). `array` would have the value `['today', 'was', 'great']`. +Aqui nós removemos 2 elementos, começando com o terceiro elemento (no índice 2). `array` teria o valor `['today', 'was', 'great']`. -`splice()` not only modifies the array it's being called on, but it also returns a new array containing the value of the removed elements: +`splice()` não apenas modifica o array do qual está sendo chamado, mas também retorna um novo array contendo os valores dos elementos removidos: ```js let array = ['I', 'am', 'feeling', 'really', 'happy']; @@ -28,15 +28,15 @@ let array = ['I', 'am', 'feeling', 'really', 'happy']; let newArray = array.splice(3, 2); ``` -`newArray` has the value `['really', 'happy']`. +`newArray` tem o valor `['really', 'happy']`. # --instructions-- -We've initialized an array `arr`. Use `splice()` to remove elements from `arr`, so that it only contains elements that sum to the value of `10`. +Iniciamos um array `arr`. Use `splice()` para remover elementos do `arr`, para que apenas contenha elementos que somam ao valor de `10`. # --hints-- -You should not change the original line of `const arr = [2, 4, 5, 1, 7, 5, 2, 1];`. +Você não deve alterar a linha original: `const arr = [2, 4, 5, 1, 7, 5, 2, 1];`. ```js assert( @@ -44,7 +44,7 @@ assert( ); ``` -`arr` should only contain elements that sum to `10`. +`arr` deve conter apenas elementos que somam a `10`. ```js assert.strictEqual( @@ -53,13 +53,13 @@ assert.strictEqual( ); ``` -Your code should utilize the `splice()` method on `arr`. +Seu código deve utilizar o método `splice()` em `arr`. ```js assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); ``` -The splice should only remove elements from `arr` and not add any additional elements to `arr`. +O splice deve remover apenas os elementos de `arr` e não adicionar qualquer elemento adicional para `arr`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.md index 4fdbdbdb29..06560ef688 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.md @@ -1,6 +1,6 @@ --- id: 587d7b7e367417b2b2512b20 -title: Use an Array to Store a Collection of Data +title: Use um Array para Armazenar uma Coleção de Dados challengeType: 1 forumTopicId: 301167 dashedName: use-an-array-to-store-a-collection-of-data @@ -8,16 +8,16 @@ dashedName: use-an-array-to-store-a-collection-of-data # --description-- -The below is an example of the simplest implementation of an array data structure. This is known as a one-dimensional array, meaning it only has one level, or that it does not have any other arrays nested within it. Notice it contains booleans, strings, and numbers, among other valid JavaScript data types: +Abaixo está um exemplo da implementação mais simples de uma estrutura de dados array. Isso é conhecido como array unidimensional, significando que tem apenas 1 nível de profundidade, ou que não possui nenhum outro array aninhado dentro de si. Note que possui booleans, strings e numbers, entre outros tipos de dados do JavaScript válidos: ```js let simpleArray = ['one', 2, 'three', true, false, undefined, null]; console.log(simpleArray.length); ``` -The `console.log` call displays `7`. +A chamada a `console.log` exibe `7`. -All arrays have a length property, which as shown above, can be very easily accessed with the syntax `Array.length`. A more complex implementation of an array can be seen below. This is known as a multi-dimensional array, or an array that contains other arrays. Notice that this array also contains JavaScript objects, which we will examine very closely in our next section, but for now, all you need to know is that arrays are also capable of storing complex objects. +Todos os arrays possuem uma propriedade length, conforme mostrada acima, pode ser muito facilmente acessado com a sintaxe `Array.length`. Uma implementação mais complexa de um array pode ser vista abaixo. Isso é conhecido como um array multidimensional, ou um array que contém outros arrays. Note que esse array também contém objetos JavaScript, os quais examinaremos bem de perto na próxima seção, mas por agora, tudo que você precisa saber é que arrays também são capazes de armazenar objetos complexos. ```js let complexArray = [ @@ -46,35 +46,35 @@ let complexArray = [ # --instructions-- -We have defined a variable called `yourArray`. Complete the statement by assigning an array of at least 5 elements in length to the `yourArray` variable. Your array should contain at least one string, one number, and one boolean. +Definimos uma variável chamada `yourArray`. Complete a instrução atribuindo um array de pelo menos 5 elementos de comprimento à variável para a variável `yourArray`. Seu array deve conter pelo menos um string, um number e um boolean. # --hints-- -`yourArray` should be an array. +`yourArray` deve ser um array. ```js assert.strictEqual(Array.isArray(yourArray), true); ``` -`yourArray` should be at least 5 elements long. +`yourArray` deve ter pelo menos 5 elementos. ```js assert.isAtLeast(yourArray.length, 5); ``` -`yourArray` should contain at least one `boolean`. +`yourArray` deve conter pelo menos um `boolean`. ```js assert(yourArray.filter((el) => typeof el === 'boolean').length >= 1); ``` -`yourArray` should contain at least one `number`. +`yourArray` deve conter pelo menos um `number`. ```js assert(yourArray.filter((el) => typeof el === 'number').length >= 1); ``` -`yourArray` should contain at least one `string`. +`yourArray` deve conter pelo menos um `string`. ```js assert(yourArray.filter((el) => typeof el === 'string').length >= 1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md index 575e41f90a..0a405584bc 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md @@ -1,6 +1,6 @@ --- id: 587d7b7c367417b2b2512b1b -title: Use the delete Keyword to Remove Object Properties +title: Use a Palavra-Chave delete para Remover Propriedades de Objetos challengeType: 1 forumTopicId: 301168 dashedName: use-the-delete-keyword-to-remove-object-properties @@ -8,11 +8,11 @@ dashedName: use-the-delete-keyword-to-remove-object-properties # --description-- -Now you know what objects are and their basic features and advantages. In short, they are key-value stores which provide a flexible, intuitive way to structure data, ***and***, they provide very fast lookup time. Throughout the rest of these challenges, we will describe several common operations you can perform on objects so you can become comfortable applying these useful data structures in your programs. +Agora você sabe o que objetos são, seus recursos básicos e suas vantagens. Resumindo, ele são uma forma de armazenar chave-valor que provê uma forma flexível e intuitiva de estruturar dados, ***e***, eles fornecem um desempenho rápido para acessá-los. Ao longo do resto destes desafios, descreveremos diversas operações que você pode executar em objetos, com a finalidade de torná-lo confortável ao usar essas estruturas de dados úteis em seus programas. -In earlier challenges, we have both added to and modified an object's key-value pairs. Here we will see how we can *remove* a key-value pair from an object. +Nos desafios anteriores, nós adicionamos e modificamos os pares de chave-valor de objetos. Aqui veremos como podemos *remover* uma chave-valor de um obeto. -Let's revisit our `foods` object example one last time. If we wanted to remove the `apples` key, we can remove it by using the `delete` keyword like this: +Vamos revisitar nosso objeto de exemplo `foods` uma última vez. Se quisermos remover a chave `apples`, podemos removê-lo usando a palavra-chave `delete` assim: ```js delete foods.apples; @@ -20,11 +20,11 @@ delete foods.apples; # --instructions-- -Use the delete keyword to remove the `oranges`, `plums`, and `strawberries` keys from the `foods` object. +Use a palavra-chave delete para remover as chaves `oranges`, `plums` e `strawberries` do objeto `foods`. # --hints-- -The `foods` object should only have three keys: `apples`, `grapes`, and `bananas`. +O objeto `foods` deve ter apenas três chaves: `apples`, `grapes` e `bananas`. ```js assert( @@ -35,7 +35,7 @@ assert( ); ``` -The `oranges`, `plums`, and `strawberries` keys should be removed using `delete`. +As chaves `oranges`, `plums` e `strawberries` devem ser removidos usando `delete`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md index f50a82a580..f21deba983 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md @@ -1,6 +1,6 @@ --- id: 56bbb991ad1ed5201cd392ca -title: Access Array Data with Indexes +title: Acessar Array de dados com índices challengeType: 1 videoUrl: 'https://scrimba.com/c/cBZQbTz' forumTopicId: 16158 @@ -9,13 +9,13 @@ dashedName: access-array-data-with-indexes # --description-- -We can access the data inside arrays using indexes. +Podemos acessar os dados dentro de arrays usando indexes. -Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array. Like strings, arrays use zero-based indexing, so the first element in an array has an index of `0`. +Os índices de um array são escritos na mesma notação com colchetes que as strings usam, exceto que em vez de especificar um caractere, eles estão especificando um item do array. Assim como com strings, arrays usam indexação zero-based, de forma que o primeiro elemento de um array possui índice `0`.
        -**Example** +**Exemplo** ```js var array = [50,60,70]; @@ -23,17 +23,17 @@ array[0]; var data = array[1]; ``` -`array[0]` is now `50`, and `data` has the value `60`. +`array[0]` agora é `50` e `data` tem o valor `60`. -**Note:** There shouldn't be any spaces between the array name and the square brackets, like `array [0]`. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code. +**Nota:** Não deve haver nenhum espaço entre o nome do array e os colchetes, como `array [0]`. Embora JavaScript seja capaz de processar isso corretamente, isso pode confundir outros programadores lendo seu código. # --instructions-- -Create a variable called `myData` and set it to equal the first value of `myArray` using bracket notation. +Crie uma variável chamada `myData` e defina-a como igual ao primeiro valor de `myArray` usando notação de colchetes. # --hints-- -The variable `myData` should equal the first value of `myArray`. +A variável `myData` deve ser igual ao primeiro valor de `myArray`. ```js assert( @@ -51,7 +51,7 @@ assert( ); ``` -The data in variable `myArray` should be accessed using bracket notation. +O dado na variável `myArray` deve ser acessado usando notação de colchetes. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md index e56375d274..12f8e49f7d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md @@ -1,6 +1,6 @@ --- id: 56592a60ddddeae28f7aa8e1 -title: Access Multi-Dimensional Arrays With Indexes +title: Acessar Arrays Multidimensionais com Índices challengeType: 1 videoUrl: 'https://scrimba.com/c/ckND4Cq' forumTopicId: 16159 @@ -9,9 +9,9 @@ dashedName: access-multi-dimensional-arrays-with-indexes # --description-- -One way to think of a multi-dimensional array, is as an *array of arrays*. When you use brackets to access your array, the first set of brackets refers to the entries in the outer-most (the first level) array, and each additional pair of brackets refers to the next level of entries inside. +Uma maneira de pensar em um array multi-dimensional é como um *array de arrays*. Quando você usa colchetes para acessar seu array, o primeiro conjunto de colchetes se refere às entradas no array mais exterior (o primeiro nível), e cada par adicional de colchetes refere-se ao próximo nível de entradas interno. -**Example** +**Exemplo** ```js var arr = [ @@ -25,23 +25,23 @@ arr[3][0]; arr[3][0][1]; ``` -`arr[3]` is `[[10, 11, 12], 13, 14]`, `arr[3][0]` is `[10, 11, 12]`, and `arr[3][0][1]` is `11`. +`arr[3]` é `[[10, 11, 12], 13, 14]`, `arr[3][0]` é `[10, 11, 12]`, e `arr[3][0][1]` é `11`. -**Note:** There shouldn't be any spaces between the array name and the square brackets, like `array [0][0]` and even this `array [0] [0]` is not allowed. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code. +**Nota:** Não deve haver nenhum espaço entre o nome do array e os colchetes como `array [0][0]` e até mesmo `array [0] [0]` não é permitido. Embora JavaScript seja capaz de processar isso corretamente, isso pode confundir outros programadores lendo seu código. # --instructions-- -Using bracket notation select an element from `myArray` such that `myData` is equal to `8`. +Utilizando notação de colchetes selecione um elemento de `myArray` de forma que `myData` seja igual a `8`. # --hints-- -`myData` should be equal to `8`. +`myData` deve ser igual a `8`. ```js assert(myData === 8); ``` -You should be using bracket notation to read the correct value from `myArray`. +Você deve usar notação de colchetes para ler o valor correto de `myArray`. ```js assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code))); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md index 3d16e1f9f4..83a555d26b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244cd -title: Accessing Nested Arrays +title: Acessando Arrays Aninhados challengeType: 1 videoUrl: 'https://scrimba.com/c/cLeGDtZ' forumTopicId: 16160 @@ -9,9 +9,9 @@ dashedName: accessing-nested-arrays # --description-- -As we have seen in earlier examples, objects can contain both nested objects and nested arrays. Similar to accessing nested objects, array bracket notation can be chained to access nested arrays. +Como vimos em exemplos anteriores, objetos podem conter tanto objetos aninhados quanto arrays aninhados. Semelhante ao acesso de objetos aninhados, a notação de colchetes pode ser encadeada para se acessar arrays aninhados. -Here is an example of how to access a nested array: +Aqui está um exemplo de como se acessar um array aninhado: ```js var ourPets = [ @@ -36,21 +36,21 @@ ourPets[0].names[1]; ourPets[1].names[0]; ``` -`ourPets[0].names[1]` would be the string `Fluffy`, and `ourPets[1].names[0]` would be the string `Spot`. +`ourPets[0].names[1]` seria a string `Fluffy` e `ourPets[1].names[0]` seria a string `Spot`. # --instructions-- -Using dot and bracket notation, set the variable `secondTree` to the second item in the `trees` list from the `myPlants` object. +Usando a notação de ponto e de colchetes, defina a variável `secondTree` para o segundo item na lista de `trees` do objeto `myPlants`. # --hints-- -`secondTree` should equal the string `pine`. +`secondTree` deve ser igual à string `pine`. ```js assert(secondTree === 'pine'); ``` -Your code should use dot and bracket notation to access `myPlants`. +Seu código deve usar notação de ponto e colchetes para acessar `myPlants`. ```js assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.md index 02d5c6daff..47cf7b1724 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244cc -title: Accessing Nested Objects +title: Acessando Objetos Aninhados challengeType: 1 videoUrl: 'https://scrimba.com/c/cRnRnfa' forumTopicId: 16161 @@ -9,9 +9,9 @@ dashedName: accessing-nested-objects # --description-- -The sub-properties of objects can be accessed by chaining together the dot or bracket notation. +As sub propriedades de objetos podem ser acessadas ao encadear a notação de ponto e de colchetes. -Here is a nested object: +Aqui está um objeto aninhado: ```js var ourStorage = { @@ -30,21 +30,21 @@ ourStorage.cabinet["top drawer"].folder2; ourStorage.desk.drawer; ``` -`ourStorage.cabinet["top drawer"].folder2` would be the string `secrets`, and `ourStorage.desk.drawer` would be the string `stapler`. +`ourStorage.cabinet["top drawer"].folder2` seria a string `secrets` e `ourStorage.desk.drawer` seria a string `stapler`. # --instructions-- -Access the `myStorage` object and assign the contents of the `glove box` property to the `gloveBoxContents` variable. Use dot notation for all properties where possible, otherwise use bracket notation. +Acesse o objeto `myStorage` e atribua o conteúdo da propriedade `glove box` para a variável `gloveBoxContents`. Use notação de ponto para todas as propriedades sempre que possível, caso contrário, use a notação de colchetes. # --hints-- -`gloveBoxContents` should equal the string `maps`. +`gloveBoxContents` deveria ser igual à string `maps`. ```js assert(gloveBoxContents === 'maps'); ``` -Your code should use dot and bracket notation to access `myStorage`. +Seu código deve usar notação de ponto e de colchetes para acessar `myStorage`. ```js assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md index 5716362cf9..d0584a3319 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244c8 -title: Accessing Object Properties with Bracket Notation +title: Acessando Propriedades de Objeto com Notação de Colchetes challengeType: 1 videoUrl: 'https://scrimba.com/c/cBvmEHP' forumTopicId: 16163 @@ -9,11 +9,11 @@ dashedName: accessing-object-properties-with-bracket-notation # --description-- -The second way to access the properties of an object is bracket notation (`[]`). If the property of the object you are trying to access has a space in its name, you will need to use bracket notation. +A segunda forma para acessar as propriedades de um objeto é a notação de colchetes (`[]`). Se a propriedade do objeto que você está tentando acessar possui um espaço no seu nome, você irá precisar usar a notação de colchetes. -However, you can still use bracket notation on object properties without spaces. +No entanto, você ainda pode usar a notação de colchetes nas propriedades dos objetos sem espaços. -Here is a sample of using bracket notation to read an object's property: +Aqui está um exemplo usando a notação de colchetes para ler uma propriedade de um objeto: ```js var myObj = { @@ -26,41 +26,41 @@ myObj['More Space']; myObj["NoSpace"]; ``` -`myObj["Space Name"]` would be the string `Kirk`, `myObj['More Space']` would be the string `Spock`, and `myObj["NoSpace"]` would be the string `USS Enterprise`. +`myObj["Space Name"]` seria a string `Kirk`, `myObj['More Space']` seria a string `Spock` e `myObj["NoSpace"]` seria a string `USS Enterprise`. -Note that property names with spaces in them must be in quotes (single or double). +Note que os nomes das propriedades com espaços neles precisam estar entre aspas (simples ou duplas). # --instructions-- -Read the values of the properties `an entree` and `the drink` of `testObj` using bracket notation and assign them to `entreeValue` and `drinkValue` respectively. +Leia os valores das propriedades `an entree` e `the drink` de `testObj` usando notação de colchetes e atribua-os a `entreeValue` e `drinkValue` respectivamente. # --hints-- -`entreeValue` should be a string +`entreeValue` devem ser uma string ```js assert(typeof entreeValue === 'string'); ``` -The value of `entreeValue` should be the string `hamburger` +O valor de `entreeValue` deve ser a string `hamburger` ```js assert(entreeValue === 'hamburger'); ``` -`drinkValue` should be a string +`drinkValue` deve ser uma string ```js assert(typeof drinkValue === 'string'); ``` -The value of `drinkValue` should be the string `water` +O valor de `drinkValue` deve ser a string `water` ```js assert(drinkValue === 'water'); ``` -You should use bracket notation twice +Você deve usar a notação de colchetes duas vezes ```js assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md index d420ede372..8aa4353886 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244c7 -title: Accessing Object Properties with Dot Notation +title: Acessando Propriedades de Objetos com Notação de Pontos challengeType: 1 videoUrl: 'https://scrimba.com/c/cGryJs8' forumTopicId: 16164 @@ -9,11 +9,11 @@ dashedName: accessing-object-properties-with-dot-notation # --description-- -There are two ways to access the properties of an object: dot notation (`.`) and bracket notation (`[]`), similar to an array. +Existem duas formas para acessar as propriedades de um objeto: notação de ponto (`.`) e notação de colchetes (`[]`), de forma similar a um array. -Dot notation is what you use when you know the name of the property you're trying to access ahead of time. +Notação de ponto é o que você utiliza quando você sabe o nome da propriedade que você está tentando acessar antecipadamente. -Here is a sample of using dot notation (`.`) to read an object's property: +Aqui está um exemplo usando notação de ponto (`.`) para ler uma propriedade do objeto: ```js var myObj = { @@ -24,38 +24,38 @@ var prop1val = myObj.prop1; var prop2val = myObj.prop2; ``` -`prop1val` would have a value of the string `val1`, and `prop2val` would have a value of the string `val2`. +`prop1val` teria o valor `val1`, e `prop2val` teria o valor `val2`. # --instructions-- -Read in the property values of `testObj` using dot notation. Set the variable `hatValue` equal to the object's property `hat` and set the variable `shirtValue` equal to the object's property `shirt`. +Leia os valores de propriedade de `testObj` usando a notação de ponto. Defina a variável `hatValue` igual à propriedade `hat` do objeto e defina a variável `shirtValue` igual à propriedade `shirt` do objeto. # --hints-- -`hatValue` should be a string +`hatValue` deve ser uma string ```js assert(typeof hatValue === 'string'); ``` -The value of `hatValue` should be the string `ballcap` +O valor de `hatValue` deve ser a string `ballcap` ```js assert(hatValue === 'ballcap'); ``` -`shirtValue` should be a string +`shirtValue` deve ser a string ```js assert(typeof shirtValue === 'string'); ``` -The value of `shirtValue` should be the string `jersey` +O valor de `shirtValue` deve ser a string `jersey` ```js assert(shirtValue === 'jersey'); ``` -You should use dot notation twice +Você deve usar notação de ponto duas vezes ```js assert(code.match(/testObj\.\w+/g).length > 1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md index 2ec802ab59..f688dff4ca 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244c9 -title: Accessing Object Properties with Variables +title: Acessando Propriedades de Objetos com Variáveis challengeType: 1 videoUrl: 'https://scrimba.com/c/cnQyKur' forumTopicId: 16165 @@ -9,9 +9,9 @@ dashedName: accessing-object-properties-with-variables # --description-- -Another use of bracket notation on objects is to access a property which is stored as the value of a variable. This can be very useful for iterating through an object's properties or when accessing a lookup table. +Outro uso de notação de colchetes em objetos é para acessar a propriedade a qual está armazenada como o valor de uma variável. Isso pode ser muito útil para iterar através das propriedades de um objeto ou quando acessando uma tabela de pesquisa. -Here is an example of using a variable to access a property: +Aqui está um exemplo de usar uma variável para acessar uma propriedade: ```js var dogs = { @@ -22,9 +22,9 @@ var myBreed = dogs[myDog]; console.log(myBreed); ``` -The string `Doberman` would be displayed in the console. +A string `Doberman` seria exibida no console. -Another way you can use this concept is when the property's name is collected dynamically during the program execution, as follows: +Outra forma de você usar esse conceito é quando o nome da propriedade é coletado dinamicamente, durante a execução do programa, da seguinte forma: ```js var someObj = { @@ -38,47 +38,47 @@ var someProp = propPrefix("Name"); console.log(someObj[someProp]); ``` -`someProp` would have a value of the string `propName`, and the string `John` would be displayed in the console. +`someProp` teria o valor da string `propName` e a string `John` seria exibida no console. -Note that we do *not* use quotes around the variable name when using it to access the property because we are using the *value* of the variable, not the *name*. +Observe que *não* usamos aspas em torno do nome da variável ao usá-la para acessar a propriedade, porque estamos usando o *valor* da variável, e não o *nome*. # --instructions-- -Set the `playerNumber` variable to `16`. Then, use the variable to look up the player's name and assign it to `player`. +Defina a variável `playerNumber` para ser `16`. Então, use a variável para procurar o nome do jogador e atribuí-la a `player`. # --hints-- -`playerNumber` should be a number +`playerNumber` deve ser um número ```js assert(typeof playerNumber === 'number'); ``` -The variable `player` should be a string +A variável `player` deve ser uma string ```js assert(typeof player === 'string'); ``` -The value of `player` should be the string `Montana` +O valor de `player` deve ser a string `Montana` ```js assert(player === 'Montana'); ``` -You should use bracket notation to access `testObj` +Você deve usar a notação de colchetes para acessar `testObj` ```js assert(/testObj\s*?\[.*?\]/.test(code)); ``` -You should not assign the value `Montana` to the variable `player` directly. +Você não deve usar o valor `Montana` diretamente para a variável `player`. ```js assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); ``` -You should be using the variable `playerNumber` in your bracket notation +Você deve estar usando a variável `playerNumber` na sua notação de colchetes ```js assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md index b73a21ef9f..a8270c2235 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md @@ -1,6 +1,6 @@ --- id: 56bbb991ad1ed5201cd392d2 -title: Add New Properties to a JavaScript Object +title: Adicione Novas Propriedades para um Objeto JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cQe38UD' forumTopicId: 301169 @@ -9,23 +9,23 @@ dashedName: add-new-properties-to-a-javascript-object # --description-- -You can add new properties to existing JavaScript objects the same way you would modify them. +Você pode adicionar novas propriedades para um objeto JavaScript existente da mesma forma que você iria modificá-los. -Here's how we would add a `bark` property to `ourDog`: +Aqui está como adicionaríamos uma propriedade `bark` para `ourDog`: ```js ourDog.bark = "bow-wow"; ``` -or +ou ```js ourDog["bark"] = "bow-wow"; ``` -Now when we evaluate `ourDog.bark`, we'll get his bark, `bow-wow`. +Agora, quando acessamos `ourDog.bark`, nós teremos o seu latido, `bow-wow`. -Example: +Exemplo: ```js var ourDog = { @@ -40,17 +40,17 @@ ourDog.bark = "bow-wow"; # --instructions-- -Add a `bark` property to `myDog` and set it to a dog sound, such as "woof". You may use either dot or bracket notation. +Adicione a propriedade `bark` para `myDog` e defina-a para um som de um cachorro, como "woof". Você pode usar tanto notação de ponto quando de colchetes. # --hints-- -You should add the property `bark` to `myDog`. +Você deve adicionar a propriedade `bark` para `myDog`. ```js assert(myDog.bark !== undefined); ``` -You should not add `bark` to the initialization of `myDog`. +Você não deve adicionar `bark` na inicialização de `myDog`. ```js assert(!/bark[^\n]:/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md index 3703a18fb2..7c0622bf02 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md @@ -1,6 +1,6 @@ --- id: cf1111c1c11feddfaeb3bdef -title: Add Two Numbers with JavaScript +title: Adicione Dois Números com JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cM2KBAG' forumTopicId: 16650 @@ -9,33 +9,33 @@ dashedName: add-two-numbers-with-javascript # --description-- -`Number` is a data type in JavaScript which represents numeric data. +`Number` é um tipo de dado em JavaScript o qual representa um dado numérico. -Now let's try to add two numbers using JavaScript. +Agora vamos tentar adicionar dois números usando JavaScript. -JavaScript uses the `+` symbol as an addition operator when placed between two numbers. +JavaScript utiliza o símbolo `+` como um operador de adição quando colocado entre dois números. -**Example:** +**Exemplo:** ```js myVar = 5 + 10; ``` -`myVar` now has the value `15`. +`myVar` agora tem o valor de `15`. # --instructions-- -Change the `0` so that sum will equal `20`. +Modifique o `0` para que a soma seja igual a `20`. # --hints-- -`sum` should equal `20`. +`soma` deve ser igual a `20`. ```js assert(sum === 20); ``` -You should use the `+` operator. +Você deve usar o operador `+`. ```js assert(/\+/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md index dc1c62c6d4..dfff0ad5bc 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244de -title: Adding a Default Option in Switch Statements +title: Adicionando uma Opção Padrão (default) em Instruções Switch challengeType: 1 videoUrl: 'https://scrimba.com/c/c3JvVfg' forumTopicId: 16653 @@ -9,9 +9,9 @@ dashedName: adding-a-default-option-in-switch-statements # --description-- -In a `switch` statement you may not be able to specify all possible values as `case` statements. Instead, you can add the `default` statement which will be executed if no matching `case` statements are found. Think of it like the final `else` statement in an `if/else` chain. +Na instrução `switch` você não deve ser capaz de especificar todos os possíveis valores como instruções `case`. Ao invés disso, você pode adicionar a instrução `default` a qual será executada se nenhuma instrução `case` correspondente for encontrada. Pense nisso como a instrução final `else` em uma cadeia de `if/else`. -A `default` statement should be the last case. +A instrução `default` deve ser o último caso. ```js switch (num) { @@ -30,7 +30,7 @@ switch (num) { # --instructions-- -Write a switch statement to set `answer` for the following conditions: +Escreva a instrução switch para definir `answer` para as seguintes condições: `a` - `apple` `b` - `bird` `c` - `cat` @@ -38,49 +38,49 @@ Write a switch statement to set `answer` for the following conditions: # --hints-- -`switchOfStuff("a")` should return the string `apple` +`switchOfStuff("a")` deve retornar a string `apple` ```js assert(switchOfStuff('a') === 'apple'); ``` -`switchOfStuff("b")` should return the string `bird` +`switchOfStuff("b")` deve retornar a string `bird` ```js assert(switchOfStuff('b') === 'bird'); ``` -`switchOfStuff("c")` should return the string `cat` +`switchOfStuff("c")` deve retornar a string `cat` ```js assert(switchOfStuff('c') === 'cat'); ``` -`switchOfStuff("d")` should return the string `stuff` +`switchOfStuff("d")` deve retornar a string `stuff` ```js assert(switchOfStuff('d') === 'stuff'); ``` -`switchOfStuff(4)` should return the string `stuff` +`switchOfStuff(4)` deve retornar a string `stuff` ```js assert(switchOfStuff(4) === 'stuff'); ``` -You should not use any `if` or `else` statements +Você não deve usar nenhuma das instruções `if` ou `else` ```js assert(!/else/g.test(code) || !/if/g.test(code)); ``` -You should use a `default` statement +Você deve usar a instrução `default` ```js assert(switchOfStuff('string-to-trigger-default-case') === 'stuff'); ``` -You should have at least 3 `break` statements +Você deve ter pelo menos 3 instruções `break` ```js assert(code.match(/break/g).length > 2); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md index 3ca8297b81..2fdcdcbc88 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244ed -title: Appending Variables to Strings +title: Adicionando Variáveis para Strings challengeType: 1 videoUrl: 'https://scrimba.com/c/cbQmZfa' forumTopicId: 16656 @@ -9,9 +9,9 @@ dashedName: appending-variables-to-strings # --description-- -Just as we can build a string over multiple lines out of string literals, we can also append variables to a string using the plus equals (`+=`) operator. +Assim como podemos construir uma string em várias linhas através das strings literais, nós também podemos adicionar as variáveis para a string usando o operador mais igual (`+=`). -Example: +Exemplo: ```js var anAdjective = "awesome!"; @@ -19,21 +19,21 @@ var ourStr = "freeCodeCamp is "; ourStr += anAdjective; ``` -`ourStr` would have the value `freeCodeCamp is awesome!`. +`ourStr` teria o valor `freeCodeCamp is awesome!`. # --instructions-- -Set `someAdjective` to a string of at least 3 characters and append it to `myStr` using the `+=` operator. +Defina `someAdjective` para uma string de pelo menos 3 caracteres e adicione para `myStr` usando o operador `+=`. # --hints-- -`someAdjective` should be set to a string at least 3 characters long. +`someAdjective` deve ser definida para uma string de pelo menos o tamanho de 3 caracteres. ```js assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2); ``` -You should append `someAdjective` to `myStr` using the `+=` operator. +Você deve adicionar `someAdjective` para `myStr` usando o operador `+=`. ```js assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md index ad5a0371ab..66ea888a45 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md @@ -1,6 +1,6 @@ --- id: 5ee127a03c3b35dd45426493 -title: Assigning the Value of One Variable to Another +title: Atribua o Valor de Uma Variável para Outra challengeType: 1 videoUrl: '' forumTopicId: 418265 @@ -9,7 +9,7 @@ dashedName: assigning-the-value-of-one-variable-to-another # --description-- -After a value is assigned to a variable using the assignment operator, you can assign the value of that variable to another variable using the assignment operator. +Após um valor ser atribuído para uma variável usando o operador de atribuição, você pode atribuir o valor daquela variável para outra variável usando o operador de atribuição. ```js var myVar; @@ -18,27 +18,27 @@ var myNum; myNum = myVar; ``` -The above declares a `myVar` variable with no value, then assigns it the value `5`. Next, a variable named `myNum` is declared with no value. Then, the contents of `myVar` (which is `5`) is assigned to the variable `myNum`. Now, `myNum` also has the value of `5`. +O código acima declara uma variável `myVar` sem valor, e então atribui a ela o valor `5`. Em seguida, uma variável chamada `myNum` é declarada sem valor. Em seguida, o conteúdo de `myVar` (o qual é `5`) é atribuído para a variável `myNum`. Agora, `myNum` também possui o valor de `5`. # --instructions-- -Assign the contents of `a` to variable `b`. +Atribua o conteúdo de `a` para a variável `b`. # --hints-- -You should not change code above the specified comment. +Você não deve alterar o código acima do comentário especificado. ```js assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code)); ``` -`b` should have a value of `7`. +`b` deve ter um valor de `7`. ```js assert(typeof b === 'number' && b === 7); ``` -`a` should be assigned to `b` with `=`. +`a` deve ser atribuído para `b` com `=`. ```js assert(/b\s*=\s*a\s*/g.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md index cfdf53c228..4e9f264b0e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244c3 -title: Assignment with a Returned Value +title: Atribuição com o Valor Retornado challengeType: 1 videoUrl: 'https://scrimba.com/c/ce2pEtB' forumTopicId: 16658 @@ -9,29 +9,29 @@ dashedName: assignment-with-a-returned-value # --description-- -If you'll recall from our discussion of [Storing Values with the Assignment Operator](/learn/javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator), everything to the right of the equal sign is resolved before the value is assigned. This means we can take the return value of a function and assign it to a variable. +Se você se lembrar de nossa discussão sobre [Armazenar valores com o Operador de Atribuição](/learn/javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator), tudo à direita do sinal de igual é resolvido antes do valor ser atribuído. Isso significa que podemos pegar o valor de retorno de uma função e atribuí-la a uma variável. -Assume we have pre-defined a function `sum` which adds two numbers together, then: +Assuma que temos uma função pré-definida chamada `sum` a qual adiciona dois números, depois: ```js ourSum = sum(5, 12); ``` -will call `sum` function, which returns a value of `17` and assigns it to `ourSum` variable. +chamará a função `sum`, a qual retorna o valor `17` e então atribui este valor à variável `ourSum`. # --instructions-- -Call the `processArg` function with an argument of `7` and assign its return value to the variable `processed`. +Chame a função `processArg` com um argumento de `7` e atribui o retorno do seu valor para a variável `processed`. # --hints-- -`processed` should have a value of `2` +`processed` deve ter o valor `2` ```js assert(processed === 2); ``` -You should assign `processArg` to `processed` +Você deve atribuir `processArg` para `processed` ```js assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md index b67d8c4d52..c6a7a93c88 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md @@ -1,6 +1,6 @@ --- id: 56bbb991ad1ed5201cd392d0 -title: Build JavaScript Objects +title: Construa Objetos JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cWGkbtd' forumTopicId: 16769 @@ -9,13 +9,13 @@ dashedName: build-javascript-objects # --description-- -You may have heard the term `object` before. +Você talvez tenha ouvido o termo `objeto` antes. -Objects are similar to `arrays`, except that instead of using indexes to access and modify their data, you access the data in objects through what are called `properties`. +Objetos são similares a `arrays`, exceto que, ao invés de usar índices para acessar e modificar seus dados, você acessa os dados em objetos através do que se chama `propriedades`. -Objects are useful for storing data in a structured way, and can represent real world objects, like a cat. +Objetos são úteis para armazenar dados de forma estruturada e podem representar objetos do mundo real, como um gato. -Here's a sample cat object: +Aqui está um exemplo de objeto gato: ```js var cat = { @@ -26,7 +26,7 @@ var cat = { }; ``` -In this example, all the properties are stored as strings, such as - `name`, `legs`, and `tails`. However, you can also use numbers as properties. You can even omit the quotes for single-word string properties, as follows: +Neste exemplo, todas as propriedades são armazenadas como strings, como - `name`, `legs`e `tails`. Porém, você também pode usar números como propriedades. Você pode até omitir as aspas para propriedades de string com uma única palavra, da seguinte forma: ```js var anotherObject = { @@ -36,17 +36,17 @@ var anotherObject = { }; ``` -However, if your object has any non-string properties, JavaScript will automatically typecast them as strings. +No entanto, se seu objeto tem quaisquer propriedades que não seja string, o JavaScript irá automaticamente definir seus tipos como strings. # --instructions-- -Make an object that represents a dog called `myDog` which contains the properties `name` (a string), `legs`, `tails` and `friends`. +Faça um objeto que representa um cachorro chamado `myDog` que contém as propriedades `name` (uma string), `legs`, `tails` e `friends`. -You can set these object properties to whatever values you want, as long as `name` is a string, `legs` and `tails` are numbers, and `friends` is an array. +Você pode definir essas propriedades do objeto para os valores que deseja, contanto que `name` seja uma string, `legs` e `tails` são números, e `friends` é um array. # --hints-- -`myDog` should contain the property `name` and it should be a `string`. +`myDog` deve conter a propriedade `name` e deve ser uma `string`. ```js assert( @@ -64,7 +64,7 @@ assert( ); ``` -`myDog` should contain the property `legs` and it should be a `number`. +`myDog` deve conter a propriedade `name` e deve ser uma `string`. ```js assert( @@ -82,7 +82,7 @@ assert( ); ``` -`myDog` should contain the property `tails` and it should be a `number`. +`myDog` deve conter a propriedade `tails` e deve ser um `número`. ```js assert( @@ -100,7 +100,7 @@ assert( ); ``` -`myDog` should contain the property `friends` and it should be an `array`. +`myDog` deve conter a propriedade `friends` e deve ser um `array`. ```js assert( @@ -118,7 +118,7 @@ assert( ); ``` -`myDog` should only contain all the given properties. +`myDog` deve conter apenas todas as propriedades fornecidas. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md index 608723120c..9877f613e0 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244dc -title: Chaining If Else Statements +title: Encadeando Instruções If Else challengeType: 1 videoUrl: 'https://scrimba.com/c/caeJgsw' forumTopicId: 16772 @@ -9,7 +9,7 @@ dashedName: chaining-if-else-statements # --description-- -`if/else` statements can be chained together for complex logic. Here is pseudocode of multiple chained `if` / `else if` statements: +`if/else` instruções podem ser encadeadas por uma lógica complexa. Aqui está o pseudocódigo de várias instruções encadeadas `if` / `else`: ```js if (condition1) { @@ -26,89 +26,89 @@ if (condition1) { # --instructions-- -Write chained `if`/`else if` statements to fulfill the following conditions: +Escreva instruções encadeadas `if`/`else` para atender as seguintes condições: -`num < 5` - return `Tiny` -`num < 10` - return `Small` -`num < 15` - return `Medium` -`num < 20` - return `Large` -`num >= 20` - return `Huge` +`num < 5` - retorna `Tiny` +`num < 10` - retorna `Small` +`num < 15` - retorna `Medium` +`num < 20` - retorna `Large` +`num >= 20` - retorna `Huge` # --hints-- -You should have at least four `else` statements +Você deve ter pelo menos quatro instruções `else` ```js assert(code.match(/else/g).length > 3); ``` -You should have at least four `if` statements +Você deve ter pelo menos quatro instruções `if` ```js assert(code.match(/if/g).length > 3); ``` -You should have at least one `return` statement +Você deve ter pelo menos um comando `return` ```js assert(code.match(/return/g).length >= 1); ``` -`testSize(0)` should return the string `Tiny` +`testSize(0)` deve retornar a string `Tiny` ```js assert(testSize(0) === 'Tiny'); ``` -`testSize(4)` should return the string `Tiny` +`testSize(4)` deve retornar a string `Tiny` ```js assert(testSize(4) === 'Tiny'); ``` -`testSize(5)` should return the string `Small` +`testSize(5)` deve retornar a string `Small` ```js assert(testSize(5) === 'Small'); ``` -`testSize(8)` should return the string `Small` +`testSize(8)` deve retornar a string `Small` ```js assert(testSize(8) === 'Small'); ``` -`testSize(10)` should return the string `Medium` +`testSize(10)` deve retornar a string `Medium` ```js assert(testSize(10) === 'Medium'); ``` -`testSize(14)` should return the string `Medium` +`testSize(14)` deve retornar a string `Medium` ```js assert(testSize(14) === 'Medium'); ``` -`testSize(15)` should return the string `Large` +`testSize(15)` deve retornar a string `Large` ```js assert(testSize(15) === 'Large'); ``` -`testSize(17)` should return the string `Large` +`testSize(17)` deve retornar a string `Large` ```js assert(testSize(17) === 'Large'); ``` -`testSize(20)` should return the string `Huge` +`testSize(20)` deve retornar a string `Huge` ```js assert(testSize(20) === 'Huge'); ``` -`testSize(25)` should return the string `Huge` +`testSize(25)` deve retornar a string `Huge` ```js assert(testSize(25) === 'Huge'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index a5f59ff63f..68d7afcd4d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -1,6 +1,6 @@ --- id: bd7123c9c441eddfaeb4bdef -title: Comment Your JavaScript Code +title: Comente seu código JavaScript challengeType: 1 removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' @@ -10,38 +10,38 @@ dashedName: comment-your-javascript-code # --description-- -Comments are lines of code that JavaScript will intentionally ignore. Comments are a great way to leave notes to yourself and to other people who will later need to figure out what that code does. +Comentários são linhas de código que JavaScript irá intencionalmente ignorar. Os comentários são uma ótima maneira de deixar anotações para você mesmo e para outras pessoas que mais tarde precisarão descobrir o que esse código faz. -There are two ways to write comments in JavaScript: +Existem duas maneiras de escrever comentários em JavaScript: -Using `//` will tell JavaScript to ignore the remainder of the text on the current line. This is an in-line comment: +Usando `//` dirá ao JavaScript para ignorar o resto do texto na linha atual. Isso é um comentário de uma linha: ```js // This is an in-line comment. ``` -You can make a multi-line comment beginning with `/*` and ending with `*/`. This is a multi-line comment: +Você pode fazer um comentário de mais de uma linha, começando com `/*` e terminando com `*/`. Este é um comentário em várias linha: ```js /* This is a multi-line comment */ ``` -**NOTE:** As you write code, you should regularly add comments to clarify the function of parts of your code. Good commenting can help communicate the intent of your code—both for others *and* for your future self. +**NOTA:** À medida que você escreve código, você deve adicionar comentários regularmente, para esclarecer a função de partes do seu código. Um bom comentário pode ajudar a comunicar a intenção do seu código — tanto para os outros *quanto* para você mesmo no futuro. # --instructions-- -Try creating one of each type of comment. +Tente criar cada um dos tipos de comentários. # --hints-- -You should create a `//` style comment that contains at least five letters. +Você deve criar um comentário de uma linha (`//`) que contenha pelo menos cinco letras. ```js assert(code.match(/(\/\/)...../g)); ``` -You should create a `/* */` style comment that contains at least five letters. +Você deve criar um comentário de várias linhas (`/* */`) que contenha pelo menos cinco letras. ```js assert(code.match(/(\/\*)([^\/]{5,})(?=\*\/)/gm)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index 7bd40b179f..f6a28631f2 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244d0 -title: Comparison with the Equality Operator +title: Comparação com o Operador de Igualdade challengeType: 1 videoUrl: 'https://scrimba.com/c/cKyVMAL' forumTopicId: 16784 @@ -9,9 +9,9 @@ dashedName: comparison-with-the-equality-operator # --description-- -There are many comparison operators in JavaScript. All of these operators return a boolean `true` or `false` value. +Há muitos operadores de comparação em JavaScript. Todos esses operadores retornam um valor booleano `true` ou `false`. -The most basic operator is the equality operator `==`. The equality operator compares two values and returns `true` if they're equivalent or `false` if they are not. Note that equality is different from assignment (`=`), which assigns the value on the right of the operator to a variable on the left. +O operador mais básico é o operador de igualdade `==`. O operador de igualdade compara dois valores e retorna `true` se eles são equivalentes ou `false` se não são. Observe que a igualdade é diferente de atribuição (`=`), que atribui o valor à direita do operador para uma variável à esquerda. ```js function equalityTest(myVal) { @@ -22,7 +22,7 @@ function equalityTest(myVal) { } ``` -If `myVal` is equal to `10`, the equality operator returns `true`, so the code in the curly braces will execute, and the function will return `Equal`. Otherwise, the function will return `Not Equal`. In order for JavaScript to compare two different data types (for example, `numbers` and `strings`), it must convert one type to another. This is known as Type Coercion. Once it does, however, it can compare terms as follows: +Se `myVal` é igual a `10`, o operador de igualdade retorna `true`, assim o código nas chaves será executado e a função retornará `Equal`. Caso contrário, a função retornará `Not Equal`. Para que JavaScript possa comparar dois tipos de dados diferentes (por exemplo, `números` e `strings`), deve converter um tipo para outro. Isto é conhecido como Coerção do Tipo (casting ou type coercion). No entanto, uma vez que o faça, pode comparar os termos da seguinte forma: ```js 1 == 1 @@ -31,33 +31,33 @@ If `myVal` is equal to `10`, the equality operator returns `true`, so the code i "3" == 3 ``` -In order, these expressions would evaluate to `true`, `false`, `true`, and `true`. +Em ordem, essas expressões seriam avaliadas à `true`, `false`, `true` e `true`. # --instructions-- -Add the equality operator to the indicated line so that the function will return the string `Equal` when `val` is equivalent to `12`. +Adicione o operador de igualdade à linha indicada para que a função retorne a string `Equal` quando `val` for equivalente a `12`. # --hints-- -`testEqual(10)` should return the string `Not Equal` +`testEqual(10)` deve retornar a string `Not Equal` ```js assert(testEqual(10) === 'Not Equal'); ``` -`testEqual(12)` should return the string `Equal` +`testEqual(12)` deve retornar a string `Equal` ```js assert(testEqual(12) === 'Equal'); ``` -`testEqual("12")` should return the string `Equal` +`testEqual("12")` deve retornar a string `Equal` ```js assert(testEqual('12') === 'Equal'); ``` -You should use the `==` operator +Você deve utilizar o operador `==` ```js assert(code.match(/==/g) && !code.match(/===/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index 63f28cd07a..188b9329d5 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244d4 -title: Comparison with the Greater Than Operator +title: Comparação com o Operador Maior Que challengeType: 1 videoUrl: 'https://scrimba.com/c/cp6GbH4' forumTopicId: 16786 @@ -9,11 +9,11 @@ dashedName: comparison-with-the-greater-than-operator # --description-- -The greater than operator (`>`) compares the values of two numbers. If the number to the left is greater than the number to the right, it returns `true`. Otherwise, it returns `false`. +O operador maior que (`>`) compara os valores de dois números. Se o número para a esquerda for maior que o número à direita, ele retorna `true`. Caso contrário, ele retorna `false`. -Like the equality operator, the greater than operator will convert data types of values while comparing. +Tal como o operador de igualdade, o operador maior que converterá os tipos de dados de valores enquanto compara. -**Examples** +**Exemplos** ```js 5 > 3 @@ -22,57 +22,57 @@ Like the equality operator, the greater than operator will convert data types of '1' > 9 ``` -In order, these expressions would evaluate to `true`, `true`, `false`, and `false`. +Em ordem, essas expressões seriam iguais à `true`, `false`, `true` e `true`. # --instructions-- -Add the greater than operator to the indicated lines so that the return statements make sense. +Adicione o operador maior que para indicar as linhas indicadas para que as instruções de retorno façam sentido. # --hints-- -`testGreaterThan(0)` should return the string `10 or Under` +`testGreaterThan(0)` deve retornar a string `10 or Under` ```js assert(testGreaterThan(0) === '10 or Under'); ``` -`testGreaterThan(10)` should return the string `10 or Under` +`testGreaterThan(10)` deve retornar a string `10 or Under` ```js assert(testGreaterThan(10) === '10 or Under'); ``` -`testGreaterThan(11)` should return the string `Over 10` +`testGreaterThan(11)` deve retornar a string `Over 10` ```js assert(testGreaterThan(11) === 'Over 10'); ``` -`testGreaterThan(99)` should return the string `Over 10` +`testGreaterThan(99)` deve retornar a string `Over 10` ```js assert(testGreaterThan(99) === 'Over 10'); ``` -`testGreaterThan(100)` should return the string `Over 10` +`testGreaterThan(100)` deve retornar a string `Over 10` ```js assert(testGreaterThan(100) === 'Over 10'); ``` -`testGreaterThan(101)` should return the string `Over 100` +`testGreaterThan(101)` deve retornar a string `Over 100` ```js assert(testGreaterThan(101) === 'Over 100'); ``` -`testGreaterThan(150)` should return the string `Over 100` +`testGreaterThan(150)` deve retornar a string `Over 100` ```js assert(testGreaterThan(150) === 'Over 100'); ``` -You should use the `>` operator at least twice +Você deve usar o operador `>` pelo menos duas vezes ```js assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index a4933c2f84..3b54e80c5f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244d5 -title: Comparison with the Greater Than Or Equal To Operator +title: Comparação com o Operador Maior ou Igual challengeType: 1 videoUrl: 'https://scrimba.com/c/c6KBqtV' forumTopicId: 16785 @@ -9,11 +9,11 @@ dashedName: comparison-with-the-greater-than-or-equal-to-operator # --description-- -The greater than or equal to operator (`>=`) compares the values of two numbers. If the number to the left is greater than or equal to the number to the right, it returns `true`. Otherwise, it returns `false`. +O operador maior ou igual que (`>`) compara os valores de dois números. Se o número à esquerda é maior ou igual ao número à direita, ele retorna `verdadeiro`. Caso contrário, ele retornará `false`. -Like the equality operator, the greater than or equal to operator will convert data types while comparing. +Tal como o operador de igualdade, o operador maior que converterá os tipos de dados de valores enquanto compara. -**Examples** +**Exemplos** ```js 6 >= 6 @@ -22,57 +22,57 @@ Like the equality operator, the greater than or equal to operator will convert d '7' >= 9 ``` -In order, these expressions would evaluate to `true`, `true`, `false`, and `false`. +Em ordem, essas expressões seriam iguais à `true`, `true`, `false` e `false`. # --instructions-- -Add the greater than or equal to operator to the indicated lines so that the return statements make sense. +Adicione o operador maior ou igual que para indicar as linhas indicadas para que as instruções de retorno façam sentido. # --hints-- -`testGreaterOrEqual(0)` should return the string `Less than 10` +`testGreaterOrEqual(0)` deve retornar a string `Less than 10` ```js assert(testGreaterOrEqual(0) === 'Less than 10'); ``` -`testGreaterOrEqual(9)` should return the string `Less than 10` +`testGreaterOrEqual(9)` deve retornar a string `Less than 10` ```js assert(testGreaterOrEqual(9) === 'Less than 10'); ``` -`testGreaterOrEqual(10)` should return the string `10 or Over` +`testGreaterOrEqual(10)` deve retornar a string `10 or Over` ```js assert(testGreaterOrEqual(10) === '10 or Over'); ``` -`testGreaterOrEqual(11)` should return the string `10 or Over` +`testGreaterOrEqual(11)` deve retornar a string `10 or Over` ```js assert(testGreaterOrEqual(11) === '10 or Over'); ``` -`testGreaterOrEqual(19)` should return the string `10 or Over` +`testGreaterOrEqual(19)` deve retornar a string `10 or Over` ```js assert(testGreaterOrEqual(19) === '10 or Over'); ``` -`testGreaterOrEqual(100)` should return the string `20 or Over` +`testGreaterOrEqual(100)` deve retornar a string `20 or Over` ```js assert(testGreaterOrEqual(100) === '20 or Over'); ``` -`testGreaterOrEqual(21)` should return the string `20 or Over` +`testGreaterOrEqual(21)` deve retornar a string `20 or Over` ```js assert(testGreaterOrEqual(21) === '20 or Over'); ``` -You should use the `>=` operator at least twice +Você deve usar o operador `>=` pelo menos duas vezes ```js assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index 6b303c3517..df5d773917 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244d2 -title: Comparison with the Inequality Operator +title: Comparação com o operador de desigualdade challengeType: 1 videoUrl: 'https://scrimba.com/c/cdBm9Sr' forumTopicId: 16787 @@ -9,9 +9,9 @@ dashedName: comparison-with-the-inequality-operator # --description-- -The inequality operator (`!=`) is the opposite of the equality operator. It means not equal and returns `false` where equality would return `true` and *vice versa*. Like the equality operator, the inequality operator will convert data types of values while comparing. +O operador de desigualdade (`!=`) é o oposto do operador de igualdade. Significa que não é igual e retorna `falso` onde a igualdade retornaria `verdadeiro` e *vice-versa*. Tal como o operador de igualdade, o operador de desigualdade converterá os tipos de dados de valores enquanto compara. -**Examples** +**Exemplos** ```js 1 != 2 @@ -21,45 +21,45 @@ The inequality operator (`!=`) is the opposite of the equality operator. It mean 0 != false ``` -In order, these expressions would evaluate to `true`, `false`, `false`, `false`, and `false`. +Em ordem, essas expressões seriam iguais à `true`, `false`, `false`, `false` e `false`. # --instructions-- -Add the inequality operator `!=` in the `if` statement so that the function will return the string `Not Equal` when `val` is not equivalent to `99` +Adicione o operador de desigualdade `!=` na instrução `if` para que a função retorne a string `Not Equal` quando `val` não for equivalente a `99` # --hints-- -`testNotEqual(99)` should return the string `Equal` +`testNotEqual(99)` deve retornar a string `Equal` ```js assert(testNotEqual(99) === 'Equal'); ``` -`testNotEqual("99")` should return the string `Equal` +`testNotEqual("99")` deve retornar a string `Equal` ```js assert(testNotEqual('99') === 'Equal'); ``` -`testNotEqual(12)` should return the string `Not Equal` +`testNotEqual(12)` deve retornar a string `Not Equal` ```js assert(testNotEqual(12) === 'Not Equal'); ``` -`testNotEqual("12")` should return the string `Not Equal` +`testNotEqual("12")` deve retornar a string `Not Equal` ```js assert(testNotEqual('12') === 'Not Equal'); ``` -`testNotEqual("bob")` should return the string `Not Equal` +`testNotEqual("bob")` deve retornar a string `Not Equal` ```js assert(testNotEqual('bob') === 'Not Equal'); ``` -You should use the `!=` operator +Você deve usar o operador `!=` ```js assert(code.match(/(?!!==)!=/)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 578b5b80ee..942fa289b2 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244d6 -title: Comparison with the Less Than Operator +title: Comparação com o Operador Menor Que challengeType: 1 videoUrl: 'https://scrimba.com/c/cNVRWtB' forumTopicId: 16789 @@ -9,9 +9,9 @@ dashedName: comparison-with-the-less-than-operator # --description-- -The less than operator (`<`) compares the values of two numbers. If the number to the left is less than the number to the right, it returns `true`. Otherwise, it returns `false`. Like the equality operator, the less than operator converts data types while comparing. +O operador menor que (`<`) compara os valores de dois números. Se o número a esquerda for menos que o número à direita, retornará `true`. Caso contrário, retorna `false`. Assim como o operador de igualdade, o operador menor que converte os tipos de dados enquando compara. -**Examples** +**Exemplos** ```js 2 < 5 @@ -21,51 +21,51 @@ The less than operator (`<`) compares the values of two numbers. If the number t '8' < 4 ``` -In order, these expressions would evaluate to `true`, `true`, `false`, `false`, and `false`. +Em ordem, essas expressões seriam igual à `true`, `true`, `false`, `false` e `false`. # --instructions-- -Add the less than operator to the indicated lines so that the return statements make sense. +Adicione o operador menor que para indicar as linhas para que a instrução de retorno faça sentido. # --hints-- -`testLessThan(0)` should return the string `Under 25` +`testLessThan(0)` deve retornar a string `Under 25` ```js assert(testLessThan(0) === 'Under 25'); ``` -`testLessThan(24)` should return the string `Under 25` +`testLessThan(24)` deve retornar a string `Under 25` ```js assert(testLessThan(24) === 'Under 25'); ``` -`testLessThan(25)` should return the string `Under 55` +`testLessThan(25)` deve retornar a string `Under 55` ```js assert(testLessThan(25) === 'Under 55'); ``` -`testLessThan(54)` should return the string `Under 55` +`testLessThan(54)` deve retornar a string `Under 55` ```js assert(testLessThan(54) === 'Under 55'); ``` -`testLessThan(55)` should return the string `55 or Over` +`testLessThan(55)` deve retornar a string `55 or Over` ```js assert(testLessThan(55) === '55 or Over'); ``` -`testLessThan(99)` should return the string `55 or Over` +`testLessThan(99)` deve retornar a string `55 or Over` ```js assert(testLessThan(99) === '55 or Over'); ``` -You should use the `<` operator at least twice +Você deve usar o operador `<` pelo menos duas vezes ```js assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index 0bc8945dc8..c89444dccb 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244d7 -title: Comparison with the Less Than Or Equal To Operator +title: Comparação com o Operador Menor ou Igual challengeType: 1 videoUrl: 'https://scrimba.com/c/cNVR7Am' forumTopicId: 16788 @@ -9,9 +9,9 @@ dashedName: comparison-with-the-less-than-or-equal-to-operator # --description-- -The less than or equal to operator (`<=`) compares the values of two numbers. If the number to the left is less than or equal to the number to the right, it returns `true`. If the number on the left is greater than the number on the right, it returns `false`. Like the equality operator, the less than or equal to operator converts data types. +O operador menor ou igual (`<=`) compara os valores de dois números. Se o número à esquerda for menor ou igual ao número à direita, retornará `true`. Se o número a esquerda for maior que o número a direita, retornará `false`. Assim como o operador de igualdade, o operador de menor ou igual que converte os tipos de dados. -**Examples** +**Exemplos** ```js 4 <= 5 @@ -21,57 +21,57 @@ The less than or equal to operator (`<=`) compares the values of two numbers. If '8' <= 4 ``` -In order, these expressions would evaluate to `true`, `true`, `true`, `false`, and `false`. +Em ordem, essas expressões seriam iguais à `true`, `true`, `true`, `false` e `false`. # --instructions-- -Add the less than or equal to operator to the indicated lines so that the return statements make sense. +Adicione o operador menor ou igual que para indicar as linhas para que as instruções de retorno façam sentido. # --hints-- -`testLessOrEqual(0)` should return the string `Smaller Than or Equal to 12` +`testLessOrEqual(0)` deve retornar a string `Smaller Than or Equal to 12` ```js assert(testLessOrEqual(0) === 'Smaller Than or Equal to 12'); ``` -`testLessOrEqual(11)` should return the string `Smaller Than or Equal to 12` +`testLessOrEqual(11)` deve retornar a string `Smaller Than or Equal to 12` ```js assert(testLessOrEqual(11) === 'Smaller Than or Equal to 12'); ``` -`testLessOrEqual(12)` should return the string `Smaller Than or Equal to 12` +`testLessOrEqual(12)` deve retornar a string `Smaller Than or Equal to 12` ```js assert(testLessOrEqual(12) === 'Smaller Than or Equal to 12'); ``` -`testLessOrEqual(23)` should return the string `Smaller Than or Equal to 24` +`testLessOrEqual(23)` deve retornar a string `Smaller Than or Equal to 24` ```js assert(testLessOrEqual(23) === 'Smaller Than or Equal to 24'); ``` -`testLessOrEqual(24)` should return the string `Smaller Than or Equal to 24` +`testLessOrEqual(24)` deve retornar a string `Smaller Than or Equal to 24` ```js assert(testLessOrEqual(24) === 'Smaller Than or Equal to 24'); ``` -`testLessOrEqual(25)` should return the string `More Than 24` +`testLessOrEqual(25)` deve retornar a string `More than 24` ```js assert(testLessOrEqual(25) === 'More Than 24'); ``` -`testLessOrEqual(55)` should return the string `More Than 24` +`testLessOrEqual(55)` deve retornar a string `More than 24` ```js assert(testLessOrEqual(55) === 'More Than 24'); ``` -You should use the `<=` operator at least twice +Você deve usar o operador `<=` pelo menos duas vezes ```js assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index 6aa9ba3861..5bc4ce3324 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244d1 -title: Comparison with the Strict Equality Operator +title: Comparação com o Operador de Igualdade Estrita challengeType: 1 videoUrl: 'https://scrimba.com/c/cy87atr' forumTopicId: 16790 @@ -9,46 +9,46 @@ dashedName: comparison-with-the-strict-equality-operator # --description-- -Strict equality (`===`) is the counterpart to the equality operator (`==`). However, unlike the equality operator, which attempts to convert both values being compared to a common type, the strict equality operator does not perform a type conversion. +Igualdade estrita (`===`) é a contrapartida do operador de igualdade (`==`). No entanto, ao contrário do operador de igualdade, que tenta converter ambos os valores em comparação a um tipo comum, o operador estrito de igualdade não realiza uma conversão de tipo. -If the values being compared have different types, they are considered unequal, and the strict equality operator will return false. +Se os valores que são comparados tiverem valores diferentes, são considerados desiguais, e o operador de igualdade estrito retornará falso. -**Examples** +**Exemplos** ```js 3 === 3 3 === '3' ``` -These conditions would return `true` and `false` respectively. +Essas condições retornariam `true` e `false` respectivamente. -In the second example, `3` is a `Number` type and `'3'` is a `String` type. +No segundo exemplo, `3` é um tipo de `Number` e `'3'` é um tipo `String`. # --instructions-- -Use the strict equality operator in the `if` statement so the function will return the string `Equal` when `val` is strictly equal to `7` +Use o operador de igualdade estrito na instrução `if`, para que a função retorne a string `Equal` quando `val` for estritamente igual a `7` # --hints-- -`testStrict(10)` should return the string `Not Equal` +`testStrict(10)` deve retornar a string `Not Equal` ```js assert(testStrict(10) === 'Not Equal'); ``` -`testStrict(7)` should return the string `Equal` +`testStrict(7)` deve retornar a string `Equal` ```js assert(testStrict(7) === 'Equal'); ``` -`testStrict("7")` should return the string `Not Equal` +`testStrict("7")` deve retornar a string `Not Equal` ```js assert(testStrict('7') === 'Not Equal'); ``` -You should use the `===` operator +Você deve usar o operador `===` ```js assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index 4ab65c634b..6a3a012b5f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244d3 -title: Comparison with the Strict Inequality Operator +title: Comparação com o Operador de Desigualdade Estrito challengeType: 1 videoUrl: 'https://scrimba.com/c/cKekkUy' forumTopicId: 16791 @@ -9,9 +9,9 @@ dashedName: comparison-with-the-strict-inequality-operator # --description-- -The strict inequality operator (`!==`) is the logical opposite of the strict equality operator. It means "Strictly Not Equal" and returns `false` where strict equality would return `true` and *vice versa*. The strict inequality operator will not convert data types. +O operador de desigualdade estrito (`!=`) é o oposto lógico do operador de igualdade estrito. Significa que "não é estritamente igual" e retorna `false` onde a igualdade estrita retornaria `true` e *vice-versa*. O operador de desigualdade estrita não converterá tipos de dados. -**Examples** +**Exemplos** ```js 3 !== 3 @@ -19,39 +19,39 @@ The strict inequality operator (`!==`) is the logical opposite of the strict equ 4 !== 3 ``` -In order, these expressions would evaluate to `false`, `true`, and `true`. +Em ordem, essas expressões seriam iguais à `false`, `true` e `true`. # --instructions-- -Add the strict inequality operator to the `if` statement so the function will return the string `Not Equal` when `val` is not strictly equal to `17` +Adicione o operador de desigualdade estrito ao comando `if` para que a função retorne a string `Not Equal` quando `val` não é estritamente igual a `17` # --hints-- -`testStrictNotEqual(17)` should return the string `Equal` +`testStrictNotEqual(17)` deve retornar a string `Equal` ```js assert(testStrictNotEqual(17) === 'Equal'); ``` -`testStrictNotEqual("17")` should return the string `Not Equal` +`testStrictNotEqual("17")` deve retornar a string `Not Equal` ```js assert(testStrictNotEqual('17') === 'Not Equal'); ``` -`testStrictNotEqual(12)` should return the string `Not Equal` +`testStrictNotEqual(12)` deve retornar a string `Not Equal` ```js assert(testStrictNotEqual(12) === 'Not Equal'); ``` -`testStrictNotEqual("bob")` should return the string `Not Equal` +`testStrictNotEqual("bob")` deve retornar a string `Not Equal` ```js assert(testStrictNotEqual('bob') === 'Not Equal'); ``` -You should use the `!==` operator +Você deve usar o operador `!==` ```js assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md index da1175e7c0..71b8affc75 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244d8 -title: Comparisons with the Logical And Operator +title: Comparações com o Operador lógico E challengeType: 1 videoUrl: 'https://scrimba.com/c/cvbRVtr' forumTopicId: 16799 @@ -9,9 +9,9 @@ dashedName: comparisons-with-the-logical-and-operator # --description-- -Sometimes you will need to test more than one thing at a time. The logical and operator (`&&`) returns `true` if and only if the operands to the left and right of it are true. +Às vezes você precisará testar mais de uma coisa de cada vez. O operador lógico e(`&&`) retornará `true` apenas se os operadores a esquerda e à direita são verdadeiros. -The same effect could be achieved by nesting an if statement inside another if: +O mesmo efeito pode ser alcançado aninhando uma instrução if dentro de outro if: ```js if (num > 5) { @@ -22,7 +22,7 @@ if (num > 5) { return "No"; ``` -will only return `Yes` if `num` is greater than `5` and less than `10`. The same logic can be written as: +só retornará `Yes` se `num` é maior que `5` e menor que `10`. A mesma lógica pode ser escrita como: ```js if (num > 5 && num < 10) { @@ -33,65 +33,65 @@ return "No"; # --instructions-- -Replace the two if statements with one statement, using the `&&` operator, which will return the string `Yes` if `val` is less than or equal to `50` and greater than or equal to `25`. Otherwise, will return the string `No`. +Substitua as duas instruções if por uma declaração, usando o operador `&&`, que irá retornar a string `Yes` se `val` for menor ou igual a `50` e maior ou igual a `25`. Caso contrário, retornará a string `No`. # --hints-- -You should use the `&&` operator once +Você deve usar o operador `&&` uma vez ```js assert(code.match(/&&/g).length === 1); ``` -You should only have one `if` statement +Você deve ter apenas um comando `if` ```js assert(code.match(/if/g).length === 1); ``` -`testLogicalAnd(0)` should return the string `No` +`testLogicalAnd(0)` deve retornar a string `No` ```js assert(testLogicalAnd(0) === 'No'); ``` -`testLogicalAnd(24)` should return the string `No` +`testLogicalAnd(24)` deve retornar a string `No` ```js assert(testLogicalAnd(24) === 'No'); ``` -`testLogicalAnd(25)` should return the string `Yes` +`testLogicalAnd(25)` deve retornar a string `Yes` ```js assert(testLogicalAnd(25) === 'Yes'); ``` -`testLogicalAnd(30)` should return the string `Yes` +`testLogicalAnd(30)` deve retornar a string `Yes` ```js assert(testLogicalAnd(30) === 'Yes'); ``` -`testLogicalAnd(50)` should return the string `Yes` +`testLogicalAnd(50)` deve retornar a string `Yes` ```js assert(testLogicalAnd(50) === 'Yes'); ``` -`testLogicalAnd(51)` should return the string `No` +`testLogicalAnd(51)` deve retornar a string `No` ```js assert(testLogicalAnd(51) === 'No'); ``` -`testLogicalAnd(75)` should return the string `No` +`testLogicalAnd(75)` deve retornar a string `No` ```js assert(testLogicalAnd(75) === 'No'); ``` -`testLogicalAnd(80)` should return the string `No` +`testLogicalAnd(80)` deve retornar a string `No` ```js assert(testLogicalAnd(80) === 'No'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md index 3202c07163..23c0ace7af 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244d9 -title: Comparisons with the Logical Or Operator +title: Comparações com o Operador Lógico Ou challengeType: 1 videoUrl: 'https://scrimba.com/c/cEPrGTN' forumTopicId: 16800 @@ -9,11 +9,11 @@ dashedName: comparisons-with-the-logical-or-operator # --description-- -The logical or operator (`||`) returns `true` if either of the operands is `true`. Otherwise, it returns `false`. +O operador lógico ou (`||`) retorna `true` se qualquer um dos operandos for `true`. Caso contrário, retorna `false`. -The logical or operator is composed of two pipe symbols: (`||`). This can typically be found between your Backspace and Enter keys. +O operador lógico ou é composto por dois símbolos de pipe: (`||`). Normalmente isso pode ser encontrado entre as teclas Backspace e Enter. -The pattern below should look familiar from prior waypoints: +O padrão abaixo deve parecer familiar aos pontos da passagens anteriores: ```js if (num > 10) { @@ -25,7 +25,7 @@ if (num < 5) { return "Yes"; ``` -will return `Yes` only if `num` is between `5` and `10` (5 and 10 included). The same logic can be written as: +retornará `Yes` apenas se `num` for entre `5` e `10` (5 e 10 incluídos). A mesma lógica pode ser escrita como: ```js if (num > 10 || num < 5) { @@ -36,65 +36,65 @@ return "Yes"; # --instructions-- -Combine the two `if` statements into one statement which returns the string `Outside` if `val` is not between `10` and `20`, inclusive. Otherwise, return the string `Inside`. +Combine as duas instruções `if` em uma mesma instrução a qual retorna a string `Outside` se `val` não estiver entre `10` e `20`, inclusos 10 e 20. Caso contrário, retorna a string `Inside`. # --hints-- -You should use the `||` operator once +Você deve usar o operador `||` uma vez ```js assert(code.match(/\|\|/g).length === 1); ``` -You should only have one `if` statement +Você deve ter apenas uma instrução `if` ```js assert(code.match(/if/g).length === 1); ``` -`testLogicalOr(0)` should return the string `Outside` +`testLogicalOr(0)` deve retornar a string `Outside` ```js assert(testLogicalOr(0) === 'Outside'); ``` -`testLogicalOr(9)` should return the string `Outside` +`testLogicalOr(9)` deve retornar a string `Outside` ```js assert(testLogicalOr(9) === 'Outside'); ``` -`testLogicalOr(10)` should return the string `Inside` +`testLogicalOr(10)` deve retornar a string `Inside` ```js assert(testLogicalOr(10) === 'Inside'); ``` -`testLogicalOr(15)` should return the string `Inside` +`testLogicalOr(15)` deve retornar a string `Inside` ```js assert(testLogicalOr(15) === 'Inside'); ``` -`testLogicalOr(19)` should return the string `Inside` +`testLogicalOr(19)` deve retornar a string `Inside` ```js assert(testLogicalOr(19) === 'Inside'); ``` -`testLogicalOr(20)` should return the string `Inside` +`testLogicalOr(20)` deve retornar a string `Inside` ```js assert(testLogicalOr(20) === 'Inside'); ``` -`testLogicalOr(21)` should return the string `Outside` +`testLogicalOr(21)` deve retornar a string `Outside` ```js assert(testLogicalOr(21) === 'Outside'); ``` -`testLogicalOr(25)` should return the string `Outside` +`testLogicalOr(25)` deve retornar a string `Outside` ```js assert(testLogicalOr(25) === 'Outside'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md index ca307a3375..a6ed49f9ce 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244af -title: Compound Assignment With Augmented Addition +title: Atribuição Composta Com Adição Aumentada challengeType: 1 videoUrl: 'https://scrimba.com/c/cDR6LCb' forumTopicId: 16661 @@ -9,15 +9,15 @@ dashedName: compound-assignment-with-augmented-addition # --description-- -In programming, it is common to use assignments to modify the contents of a variable. Remember that everything to the right of the equals sign is evaluated first, so we can say: +Na programação, é comum usar atribuições para modificar o conteúdo de uma variável. Lembre-se de que tudo à direita do sinal de igual é avaliado primeiro, para que possamos dizer: ```js myVar = myVar + 5; ``` -to add `5` to `myVar`. Since this is such a common pattern, there are operators which do both a mathematical operation and assignment in one step. +para adicionar `5` a `myVar`. Como este é um padrão tão comum, existem operadores que realizam uma operação matemática e atribuição em um passo. -One such operator is the `+=` operator. +Um desses operadores é o operador `+=`. ```js var myVar = 1; @@ -25,39 +25,39 @@ myVar += 5; console.log(myVar); ``` -`6` would be displayed in the console. +`6` seria exibido no console. # --instructions-- -Convert the assignments for `a`, `b`, and `c` to use the `+=` operator. +Converta as atribuições para `a`, `b` e `c` para usar o operador `+=`. # --hints-- -`a` should equal `15`. +`a` deve ser igual a `15`. ```js assert(a === 15); ``` -`b` should equal `26`. +`b` deve ser igual a `26`. ```js assert(b === 26); ``` -`c` should equal `19`. +`c` deve ser igual a `19`. ```js assert(c === 19); ``` -You should use the `+=` operator for each variable. +Você deve usar o operador `+=` para cada variável. ```js assert(code.match(/\+=/g).length === 3); ``` -You should not modify the code above the specified comment. +Você não deve modificar o código acima do comentário especificado. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md index aa630acf60..00159dc92d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244b2 -title: Compound Assignment With Augmented Division +title: Atribuição Composta Com Divisão Aumentada challengeType: 1 videoUrl: 'https://scrimba.com/c/c2QvKT2' forumTopicId: 16659 @@ -9,13 +9,13 @@ dashedName: compound-assignment-with-augmented-division # --description-- -The `/=` operator divides a variable by another number. +O operador `/=` divide uma variável por outro número. ```js myVar = myVar / 5; ``` -Will divide `myVar` by `5`. This can be rewritten as: +Irá dividir `myVar` por `5`. Isto pode ser reescrito como: ```js myVar /= 5; @@ -23,35 +23,35 @@ myVar /= 5; # --instructions-- -Convert the assignments for `a`, `b`, and `c` to use the `/=` operator. +Converta as atribuições para `a`, `b` e `c` para usar o operador `/=`. # --hints-- -`a` should equal `4`. +`a` deve ser igual a `4`. ```js assert(a === 4); ``` -`b` should equal `27`. +`b` deve ser igual a `27`. ```js assert(b === 27); ``` -`c` should equal `3`. +`c` deve ser igual a `3`. ```js assert(c === 3); ``` -You should use the `/=` operator for each variable. +Você deve usar o operador `/=` para cada variável. ```js assert(code.match(/\/=/g).length === 3); ``` -You should not modify the code above the specified comment. +Você não deve modificar o código acima do comentário especificado. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md index a12d59ef42..c202ee0459 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244b1 -title: Compound Assignment With Augmented Multiplication +title: Atribuição Composta Com Multiplicação Aumentada challengeType: 1 videoUrl: 'https://scrimba.com/c/c83vrfa' forumTopicId: 16662 @@ -9,13 +9,13 @@ dashedName: compound-assignment-with-augmented-multiplication # --description-- -The `*=` operator multiplies a variable by a number. +O operador `*=` multiplica uma variável por um número. ```js myVar = myVar * 5; ``` -will multiply `myVar` by `5`. This can be rewritten as: +irá multiplicar `myVar` por `5`. Isto pode ser reescrito como: ```js myVar *= 5; @@ -23,35 +23,35 @@ myVar *= 5; # --instructions-- -Convert the assignments for `a`, `b`, and `c` to use the `*=` operator. +Converta as atribuições para `a`, `b` e `c` para usar o operador `*=`. # --hints-- -`a` should equal `25`. +`a` deve ser igual a `25`. ```js assert(a === 25); ``` -`b` should equal `36`. +`b` deve ser igual a `36`. ```js assert(b === 36); ``` -`c` should equal `46`. +`c` deve ser igual a `46`. ```js assert(c === 46); ``` -You should use the `*=` operator for each variable. +Você deve usar o operador `*=` para cada variável. ```js assert(code.match(/\*=/g).length === 3); ``` -You should not modify the code above the specified comment. +Você não deve modificar o código acima do comentário especificado. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md index ae6388ad04..e0041af89d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244b0 -title: Compound Assignment With Augmented Subtraction +title: Atribuição Composta Com Subtração Aumentada challengeType: 1 videoUrl: 'https://scrimba.com/c/c2Qv7AV' forumTopicId: 16660 @@ -9,13 +9,13 @@ dashedName: compound-assignment-with-augmented-subtraction # --description-- -Like the `+=` operator, `-=` subtracts a number from a variable. +Como o operador `+=`, `-=` subtrai um número de uma variável. ```js myVar = myVar - 5; ``` -will subtract `5` from `myVar`. This can be rewritten as: +irá subtrair `5` de `myVar`. Isto pode ser reescrito como: ```js myVar -= 5; @@ -23,35 +23,35 @@ myVar -= 5; # --instructions-- -Convert the assignments for `a`, `b`, and `c` to use the `-=` operator. +Converta as atribuições para `a`, `b` e `c` para usar o operador `+=`. # --hints-- -`a` should equal `5`. +`a` deve ser igual a `5`. ```js assert(a === 5); ``` -`b` should equal `-6`. +`b` deve ser igual a `-6`. ```js assert(b === -6); ``` -`c` should equal `2`. +`c` deve ser igual a `2`. ```js assert(c === 2); ``` -You should use the `-=` operator for each variable. +Você deve usar o operador `-=` para cada variável. ```js assert(code.match(/-=/g).length === 3); ``` -You should not modify the code above the specified comment. +Você não deve modificar o código acima do comentário especificado. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md index 4b9adc2615..bd9ed37866 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244b7 -title: Concatenating Strings with Plus Operator +title: Concatenando Strings com Operador Mais challengeType: 1 videoUrl: 'https://scrimba.com/c/cNpM8AN' forumTopicId: 16802 @@ -9,48 +9,48 @@ dashedName: concatenating-strings-with-plus-operator # --description-- -In JavaScript, when the `+` operator is used with a `String` value, it is called the concatenation operator. You can build a new string out of other strings by concatenating them together. +Em JavaScript, quando o operador `+` é usado com um valor de `String`, ele é chamado de operador de concatenação. Você pode construir uma nova string a partir de outras strings ao concatenar elas juntos. -**Example** +**Exemplo** ```js 'My name is Alan,' + ' I concatenate.' ``` -**Note:** Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself. +**Nota:** Cuidado com os espaços. A concatenação não adiciona espaços entre strings concatenadas, então você mesmo precisará adicioná-las. -Example: +Exemplo: ```js var ourStr = "I come first. " + "I come second."; ``` -The string `I come first. I come second.` would be displayed in the console. +A string `I come first. I come second.` seria exibida no console. # --instructions-- -Build `myStr` from the strings `This is the start. ` and `This is the end.` using the `+` operator. +Construa `myStr` a partir das strings `This is the start.` e `This is the end.` usando o operador `+`. # --hints-- -`myStr` should have a value of the string `This is the start. This is the end.` +`myStr` deve ter o valor da string `This is the start. This is the end.` ```js assert(myStr === 'This is the start. This is the end.'); ``` -You should use the `+` operator to build `myStr`. +Você deve usar o operador `+` para construir `myStr`. ```js assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); ``` -`myStr` should be created using the `var` keyword. +`myStr` deve ser criado usando a palavra-chave `var`. ```js assert(/var\s+myStr/.test(code)); ``` -You should assign the result to the `myStr` variable. +Você deve atribuir o resultado à variável `myStr`. ```js assert(/myStr\s*=/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index e3eeaef1c2..8d54cbfd9b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244b8 -title: Concatenating Strings with the Plus Equals Operator +title: Concatenando strings com o operador mais igual challengeType: 1 videoUrl: 'https://scrimba.com/c/cbQmmC4' forumTopicId: 16803 @@ -9,32 +9,32 @@ dashedName: concatenating-strings-with-the-plus-equals-operator # --description-- -We can also use the `+=` operator to concatenate a string onto the end of an existing string variable. This can be very helpful to break a long string over several lines. +Também podemos usar o operador `+=` para concatenar uma string no final de uma variável string existente. Isso pode ser muito útil para quebrar uma longa string em várias linhas. -**Note:** Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself. +**Nota:** Cuidado com os espaços. A concatenação não adiciona espaços entre strings concatenadas, então você mesmo precisará adicioná-las. -Example: +Exemplo: ```js var ourStr = "I come first. "; ourStr += "I come second."; ``` -`ourStr` now has a value of the string `I come first. I come second.`. +`ourStr` agora deve ter como valor a string `I come first. I come second.`. # --instructions-- -Build `myStr` over several lines by concatenating these two strings: `This is the first sentence. ` and `This is the second sentence.` using the `+=` operator. Use the `+=` operator similar to how it is shown in the example. Start by assigning the first string to `myStr`, then add on the second string. +Construa `myStr` sobre várias linhas concatenando essas duas strings: `Esta é a primeira frase.` e `Esta é a segunda frase.` usando o operador `+=`. Use o operador `+=` de modo semelhante a como aparece no exemplo. Comece atribuindo o primeiro texto para `myStr`, e então adicione o segundo texto. # --hints-- -`myStr` should have a value of the string `This is the first sentence. This is the second sentence.` +`myStr` deve ter como valor a string `This is the first sentence. This is the second sentence.` ```js assert(myStr === 'This is the first sentence. This is the second sentence.'); ``` -You should use the `+=` operator to build `myStr`. +Você deve usar o operador `+=` para construir `myStr`. ```js assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md index a21e9753ea..7aed64014c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244b9 -title: Constructing Strings with Variables +title: Construindo Strings com Variáveis challengeType: 1 videoUrl: 'https://scrimba.com/c/cqk8rf4' forumTopicId: 16805 @@ -9,30 +9,30 @@ dashedName: constructing-strings-with-variables # --description-- -Sometimes you will need to build a string, [Mad Libs](https://en.wikipedia.org/wiki/Mad_Libs) style. By using the concatenation operator (`+`), you can insert one or more variables into a string you're building. +Às vezes você precisará construir uma string, no estilo [Mad Libs](https://en.wikipedia.org/wiki/Mad_Libs). Usando o operador de concatenação (`+`), você pode inserir uma ou mais variáveis em uma string que você está construindo. -Example: +Exemplo: ```js var ourName = "freeCodeCamp"; var ourStr = "Hello, our name is " + ourName + ", how are you?"; ``` -`ourStr` would have a value of the string `Hello, our name is freeCodeCamp, how are you?`. +`ourStr` teria o valor da string `Hello, our name is freeCodeCamp, how are you?`. # --instructions-- -Set `myName` to a string equal to your name and build `myStr` with `myName` between the strings `My name is ` and ` and I am well!` +Defina `myName` para uma string igual ao seu nome e construa `myStr` com `myName` em duas strings: `My name is` e `and I am well!` # --hints-- -`myName` should be set to a string at least 3 characters long. +`myName` deve ser definido para uma string de pelo menos 3 caracteres. ```js assert(typeof myName !== 'undefined' && myName.length > 2); ``` -You should use two `+` operators to build `myStr` with `myName` inside it. +Você deve usar dois operadores `+` para construir `myStr` com `myName` dentro dele. ```js assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md index d6c348a821..e998282495 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md @@ -1,6 +1,6 @@ --- id: 56105e7b514f539506016a5e -title: Count Backwards With a For Loop +title: Conte para Trás com um Laço For challengeType: 1 videoUrl: 'https://scrimba.com/c/c2R6BHa' forumTopicId: 16808 @@ -9,11 +9,11 @@ dashedName: count-backwards-with-a-for-loop # --description-- -A for loop can also count backwards, so long as we can define the right conditions. +Um laço for também pode contar pra trás, contanto que possamos definir as condições certas. -In order to decrement by two each iteration, we'll need to change our initialization, condition, and final expression. +Para decrementar em dois cada iteração, nós precisamos alterar nossa inicialização, condição e expressão final. -We'll start at `i = 10` and loop while `i > 0`. We'll decrement `i` by 2 each loop with `i -= 2`. +Nós começaremos em `i = 10` e iterar enquanto `i > 0`. Nós decrementamos `i` por dois em cada iteração com `i -= 2`. ```js var ourArray = []; @@ -22,27 +22,27 @@ for (var i = 10; i > 0; i -= 2) { } ``` -`ourArray` will now contain `[10,8,6,4,2]`. Let's change our initialization and final expression so we can count backwards by twos to create an array of descending odd numbers. +`ourArray` agora vai conter `[10,8, 6,4,2]`. Vamos mudar nossa inicialização e expressão final para que possamos contar para trás em dois para criar um array de números ímpares decrescentes. # --instructions-- -Push the odd numbers from 9 through 1 to `myArray` using a `for` loop. +Adicione (push) os números ímpares de 9 até 1 para `myArray` usando um laço `for`. # --hints-- -You should be using a `for` loop for this. +Você deve estar usando um laço `for` para isso. ```js assert(/for\s*\([^)]+?\)/.test(code)); ``` -You should be using the array method `push`. +Você deve usar o método de array `push`. ```js assert(code.match(/myArray.push/)); ``` -`myArray` should equal `[9,7,5,3,1]`. +`myArray` deve ser igual a `[9,7,5,3,1]`. ```js assert.deepEqual(myArray, [9, 7, 5, 3, 1]); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md index fda982efbd..9bcc84f64d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md @@ -1,6 +1,6 @@ --- id: 565bbe00e9cc8ac0725390f4 -title: Counting Cards +title: Contando cartas challengeType: 1 videoUrl: 'https://scrimba.com/c/c6KE7ty' forumTopicId: 16809 @@ -9,24 +9,23 @@ dashedName: counting-cards # --description-- -In the casino game Blackjack, a player can gain an advantage over the house by keeping track of the relative number of high and low cards remaining in the deck. This is called [Card Counting](https://en.wikipedia.org/wiki/Card_counting). +No jogo de casino Blackjack, um jogador pode ganhar vantagem sobre a casa, mantendo o número relativo de cartas altas e baixas restantes no deck. Isso se chama [Contagem de Cartas](https://en.wikipedia.org/wiki/Card_counting). -Having more high cards remaining in the deck favors the player. Each card is assigned a value according to the table below. When the count is positive, the player should bet high. When the count is zero or negative, the player should bet low. +Ter cartas mais altas restantes no deck favorece o jogador. A cada carta é atribuído um valor de acordo com a tabela abaixo. Quando o contador for positivo, o jogador deve apostar alto. Quando a contagem for zero ou negativa, o jogador deverá apostar baixo. -
        Count ChangeCards
        +12, 3, 4, 5, 6
        07, 8, 9
        -110, 'J', 'Q', 'K', 'A'
        +
        Contagem de mudançaCartas
        +12, 3, 4, 5, 6
        07, 8, 9
        -110, 'J', 'Q', 'K', 'A'
        -You will write a card counting function. It will receive a `card` parameter, which can be a number or a string, and increment or decrement the global `count` variable according to the card's value (see table). The function will then return a string with the current count and the string `Bet` if the count is positive, or `Hold` if the count is zero or negative. The current count and the player's decision (`Bet` or `Hold`) should be separated by a single space. +Você vai escrever uma função de contagem de cartas. A função receberá um parâmetro `card`, a qual pode ser um número ou uma string e incrementar ou decrementar a variável global `count` de acordo com o valor da carta (veja a tabela). Em seguida, a função retornará a string com o valor atual de contagem (variável count) e a string `Bet` se a contagem for positiva, ou `Hold` se a contagem for zero ou negativa. A contagem atual e a decisão do jogador (`Bet` ou `Hold`) deve ser separado por um único espaço. -**Example Outputs:** `-3 Hold` or `5 Bet` +**Exemplo de Saída:** `-3 Hold` ou `5 Bet` -**Hint** -Do NOT reset `count` to 0 when value is 7, 8, or 9. -Do NOT return an array. -Do NOT include quotes (single or double) in the output. +**Dica** +Não redefina o valor de `count` para 0 quando o valor for 7, 8, or 9. Não retorne um array. +Não inclua aspas (simples ou duplas) na saída. # --hints-- -Cards Sequence 2, 3, 4, 5, 6 should return `5 Bet` +Sequências de cartas 2, 3, 4, 5, 6 deve retornar `5 Bet` ```js assert( @@ -45,7 +44,7 @@ assert( ); ``` -Cards Sequence 7, 8, 9 should return the string `0 Hold` +Sequência de cartas 7, 8, 9 deve retornar a string `0 Hold` ```js assert( @@ -62,7 +61,7 @@ assert( ); ``` -Cards Sequence 10, J, Q, K, A should return the string `-5 Hold` +Sequência de cartas 10, J, Q, K, A deve retornar a string `-5 Hold` ```js assert( @@ -81,7 +80,7 @@ assert( ); ``` -Cards Sequence 3, 7, Q, 8, A should return the string `-1 Hold` +Sequência de cartas 3, 7, Q, 8, A deve retornar a string `-1 Hold` ```js assert( @@ -100,7 +99,7 @@ assert( ); ``` -Cards Sequence 2, J, 9, 2, 7 should return the string `1 Bet` +Sequência de cartas 2, J, 9, 2, 7 deve retornar a string `1 Bet` ```js assert( @@ -119,7 +118,7 @@ assert( ); ``` -Cards Sequence 2, 2, 10 should return the string `1 Bet` +Sequência de cartas 2, 2, 10 deve retornar a string `1 Bet` ```js assert( @@ -136,7 +135,7 @@ assert( ); ``` -Cards Sequence 3, 2, A, 10, K should return the string `-1 Hold` +Sequência de cartas 3, 2, A, 10, K deve retornar a string `-1 Hold` ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md index 49ca86fc2c..b768fd118e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md @@ -1,6 +1,6 @@ --- id: cf1391c1c11feddfaeb4bdef -title: Create Decimal Numbers with JavaScript +title: Crie Números Decimais com JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/ca8GEuW' forumTopicId: 16826 @@ -9,23 +9,23 @@ dashedName: create-decimal-numbers-with-javascript # --description-- -We can store decimal numbers in variables too. Decimal numbers are sometimes referred to as floating point numbers or floats. +Nós também podemos armazenar números decimais em variáveis. Números decimais são referidos as vezes como números de ponto flutuante ou floats. -**Note:** Not all real numbers can accurately be represented in floating point. This can lead to rounding errors. [Details Here](https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems). +**Nota:** Nem todos os números reais podem ser representados com precisão no ponto flutuante. Isso pode levar a erros de arredondamento. [Detalhes aqui](https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems). # --instructions-- -Create a variable `myDecimal` and give it a decimal value with a fractional part (e.g. `5.7`). +Crie a variável `myDecimal` e dê a ela um valor decimal com uma parte fracional (e.g. `5.7`). # --hints-- -`myDecimal` should be a number. +`myDecimal` deve ser um número. ```js assert(typeof myDecimal === 'number'); ``` -`myDecimal` should have a decimal point +`myDecimal` deve ter um ponto decimal ```js assert(myDecimal % 1 != 0); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md index 9d41fe9503..a065a6c6f1 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md @@ -1,6 +1,6 @@ --- id: bd7123c9c443eddfaeb5bdef -title: Declare JavaScript Variables +title: Declare Variáveis JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cNanrHq' forumTopicId: 17556 @@ -9,32 +9,32 @@ dashedName: declare-javascript-variables # --description-- -In computer science, data is anything that is meaningful to the computer. JavaScript provides eight different data types which are `undefined`, `null`, `boolean`, `string`, `symbol`, `bigint`, `number`, and `object`. +Na ciência da computação, dado é qualquer coisa que tenha significado ao computador. JavaScript fornece oito tipos de dados diferentes que são `undefined`, `null`, `boolean`, `string`, `symbol`, `bigint`, `number` e `object`. -For example, computers distinguish between numbers, such as the number `12`, and `strings`, such as `"12"`, `"dog"`, or `"123 cats"`, which are collections of characters. Computers can perform mathematical operations on a number, but not on a string. +Por exemplo, os computadores distinguem números, como o número`12`, e`strings`, como o `"12"`, `"dog"`, ou`"123 cats"`, as quais são coleções de caracteres. Computadores podem realizar operações matemáticas em um número, mas não em string. -Variables allow computers to store and manipulate data in a dynamic fashion. They do this by using a "label" to point to the data rather than using the data itself. Any of the eight data types may be stored in a variable. +Variáveis permitem aos computadores armazenar e manipular dados de forma dinâmica. Eles fazem isso usando um "rótulo" para apontar ao dado ao invés de usar o próprio dado. Qualquer uma dos 8 tipos de dados podem ser armazenados em variável. -Variables are similar to the x and y variables you use in mathematics, which means they're a simple name to represent the data we want to refer to. Computer variables differ from mathematical variables in that they can store different values at different times. +Variáveis são similares às variáveis x e y utilizados na matemática, o que significa que elas são simples nomes para representar os dados que eles querem se referir. Variáveis de computador diferem das variáveis matemáticas porque elas podem armazenar diferentes valores em momentos diferentes. -We tell JavaScript to create or declare a variable by putting the keyword `var` in front of it, like so: +Dizemos ao JavaScript para criar ou declarar uma variável colocando a palavra-chave `var` na frente dela, dessa forma: ```js var ourName; ``` -creates a variable called `ourName`. In JavaScript we end statements with semicolons. Variable names can be made up of numbers, letters, and `$` or `_`, but may not contain spaces or start with a number. +cria uma variável chamada `ourName`. Em JavaScript terminamos uma instrução com ponto e vírgula. Nomes de variáveis podem ser formadas por números, letras e `$` ou `_`, mas não pode conter espaços ou começar com um número. # --instructions-- -Use the `var` keyword to create a variable called `myName`. +Use a palavra-chave `var` para criar uma variável chamada `myName`. -**Hint** -Look at the `ourName` example above if you get stuck. +**Dica** +Olhe o exemplo acima de `ourName` se você ficar travado. # --hints-- -You should declare `myName` with the `var` keyword, ending with a semicolon +Você deve declarar `myName` com a palavra-chave `var`, terminando com ponto e vírgula ```js assert(/var\s+myName\s*;/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md index 21bd4c62f0..c1b199e4f7 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md @@ -1,6 +1,6 @@ --- id: bd7123c9c444eddfaeb5bdef -title: Declare String Variables +title: Declarar Variáveis de String challengeType: 1 videoUrl: 'https://scrimba.com/c/c2QvWU6' forumTopicId: 17557 @@ -9,21 +9,21 @@ dashedName: declare-string-variables # --description-- -Previously we have used the code +Anteriormente nós usamos o código ```js var myName = "your name"; ``` -`"your name"` is called a string literal. It is a string because it is a series of zero or more characters enclosed in single or double quotes. +`"your name"` é chamado de string literal. É uma string porque é uma série de 0 ou mais caracteres entre aspas simples ou duplas. # --instructions-- -Create two new string variables: `myFirstName` and `myLastName` and assign them the values of your first and last name, respectively. +Crie duas novas variáveis de string: `myFirstName` e `myLastName` e atribua a eles os valores do seu primeiro e último nome, respectivamente. # --hints-- -`myFirstName` should be a string with at least one character in it. +`myFirstName` deve ser uma string com pelo menos um caractere. ```js assert( @@ -41,7 +41,7 @@ assert( ); ``` -`myLastName` should be a string with at least one character in it. +`myLastName` deve ser uma string com pelo menos um caractere. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md index f80f5658d9..57d6d8a4f9 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244ad -title: Decrement a Number with JavaScript +title: Decremente um Número com JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cM2KeS2' forumTopicId: 17558 @@ -9,33 +9,33 @@ dashedName: decrement-a-number-with-javascript # --description-- -You can easily decrement or decrease a variable by one with the `--` operator. +Você pode facilmente decrementar ou diminuir uma variável por um com o operador `--`. ```js i--; ``` -is the equivalent of +é o equivalente a ```js i = i - 1; ``` -**Note:** The entire line becomes `i--;`, eliminating the need for the equal sign. +**Nota:** A linha inteira torna-se `i--;`, eliminando a necessidade para o sinal de igual (atribuição). # --instructions-- -Change the code to use the `--` operator on `myVar`. +Altere o código para usar o operador `--` na variável `myVar`. # --hints-- -`myVar` should equal `10`. +`myVar` deve ser igual a `10`. ```js assert(myVar === 10); ``` -`myVar = myVar - 1;` should be changed. +`myVar = myVar - 1;` deve ser alterado. ```js assert( @@ -43,13 +43,13 @@ assert( ); ``` -You should use the `--` operator on `myVar`. +Você deve usar o operador `--` na variável `myVar`. ```js assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); ``` -You should not change code above the specified comment. +Você não deve alterar o código acima do comentário especificado. ```js assert(/var myVar = 11;/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md index eff38c75a4..4f26185b34 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md @@ -1,6 +1,6 @@ --- id: 56bbb991ad1ed5201cd392d3 -title: Delete Properties from a JavaScript Object +title: Excluir Propriedades de um Objeto JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cDqKdTv' forumTopicId: 17560 @@ -9,13 +9,13 @@ dashedName: delete-properties-from-a-javascript-object # --description-- -We can also delete properties from objects like this: +Podemos também excluir propriedades de objetos dessa forma: ```js delete ourDog.bark; ``` -Example: +Exemplo: ```js var ourDog = { @@ -29,7 +29,7 @@ var ourDog = { delete ourDog.bark; ``` -After the last line shown above, `ourDog` looks like: +Após a última linha mostrada acima, `ourDog` se parece com: ```js { @@ -42,17 +42,17 @@ After the last line shown above, `ourDog` looks like: # --instructions-- -Delete the `tails` property from `myDog`. You may use either dot or bracket notation. +Exclua a propriedade `tails` de `myDog`. Você pode usar tanto notação de ponto quanto notação de colchetes. # --hints-- -You should delete the property `tails` from `myDog`. +Você deve excluir a propriedade `tails` de `myDog`. ```js assert(typeof myDog === 'object' && myDog.tails === undefined); ``` -You should not modify the `myDog` setup. +Você não deve modificar a configuração de `myDog`. ```js assert(code.match(/"tails": 1/g).length > 0); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md index cb96b3ff71..cdf20e1a1c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md @@ -1,6 +1,6 @@ --- id: bd7993c9ca9feddfaeb7bdef -title: Divide One Decimal by Another with JavaScript +title: Divida Um Decimal por Outro com JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cBZe9AW' forumTopicId: 18255 @@ -9,27 +9,27 @@ dashedName: divide-one-decimal-by-another-with-javascript # --description-- -Now let's divide one decimal by another. +Agora vamos dividir um decimal por outro. # --instructions-- -Change the `0.0` so that `quotient` will equal to `2.2`. +Modifique `0.0` para que a variável `quotient` seja igual a `2.2`. # --hints-- -The variable `quotient` should equal `2.2` +A variável `quotient` deve ser igual a `2.2` ```js assert(quotient === 2.2); ``` -You should use the `/` operator to divide 4.4 by 2 +Você deve usar o operador `/` para dividir 4.4 por 2 ```js assert(/4\.40*\s*\/\s*2\.*0*/.test(code)); ``` -The quotient variable should only be assigned once +A variável quotient deve ser atribuída apenas uma vez ```js assert(code.match(/quotient/g).length === 1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md index e0a3339e4e..39a180fec8 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md @@ -1,6 +1,6 @@ --- id: cf1111c1c11feddfaeb6bdef -title: Divide One Number by Another with JavaScript +title: Divida Um Número por Outro com JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cqkbdAr' forumTopicId: 17566 @@ -9,30 +9,30 @@ dashedName: divide-one-number-by-another-with-javascript # --description-- -We can also divide one number by another. +Nós também podemos dividir um número por outro. -JavaScript uses the `/` symbol for division. +JavaScript usa o símbolo `/` para divisão. -**Example** +**Exemplo** ```js myVar = 16 / 2; ``` -`myVar` now has the value `8`. +`myVar` agora possui o valor `8`. # --instructions-- -Change the `0` so that the `quotient` is equal to `2`. +Altere `0` para que a variável `quotient` seja igual a `2`. # --hints-- -The variable `quotient` should be equal to 2. +A variável `quotient` deve ser igual a 2. ```js assert(quotient === 2); ``` -You should use the `/` operator. +Você deve usar o operador `/`. ```js assert(/\d+\s*\/\s*\d+/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md index 9906fc03da..c545a35a5c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244b6 -title: Escape Sequences in Strings +title: Escape Sequências em Strings challengeType: 1 videoUrl: 'https://scrimba.com/c/cvmqRh6' forumTopicId: 17567 @@ -9,36 +9,36 @@ dashedName: escape-sequences-in-strings # --description-- -Quotes are not the only characters that can be escaped inside a string. There are two reasons to use escaping characters: +Aspas não são os únicos caracteres que podem ser escapadas dentro de uma string. Há dois motivos para usar caracteres de escapamento: -1. To allow you to use characters you may not otherwise be able to type out, such as a carriage return. -2. To allow you to represent multiple quotes in a string without JavaScript misinterpreting what you mean. +1. Para permitir que você use caracteres, você pode não ser capaz de digitar caso contrário, como um retorno de carro. +2. Para permiti-lo representar várias aspas em uma string sem o JavaScript entender erroneamente o que você quis dizer. -We learned this in the previous challenge. +Aprendemos isso no desafio anterior. -
        CodeOutput
        \'single quote
        \"double quote
        \\backslash
        \nnewline
        \rcarriage return
        \ttab
        \bword boundary
        \fform feed
        +
        CódigoSaída
        \'aspas simples
        \"aspas duplas
        \\barra invertida
        \nnova linha
        \rretorno de carro
        \ttab
        \blimite de palavra
        \fquebra de página
        -*Note that the backslash itself must be escaped in order to display as a backslash.* +*Note que a própria barra invertida deve ser escapada para ser exibida como uma barra invertida.* # --instructions-- -Assign the following three lines of text into the single variable `myStr` using escape sequences. +Atribua as três linhas de texto a seguir em uma única variável `myStr` usando sequências de escapamento.
        FirstLine
            \SecondLine
        ThirdLine
        -You will need to use escape sequences to insert special characters correctly. You will also need to follow the spacing as it looks above, with no spaces between escape sequences or words. +Você precisará usar sequências de escapamento para inserir corretamente os caracteres especiais. Você também precisará seguir os espaçamentos assim como se parece acima, sem espaços entre sequências de escapamento ou palavras. -**Note:** The indentation for `SecondLine` is achieved with the tab escape character, not spaces. +**Nota:** A identação para `SecondLine` é alcançada com o caracter de espaçamento tab, e não espaços. # --hints-- -`myStr` should not contain any spaces +`myStr` não deve conter espaços ```js assert(!/ /.test(myStr)); ``` -`myStr` should contain the strings `FirstLine`, `SecondLine` and `ThirdLine` (remember case sensitivity) +`myStr` deve conter as strings `FirstLine`, `SecondLine` e `ThirdLine` (lembre-se da sensibilidade de maiúsculas e minúsculas 'case sensitivity') ```js assert( @@ -46,31 +46,31 @@ assert( ); ``` -`FirstLine` should be followed by the newline character `\n` +`FirstLine` deve ser seguido pelo caractere de nova linha `\n` ```js assert(/FirstLine\n/.test(myStr)); ``` -`myStr` should contain a tab character `\t` which follows a newline character +`myStr` deve conter o caracter tab `\t` a qual está logo após o caractere de nova linha `\n` ```js assert(/\n\t/.test(myStr)); ``` -`SecondLine` should be preceded by the backslash character `\` +`SecondLine` deve ser precedida pelo caractere de barra invertida `\` ```js assert(/\\SecondLine/.test(myStr)); ``` -There should be a newline character between `SecondLine` and `ThirdLine` +Deve ter um caractere de nova linha entre `SecondLine` e `ThirdLine` ```js assert(/SecondLine\nThirdLine/.test(myStr)); ``` -`myStr` should only contain characters shown in the instructions +`myStr` deve conter apenas caracteres mostrados nas instruções ```js assert(myStr === 'FirstLine\n\t\\SecondLine\nThirdLine'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md index 4116092502..41e4be5dee 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244b5 -title: Escaping Literal Quotes in Strings +title: Escapando Aspas Literais em Strings challengeType: 1 videoUrl: 'https://scrimba.com/c/c2QvgSr' forumTopicId: 17568 @@ -9,15 +9,15 @@ dashedName: escaping-literal-quotes-in-strings # --description-- -When you are defining a string you must start and end with a single or double quote. What happens when you need a literal quote: `"` or `'` inside of your string? +Quando você estiver definindo uma sequência de caracteres você deve iniciar e terminar com uma aspa simples ou dupla. O que acontece quando você precisa de uma cotação literal: `"` ou `'` dentro de sua string? -In JavaScript, you can escape a quote from considering it as an end of string quote by placing a backslash (`\`) in front of the quote. +Em JavaScript, você pode escapar uma aspas para não ser considerada como o fim de uma string ao colocar a barra invertida (`\`) na frente da aspa. ```js var sampleStr = "Alan said, \"Peter is learning JavaScript\"."; ``` -This signals to JavaScript that the following quote is not the end of the string, but should instead appear inside the string. So if you were to print this to the console, you would get: +Isso sinaliza ao JavaScript que a seguinte aspa não é o fim de uma string, mas ao invés disso, deve aparecer dentro da string. Então, se você fosse imprimir isso no console, você obteria: ```js Alan said, "Peter is learning JavaScript". @@ -25,7 +25,7 @@ Alan said, "Peter is learning JavaScript". # --instructions-- -Use backslashes to assign a string to the `myStr` variable so that if you were to print it to the console, you would see: +Use barras invertidas para atribuir a string à variável `myStr` para que se você fosse imprimi-la no console, você veria: ```js I am a "double quoted" string inside "double quotes". @@ -33,13 +33,13 @@ I am a "double quoted" string inside "double quotes". # --hints-- -You should use two double quotes (`"`) and four escaped double quotes (`\"`). +Você deve usar aspas duplas (`"`) e quatro aspas duplas escapadas (`\"`). ```js assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2); ``` -Variable myStr should contain the string: `I am a "double quoted" string inside "double quotes".` +Variável myStr deve conter a string: `I am a "double quoted" string inside "double quotes".` ```js assert(/I am a "double quoted" string inside "double quotes(\."|"\.)$/.test(myStr)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md index 00b57be875..5f32668b20 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md @@ -1,6 +1,6 @@ --- id: bd7123c9c448eddfaeb5bdef -title: Find the Length of a String +title: Encontre o Tamanho de uma String challengeType: 1 videoUrl: 'https://scrimba.com/c/cvmqEAd' forumTopicId: 18182 @@ -9,23 +9,23 @@ dashedName: find-the-length-of-a-string # --description-- -You can find the length of a `String` value by writing `.length` after the string variable or string literal. +Você pode encontrar o tamanho de um valor de `String` ao escrever `.length` após a variável de string ou literal de string. ```js console.log("Alan Peter".length); ``` -The value `10` would be displayed in the console. +O valor `10` seria exibido no console. -For example, if we created a variable `var firstName = "Ada"`, we could find out how long the string `Ada` is by using the `firstName.length` property. +Por exemplo, se nós criarmos uma variável `var firstName = "Ada"`, poderíamos descobrir qual o tamanho da string `Ada` ao usar a propriedade `firstName.length`. # --instructions-- -Use the `.length` property to count the number of characters in the `lastName` variable and assign it to `lastNameLength`. +Use a propriedade `.length` para contar o número de caracteres na variável `lastName` e atribui-la a `lastNameLength`. # --hints-- -You should not change the variable declarations in the `// Setup` section. +Você não deve alterar as declarações de variáveis a seção `// Setup`. ```js assert( @@ -34,13 +34,13 @@ assert( ); ``` -`lastNameLength` should be equal to eight. +`lastNameLength` deve ser igual a oito. ```js assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8); ``` -You should be getting the length of `lastName` by using `.length` like this: `lastName.length`. +Você deve estar recebendo o tamanho de `lastName` ao usar `.length` dessa forma: `lastName.length`. ```js assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md index c035c81b1d..21eb2bc0c2 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244ae -title: Finding a Remainder in JavaScript +title: Descobrindo o Resto em JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cWP24Ub' forumTopicId: 18184 @@ -9,38 +9,38 @@ dashedName: finding-a-remainder-in-javascript # --description-- -The remainder operator `%` gives the remainder of the division of two numbers. +O operador de resto `%` retorna o resto da divisão de dois números. -**Example** +**Exemplo** -
        5 % 2 = 1 because
        Math.floor(5 / 2) = 2 (Quotient)
        2 * 2 = 4
        5 - 4 = 1 (Remainder)
        +
        5 % 2 = 1 porque
        Math.floor(5 / 2) = 2 (Quociente)
        2 * 2 = 4
        5 - 4 = 1 (Resto)
        -**Usage** -In mathematics, a number can be checked to be even or odd by checking the remainder of the division of the number by `2`. +**Uso** +Na matemática, um número pode ser verificado para ser par ou ímpar ao verificar o resto da divisão de um número por `2`. -
        17 % 2 = 1 (17 is Odd)
        48 % 2 = 0 (48 is Even)
        +
        17 % 2 = 1 (17 é Ímpar)
        48 % 2 = 0 (48 é Par)
        -**Note:** The remainder operator is sometimes incorrectly referred to as the modulus operator. It is very similar to modulus, but does not work properly with negative numbers. +**Nota:** O operador de resto às vezes é referido incorretamente como o operador de módulo. É muito semelhante ao módulo, mas não funciona adequadamente com números negativos. # --instructions-- -Set `remainder` equal to the remainder of `11` divided by `3` using the remainder (`%`) operator. +Define o `resto` igual ao restante de `11` dividido por `3` usando o operador de restante (`%`). # --hints-- -The variable `remainder` should be initialized +A variável `remainder` deve ser inicializada ```js assert(/var\s+?remainder/.test(code)); ``` -The value of `remainder` should be `2` +O valor de `remainder` deve ser `2` ```js assert(remainder === 2); ``` -You should use the `%` operator +Você deve usar o operador `%` ```js assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md index b538265afd..482c1fbf40 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md @@ -1,6 +1,6 @@ --- id: cf1111c1c11feddfaeb9bdef -title: Generate Random Fractions with JavaScript +title: Gerar Frações Aleatórias com JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cyWJJs3' forumTopicId: 18185 @@ -9,31 +9,31 @@ dashedName: generate-random-fractions-with-javascript # --description-- -Random numbers are useful for creating random behavior. +Números aleatórios são úteis para criar comportamento aleatório. -JavaScript has a `Math.random()` function that generates a random decimal number between `0` (inclusive) and `1` (exclusive). Thus `Math.random()` can return a `0` but never return a `1`. +JavaScript tem a função `Math.random()` que gera um número decimal aleatório entre `0` (incluso) e `1` (excluso). Assim, `Math.random()` pode retornar um `0` mas nunca retornará `1`. -**Note:** Like [Storing Values with the Assignment Operator](/learn/javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator), all function calls will be resolved before the `return` executes, so we can `return` the value of the `Math.random()` function. +**Nota:** Como [Armazenar Valores com Operador de Atribuição](/learn/javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator), todas as chamadas de funções serão resolvidas antes de executar o `return`, para que possamos `returnar` o valor da função de `Math.random()`. # --instructions-- -Change `randomFraction` to return a random number instead of returning `0`. +Altere `randomFraction` para retornar um número aleatório ao invés de retornar `0`. # --hints-- -`randomFraction` should return a random number. +`randomFraction` deve retornar um número aleatório. ```js assert(typeof randomFraction() === 'number'); ``` -The number returned by `randomFraction` should be a decimal. +O número retornado por `randomFraction` deve ser um decimal. ```js assert((randomFraction() + '').match(/\./g)); ``` -You should be using `Math.random` to generate the random decimal number. +Você deve estar usando `Math.random` para gerar o número decimal aleatório. ```js assert(code.match(/Math\.random/g).length >= 0); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md index 6795eb0564..5164c0074c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md @@ -1,6 +1,6 @@ --- id: cf1111c1c12feddfaeb1bdef -title: Generate Random Whole Numbers with JavaScript +title: Gerar Números Inteiros Aleatórios com JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cRn6bfr' forumTopicId: 18186 @@ -9,27 +9,27 @@ dashedName: generate-random-whole-numbers-with-javascript # --description-- -It's great that we can generate random decimal numbers, but it's even more useful if we use it to generate random whole numbers. +É ótimo podermos gerar números decimais aleatórios, mas é ainda mais útil se usarmos para gerar números inteiros aleatórios. -
        1. Use Math.random() to generate a random decimal.
        2. Multiply that random decimal by 20.
        3. Use another function, Math.floor() to round the number down to its nearest whole number.
        +
        1. Use Math.random() para gerar um decimal aleatório.
        2. Multiplique o decimal aleatório por 20.
        3. Use outra função, Math.floor() para arredondar o número para baixo para o número inteiro mais próximo.
        -Remember that `Math.random()` can never quite return a `1` and, because we're rounding down, it's impossible to actually get `20`. This technique will give us a whole number between `0` and `19`. +Lembre-se que `Math.random()` pode nunca retornar um `1` e, porque nós estamos arredondando, é impossível receber examente `20`. Essa técnica nos dará um número inteiro entre `0` e `19`. -Putting everything together, this is what our code looks like: +Juntando tudo, é assim que nosso código se parece: ```js Math.floor(Math.random() * 20); ``` -We are calling `Math.random()`, multiplying the result by 20, then passing the value to `Math.floor()` function to round the value down to the nearest whole number. +Nós estamos chamando `Math.random()`, multiplicando o resultado por 20, e em seguida passando o valor para a função `Math.floor()` para arredondar o valor para o número inteiro para baixo mais próximo. # --instructions-- -Use this technique to generate and return a random whole number between `0` and `9`. +Use essa técnica para gerar e retornar um número inteiro aleatório entre `0` e `9`. # --hints-- -The result of `randomWholeNum` should be a whole number. +O resultado de `randomWholeNum` deve ser um número inteiro. ```js assert( @@ -41,13 +41,13 @@ assert( ); ``` -You should use `Math.random` to generate a random number. +Você deve usar `Math.random` para gerar um número aleatório. ```js assert(code.match(/Math.random/g).length >= 1); ``` -You should have multiplied the result of `Math.random` by 10 to make it a number that is between zero and nine. +Você deve ter multiplicado o resultado de `Math.random` por 10 para torná-lo um número que está entre zero e nove. ```js assert( @@ -56,7 +56,7 @@ assert( ); ``` -You should use `Math.floor` to remove the decimal part of the number. +Você deve usar `Math.floor` para remover a parte decimal do número. ```js assert(code.match(/Math.floor/g).length >= 1); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md index d8e528a91a..24e082b05d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md @@ -1,6 +1,6 @@ --- id: cf1111c1c12feddfaeb2bdef -title: Generate Random Whole Numbers within a Range +title: Gere Números Inteiros Aleatórios dentro de um Intervalo challengeType: 1 videoUrl: 'https://scrimba.com/c/cm83yu6' forumTopicId: 18187 @@ -9,11 +9,11 @@ dashedName: generate-random-whole-numbers-within-a-range # --description-- -Instead of generating a random whole number between zero and a given number like we did before, we can generate a random whole number that falls within a range of two specific numbers. +Ao invés de gerar um número inteiro aleatório entre 0 e um número especificado como fizemos anteriormente, nós podemos gerar um número inteiro aleatório que cai entre um intervalo de dois números especificados. -To do this, we'll define a minimum number `min` and a maximum number `max`. +Para isso, definiremos um número mínimo `min` e um número máximo`max`. -Here's the formula we'll use. Take a moment to read it and try to understand what this code is doing: +Aqui está a fórmula que usaremos. Leve um momento para ler e entender o que esse código está fazendo: ```js Math.floor(Math.random() * (max - min + 1)) + min @@ -21,29 +21,29 @@ Math.floor(Math.random() * (max - min + 1)) + min # --instructions-- -Create a function called `randomRange` that takes a range `myMin` and `myMax` and returns a random whole number that's greater than or equal to `myMin`, and is less than or equal to `myMax`, inclusive. +Crie uma função chamada `randomRange` que recebe um intervalo de `myMin` e `myMax` e retorne um número inteiro aleatório que é maior ou igual a `myMin`, e é menor ou igual a `myMax`, inclusivo. # --hints-- -The lowest random number that can be generated by `randomRange` should be equal to your minimum number, `myMin`. +O menor número aleatório que poderá ser gerado por `randomRange` deve ser igual ao seu número mínimo, `myMin`. ```js assert(calcMin === 5); ``` -The highest random number that can be generated by `randomRange` should be equal to your maximum number, `myMax`. +O maior número aleatório que poderá ser gerado por `randomRange` deve ser igual ao seu número máximo, `myMax`. ```js assert(calcMax === 15); ``` -The random number generated by `randomRange` should be an integer, not a decimal. +O número aleatório gerado por `randomRange` deve ser um inteiro, não um decimal. ```js assert(randomRange(0, 1) % 1 === 0); ``` -`randomRange` should use both `myMax` and `myMin`, and return a random number in your range. +`randomRange` deve usar ambos `myMax` e `myMin` e retornar um número aleatório no seu intervalo. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md index 693ced55f4..85bcbc7c7d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244be -title: Global Scope and Functions +title: Escopo Global e Funções challengeType: 1 videoUrl: 'https://scrimba.com/c/cQM7mCN' forumTopicId: 18193 @@ -9,37 +9,37 @@ dashedName: global-scope-and-functions # --description-- -In JavaScript, scope refers to the visibility of variables. Variables which are defined outside of a function block have Global scope. This means, they can be seen everywhere in your JavaScript code. +Em JavaScript, escopo refere-se à visibilidade de variáveis. Variáveis que são definidas fora de um bloco de função tem o escopo Global. Isso significa, que elas podem ser vistas em qualquer lugar no seu código JavaScript. -Variables which are declared without the `var` keyword are automatically created in the `global` scope. This can create unintended consequences elsewhere in your code or when running a function again. You should always declare your variables with `var`. +Variáveis que são declaradas sem a palavra-chave `var` são automaticamente criadas no escopo `global`. Isso pode criar consequências indesejadas em outro lugar no seu código ou quando executando uma função novamente. Você sempre deve declarar suas variáveis com `var`. # --instructions-- -Using `var`, declare a global variable named `myGlobal` outside of any function. Initialize it with a value of `10`. +Usando `var`, declare uma variável global chamada `myGlobal` fora de qualquer função. Inicialize ela com o valor de `10`. -Inside function `fun1`, assign `5` to `oopsGlobal` ***without*** using the `var` keyword. +Dentro da função `fun1`, atribua `5` para `oopsGlobal` ***sem*** usar a palavra-chave `var`. # --hints-- -`myGlobal` should be defined +`myGlobal` deve ser definido ```js assert(typeof myGlobal != 'undefined'); ``` -`myGlobal` should have a value of `10` +`myGlobal` deve ter o valor de `10` ```js assert(myGlobal === 10); ``` -`myGlobal` should be declared using the `var` keyword +`myGlobal` deve ser declarada usando a palavra-chave `var` ```js assert(/var\s+myGlobal/.test(code)); ``` -`oopsGlobal` should be a global variable and have a value of `5` +`oopsGlobal` deve ser uma variável global e ter o valor de `5` ```js assert(typeof oopsGlobal != 'undefined' && oopsGlobal === 5); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md index a3ea78542a..4b7fd26a34 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244c0 -title: Global vs. Local Scope in Functions +title: Escopo Global vs Local em Funções challengeType: 1 videoUrl: 'https://scrimba.com/c/c2QwKH2' forumTopicId: 18194 @@ -9,9 +9,9 @@ dashedName: global-vs--local-scope-in-functions # --description-- -It is possible to have both local and global variables with the same name. When you do this, the local variable takes precedence over the global variable. +É possível ter ambas variáveis local e global com o mesmo nome. Quando você faz isso, a variável local tem precedência sobre a variável global. -In this example: +Neste exemplo: ```js var someVar = "Hat"; @@ -21,27 +21,27 @@ function myFun() { } ``` -The function `myFun` will return the string `Head` because the local version of the variable is present. +A função `myFun` retornará a string `Head` porque a versão local da variável está presente. # --instructions-- -Add a local variable to `myOutfit` function to override the value of `outerWear` with the string `sweater`. +Adicione uma variável local para a função `myOutfit` para sobrescrever o valor de `outerWear` com a string `sweater`. # --hints-- -You should not change the value of the global `outerWear`. +Você não deve alterar o valor da variável global `outerWear`. ```js assert(outerWear === 'T-Shirt'); ``` -`myOutfit` should return the string `sweater`. +`myOutfit` deve retornar a string `sweater`. ```js assert(myOutfit() === 'sweater'); ``` -You should not change the return statement. +Você não deve alterar a instrução de retorno. ```js assert(/return outerWear/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md index cc1d2fa8bb..bd55a16b29 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md @@ -1,6 +1,6 @@ --- id: 5664820f61c48e80c9fa476c -title: Golf Code +title: Código de Golfe challengeType: 1 videoUrl: 'https://scrimba.com/c/c9ykNUR' forumTopicId: 18195 @@ -9,77 +9,77 @@ dashedName: golf-code # --description-- -In the game of [golf](https://en.wikipedia.org/wiki/Golf), each hole has a `par`, meaning, the average number of `strokes` a golfer is expected to make in order to sink the ball in the hole to complete the play. Depending on how far above or below `par` your `strokes` are, there is a different nickname. +No jogo [golf](https://en.wikipedia.org/wiki/Golf), cada buraco tem um `par`, significando, o número médio de `strokes` que um golfista é esperado fazer afim de derrubar a bola no buraco para completar a jogada. Dependendo do quão distante acima ou abaixo de `par` suas `strokes` estiverem, há diferentes apelidos. -Your function will be passed `par` and `strokes` arguments. Return the correct string according to this table which lists the strokes in order of priority; top (highest) to bottom (lowest): +Sua função receberá os argumentos `par` e `strokes`. Retorna a string correta de acordo com esta tabela que lista os strokes em ordem de prioridade; superior (mais alta) para o final (mais baixo): -
        StrokesReturn
        1"Hole-in-one!"
        <= par - 2"Eagle"
        par - 1"Birdie"
        par"Par"
        par + 1"Bogey"
        par + 2"Double Bogey"
        >= par + 3"Go Home!"
        +
        StrokesRetorno
        1"Hole-in-one!"
        <= par - 2"Eagle"
        par - 1"Birdie"
        par"Par"
        par + 1"Bogey"
        par + 2"Double Bogey"
        >= par + 3"Go Home!"
        -`par` and `strokes` will always be numeric and positive. We have added an array of all the names for your convenience. +`par` e `strokes` sempre será um número e positivo. Nós adicionamos um array com todos os nomes para sua conveniência. # --hints-- -`golfScore(4, 1)` should return the string `Hole-in-one!` +`golfScore(4, 1)` deve retornar a string `Hole-in-one!` ```js assert(golfScore(4, 1) === 'Hole-in-one!'); ``` -`golfScore(4, 2)` should return the string `Eagle` +`golfScore(4, 2)` deve retornar a string `Eagle` ```js assert(golfScore(4, 2) === 'Eagle'); ``` -`golfScore(5, 2)` should return the string `Eagle` +`golfScore(5, 2)` deve retornar a string `Eagle` ```js assert(golfScore(5, 2) === 'Eagle'); ``` -`golfScore(4, 3)` should return the string `Birdie` +`golfScore(4, 3)` deve retornar a string `Birdie` ```js assert(golfScore(4, 3) === 'Birdie'); ``` -`golfScore(4, 4)` should return the string `Par` +`golfScore(4, 4)` deve retornar a string `Par` ```js assert(golfScore(4, 4) === 'Par'); ``` -`golfScore(1, 1)` should return the string `Hole-in-one!` +`golfScore(1, 1)` deve retornar a string `Hole-in-one!` ```js assert(golfScore(1, 1) === 'Hole-in-one!'); ``` -`golfScore(5, 5)` should return the string `Par` +`golfScore(5, 5)` deve retornar a string `Par` ```js assert(golfScore(5, 5) === 'Par'); ``` -`golfScore(4, 5)` should return the string `Bogey` +`golfScore(4, 5)` deve retornar a string `Bogey` ```js assert(golfScore(4, 5) === 'Bogey'); ``` -`golfScore(4, 6)` should return the string `Double Bogey` +`golfScore(4, 6)` deve retornar a string `Double Bogey` ```js assert(golfScore(4, 6) === 'Double Bogey'); ``` -`golfScore(4, 7)` should return the string `Go Home!` +`golfScore(4, 7)` deve retornar a string `Go Home!` ```js assert(golfScore(4, 7) === 'Go Home!'); ``` -`golfScore(5, 9)` should return the string `Go Home!` +`golfScore(5, 9)` deve retornar a string `Go Home!` ```js assert(golfScore(5, 9) === 'Go Home!'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md index 36cbecd62c..310597ad6f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md @@ -96,10 +96,10 @@ var contacts = [ ]; -function lookUpProfile(name, prop){ -// Only change code below this line +function lookUpProfile(name, prop) { + // Only change code below this line -// Only change code above this line + // Only change code above this line } lookUpProfile("Akira", "likes"); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md index 89076ed28c..1d882d80d6 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md @@ -90,10 +90,10 @@ testArr = [1,2,3,4,5]; ```js function nextInLine(arr, item) { // Only change code below this line - + return item; // Only change code above this line - + } diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index 4250078f7e..8d1c2233a5 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -128,7 +128,7 @@ function checkScope() { let i = 'block scope'; console.log('Block scope i is: ', i); } - + console.log('Function scope i is: ', i); return i; } diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index 83fb671b57..aea3b4dd18 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -52,7 +52,7 @@ assert( const makeServerRequest = new Promise((resolve, reject) => { // responseFromServer represents a response from a server let responseFromServer; - + if(responseFromServer) { // Change this line } else { diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index 682bab1df3..1a3c81bd73 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -12,7 +12,7 @@ Promises are most useful when you have a process that takes an unknown amount of ```js myPromise.then(result => { - + }); ``` @@ -63,7 +63,7 @@ const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.te const makeServerRequest = new Promise((resolve, reject) => { // responseFromServer is set to true to represent a successful response from a server let responseFromServer = true; - + if(responseFromServer) { resolve("We got the data"); } else { @@ -78,7 +78,7 @@ const makeServerRequest = new Promise((resolve, reject) => { const makeServerRequest = new Promise((resolve, reject) => { // responseFromServer is set to true to represent a successful response from a server let responseFromServer = true; - + if(responseFromServer) { resolve("We got the data"); } else { diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index a0ac218b64..9cf7ab1146 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -12,7 +12,7 @@ dashedName: handle-a-rejected-promise-with-catch ```js myPromise.catch(error => { - + }); ``` @@ -63,7 +63,7 @@ const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test( const makeServerRequest = new Promise((resolve, reject) => { // responseFromServer is set to false to represent an unsuccessful response from a server let responseFromServer = false; - + if(responseFromServer) { resolve("We got the data"); } else { @@ -82,7 +82,7 @@ makeServerRequest.then(result => { const makeServerRequest = new Promise((resolve, reject) => { // responseFromServer is set to false to represent an unsuccessful response from a server let responseFromServer = false; - + if(responseFromServer) { resolve("We got the data"); } else { diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index 115ad02bd7..d8a0a3d465 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -33,7 +33,7 @@ assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); ## --seed-contents-- ```js - + // Only change code above this line subtract(7,4); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index 1a21ddbb05..ff3449dd2f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -53,7 +53,7 @@ assert( ## --seed-contents-- ```js - + // Only change code above this line uppercaseString("hello"); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index 61f1f42ed6..23f5ff9888 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -86,7 +86,7 @@ const LOCAL_FORECAST = { }; // Only change code below this line - + const lowToday = LOCAL_FORECAST.today.low; const highToday = LOCAL_FORECAST.today.high; @@ -101,6 +101,6 @@ const LOCAL_FORECAST = { today: { low: 64, high: 77 }, tomorrow: { low: 68, high: 80 } }; - + const { today: { low: lowToday, high: highToday }} = LOCAL_FORECAST; ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index e14f1624a6..a4d5d90073 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -77,7 +77,7 @@ const HIGH_TEMPERATURES = { }; // Only change code below this line - + const highToday = HIGH_TEMPERATURES.today; const highTomorrow = HIGH_TEMPERATURES.tomorrow; diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index ca574e0f17..6d170fa01f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -1,8 +1,7 @@ --- id: 587d7b8a367417b2b2512b4c title: >- - Use Destructuring Assignment with the Rest Parameter to Reassign Array - Elements + Use Destructuring Assignment with the Rest Parameter to Reassign Array Elements challengeType: 1 forumTopicId: 301218 dashedName: >- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.md index c46878caf1..fb25aa95ee 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.md @@ -14,7 +14,7 @@ These are classically called getters and setters. Getter functions are meant to simply return (get) the value of an object's private variable to the user without the user directly accessing the private variable. -Setter functions are meant to modify (set) the value of an object's private variable based on the value passed into the setter function. This change could involve calculations, or even overwriting the previous value completely. +Setter functions are meant to modify (set) the value of an object's private variable based on the value passed into the setter function. This change could involve calculations, or even overwriting the previous value completely. ```js class Book { diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.md index 3c37f65800..c96910a483 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.md @@ -73,7 +73,7 @@ const prepareTea = () => 'greenTea'; const getTea = (numOfCups) => { const teaCups = []; - + for(let cups = 1; cups <= numOfCups; cups += 1) { const teaCup = prepareTea(); teaCups.push(teaCup); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md index 2ca1573cc1..19d7d355e9 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md @@ -76,5 +76,5 @@ function incrementer (fixedValue) { // Only change code above this line } - + ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md index 33d95dd152..0eea537b77 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md @@ -93,7 +93,7 @@ function add (bookName) { bookList.push(bookName); return bookList; - + // Change code above this line } diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md index 6a04216752..ab1f85159f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md @@ -40,7 +40,7 @@ assert( `nonMutatingSort(globalArray)` should not be hard coded. ```js -assert(!nonMutatingSort.toString().match(/[23569]/g)); +assert(!nonMutatingSort.toString().match(/\[.*?[23569].*?\]/gs)); ``` The function should return a new array, not the array passed to it. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 253dfefbd6..2a5baec172 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -33,11 +33,11 @@ const names = users.map(user => user.name); console.log(names); ``` -The console would display the value ` [ 'John', 'Amy', 'camperCat' ]`. +The console would display the value `[ 'John', 'Amy', 'camperCat' ]`. # --instructions-- -The `watchList` array holds objects with information on several movies. Use `map` on `watchList` to assign a new array of objects with only `title` and `rating` keys to the `ratings` variable. The code in the editor currently uses a `for` loop to do this, so you should replace the loop functionality with your `map` expression. +The `watchList` array holds objects with information on several movies. Use `map` on `watchList` to assign a new array of objects to the `ratings` variable. Each movie in the new array should have only a `title` key with the name of the film, and a `rating` key with the IMDB rating. The code in the editor currently uses a `for` loop to do this, so you should replace the loop functionality with your `map` expression. # --hints-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md index db936ea17d..8441ee648a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md @@ -1,8 +1,7 @@ --- id: 587d7db2367417b2b2512b8a title: >- - Use Closure to Protect Properties Within an Object from Being Modified - Externally + Use Closure to Protect Properties Within an Object from Being Modified Externally challengeType: 1 forumTopicId: 18234 dashedName: >- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/add-elements-within-your-bootstrap-wells.md b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/add-elements-within-your-bootstrap-wells.md index 2326bddd3c..b1b057082d 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/add-elements-within-your-bootstrap-wells.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/add-elements-within-your-bootstrap-wells.md @@ -1,6 +1,6 @@ --- id: bad87fee1348bd9aec908849 -title: Add Elements within Your Bootstrap Wells +title: Adicione elementos em seus Bootstrap Wells challengeType: 0 forumTopicId: 16636 dashedName: add-elements-within-your-bootstrap-wells @@ -8,9 +8,9 @@ dashedName: add-elements-within-your-bootstrap-wells # --description-- -Now we're several `div` elements deep on each column of our row. This is as deep as we'll need to go. Now we can add our `button` elements. +Agora estamos na profundidade de diversos elementos `div` em cada coluna da nossa linha. Isso é tão profundo quanto precisamos ir. Agora podemos adicionar nossos elementos `button`. -Nest three `button` elements within each of your `div` elements having the class name `well`. +Aninhe três elementos `button` dentro de cada um de seus elementos `div` contendo o nome de classe `well`. # --hints-- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-all-of-our-buttons.md b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-all-of-our-buttons.md index 9c9a200e02..df7787bf53 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-all-of-our-buttons.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-all-of-our-buttons.md @@ -4,7 +4,8 @@ title: Add Font Awesome Icons to all of our Buttons challengeType: 0 forumTopicId: 16637 required: - - link: 'https://use.fontawesome.com/releases/v5.8.1/css/all.css' + - + link: 'https://use.fontawesome.com/releases/v5.8.1/css/all.css' raw: true dashedName: add-font-awesome-icons-to-all-of-our-buttons --- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-our-buttons.md b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-our-buttons.md index bda1cf6d31..54ec6ddc57 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-our-buttons.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-our-buttons.md @@ -4,7 +4,8 @@ title: Add Font Awesome Icons to our Buttons challengeType: 0 forumTopicId: 16638 required: - - link: 'https://use.fontawesome.com/releases/v5.8.1/css/all.css' + - + link: 'https://use.fontawesome.com/releases/v5.8.1/css/all.css' raw: true dashedName: add-font-awesome-icons-to-our-buttons --- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/line-up-form-elements-responsively-with-bootstrap.md b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/line-up-form-elements-responsively-with-bootstrap.md index 426dad2cb4..b6037f8333 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/line-up-form-elements-responsively-with-bootstrap.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/line-up-form-elements-responsively-with-bootstrap.md @@ -4,7 +4,8 @@ title: Line up Form Elements Responsively with Bootstrap challengeType: 0 forumTopicId: 18225 required: - - link: >- + - + link: >- https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.css raw: true dashedName: line-up-form-elements-responsively-with-bootstrap diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/responsively-style-checkboxes.md b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/responsively-style-checkboxes.md index 33c062bdf5..8fcf0774c8 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/responsively-style-checkboxes.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/responsively-style-checkboxes.md @@ -4,7 +4,8 @@ title: Responsively Style Checkboxes challengeType: 0 forumTopicId: 18269 required: - - link: >- + - + link: >- https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.css raw: true dashedName: responsively-style-checkboxes diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/responsively-style-radio-buttons.md b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/responsively-style-radio-buttons.md index b2ec1682b3..3541d7fead 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/responsively-style-radio-buttons.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/responsively-style-radio-buttons.md @@ -4,7 +4,8 @@ title: Responsively Style Radio Buttons challengeType: 0 forumTopicId: 18270 required: - - link: >- + - + link: >- https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.css raw: true dashedName: responsively-style-radio-buttons diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/style-text-inputs-as-form-controls.md b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/style-text-inputs-as-form-controls.md index ddbc6ab0ab..513456f26c 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/style-text-inputs-as-form-controls.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/style-text-inputs-as-form-controls.md @@ -4,7 +4,8 @@ title: Style Text Inputs as Form Controls challengeType: 0 forumTopicId: 18312 required: - - link: >- + - + link: >- https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.css raw: true dashedName: style-text-inputs-as-form-controls diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/use-the-bootstrap-grid-to-put-elements-side-by-side.md b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/use-the-bootstrap-grid-to-put-elements-side-by-side.md index 67a3387379..17f0f4c146 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/use-the-bootstrap-grid-to-put-elements-side-by-side.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/bootstrap/use-the-bootstrap-grid-to-put-elements-side-by-side.md @@ -170,7 +170,7 @@ assert(
  • - +

    Things cats love:

    • cat nip
    • diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/front-end-libraries-projects/build-a-javascript-calculator.md b/curriculum/challenges/portuguese/03-front-end-libraries/front-end-libraries-projects/build-a-javascript-calculator.md index cb20e900bb..7b8a3bc217 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/front-end-libraries-projects/build-a-javascript-calculator.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/front-end-libraries-projects/build-a-javascript-calculator.md @@ -46,7 +46,7 @@ You can use any mix of HTML, JavaScript, CSS, Bootstrap, SASS, React, Redux, and **Note On Calculator Logic:** It should be noted that there are two main schools of thought on calculator input logic: immediate execution logic and formula logic. Our example utilizes formula logic and observes order of operation precedence, immediate execution does not. Either is acceptable, but please note that depending on which you choose, your calculator may yield different results than ours for certain equations (see below example). As long as your math can be verified by another production calculator, please do not consider this a bug. -**EXAMPLE:** `3 + 5 x 6 - 2 / 4 =` +**EXAMPLE:** `3 + 5 x 6 - 2 / 4 =` - **Immediate Execution Logic:** `11.5` - **Formula/Expression Logic:** `32.5` diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/change-the-css-of-an-element-using-jquery.md b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/change-the-css-of-an-element-using-jquery.md index aa09b454b9..1e999e8ba1 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/change-the-css-of-an-element-using-jquery.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/change-the-css-of-an-element-using-jquery.md @@ -4,7 +4,8 @@ title: Change the CSS of an Element Using jQuery challengeType: 6 forumTopicId: 16776 required: - - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' + - + link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' dashedName: change-the-css-of-an-element-using-jquery --- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/delete-your-jquery-functions.md b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/delete-your-jquery-functions.md index e5d188bff7..331b225990 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/delete-your-jquery-functions.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/delete-your-jquery-functions.md @@ -4,7 +4,8 @@ title: Delete Your jQuery Functions challengeType: 6 forumTopicId: 17561 required: - - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' + - + link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' dashedName: delete-your-jquery-functions --- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/remove-classes-from-an-element-with-jquery.md b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/remove-classes-from-an-element-with-jquery.md index 7df3b8052f..a63b5882c7 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/remove-classes-from-an-element-with-jquery.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/remove-classes-from-an-element-with-jquery.md @@ -4,7 +4,8 @@ title: Remove Classes from an Element with jQuery challengeType: 6 forumTopicId: 18264 required: - - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' + - + link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' dashedName: remove-classes-from-an-element-with-jquery --- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-a-specific-child-of-an-element-using-jquery.md b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-a-specific-child-of-an-element-using-jquery.md index 0e082e179f..12934f268b 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-a-specific-child-of-an-element-using-jquery.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-a-specific-child-of-an-element-using-jquery.md @@ -4,7 +4,8 @@ title: Target a Specific Child of an Element Using jQuery challengeType: 6 forumTopicId: 18315 required: - - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' + - + link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' dashedName: target-a-specific-child-of-an-element-using-jquery --- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-elements-by-class-using-jquery.md b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-elements-by-class-using-jquery.md index 525a6106cf..dfd7a970d3 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-elements-by-class-using-jquery.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-elements-by-class-using-jquery.md @@ -4,7 +4,8 @@ title: Target Elements by Class Using jQuery challengeType: 6 forumTopicId: 18316 required: - - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' + - + link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' dashedName: target-elements-by-class-using-jquery --- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-elements-by-id-using-jquery.md b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-elements-by-id-using-jquery.md index e63f60b4e5..085c1552a0 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-elements-by-id-using-jquery.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-elements-by-id-using-jquery.md @@ -4,7 +4,8 @@ title: Target Elements by id Using jQuery challengeType: 6 forumTopicId: 18317 required: - - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' + - + link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' dashedName: target-elements-by-id-using-jquery --- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-even-elements-using-jquery.md b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-even-elements-using-jquery.md index d89318eb3e..a6c8b20ddd 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-even-elements-using-jquery.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-even-elements-using-jquery.md @@ -4,7 +4,8 @@ title: Target Even Elements Using jQuery challengeType: 6 forumTopicId: 18318 required: - - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' + - + link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' dashedName: target-even-elements-using-jquery --- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-html-elements-with-selectors-using-jquery.md b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-html-elements-with-selectors-using-jquery.md index 5b45498d38..e63103ff7b 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-html-elements-with-selectors-using-jquery.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-html-elements-with-selectors-using-jquery.md @@ -4,7 +4,8 @@ title: Target HTML Elements with Selectors Using jQuery challengeType: 6 forumTopicId: 18319 required: - - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' + - + link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' dashedName: target-html-elements-with-selectors-using-jquery --- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-the-same-element-with-multiple-jquery-selectors.md b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-the-same-element-with-multiple-jquery-selectors.md index 65e25dbc54..3ab02d8057 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-the-same-element-with-multiple-jquery-selectors.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/target-the-same-element-with-multiple-jquery-selectors.md @@ -4,7 +4,8 @@ title: Target the Same Element with Multiple jQuery Selectors challengeType: 6 forumTopicId: 18322 required: - - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' + - + link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' dashedName: target-the-same-element-with-multiple-jquery-selectors --- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/use-jquery-to-modify-the-entire-page.md b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/use-jquery-to-modify-the-entire-page.md index 4123f59226..540607dfe7 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/jquery/use-jquery-to-modify-the-entire-page.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/jquery/use-jquery-to-modify-the-entire-page.md @@ -4,7 +4,8 @@ title: Use jQuery to Modify the Entire Page challengeType: 6 forumTopicId: 18361 required: - - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' + - + link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' dashedName: use-jquery-to-modify-the-entire-page --- diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/react/create-a-controlled-form.md b/curriculum/challenges/portuguese/03-front-end-libraries/react/create-a-controlled-form.md index 1990de794d..efb076c172 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/react/create-a-controlled-form.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/react/create-a-controlled-form.md @@ -16,7 +16,7 @@ The `MyForm` component is set up with an empty `form` with a submit handler. The We've added a button which submits the form. You can see it has the `type` set to `submit` indicating it is the button controlling the form. Add the `input` element in the `form` and set its `value` and `onChange()` attributes like the last challenge. You should then complete the `handleSubmit` method so that it sets the component state property `submit` to the current input value in the local `state`. -**Note:** You also must call `event.preventDefault()` in the submit handler, to prevent the default form submit behavior which will refresh the web page. +**Note:** You also must call `event.preventDefault()` in the submit handler, to prevent the default form submit behavior which will refresh the web page. For camper convenience, the default behavior has been disabled here to prevent refreshes from resetting challenge code. Finally, create an `h1` tag after the `form` which renders the `submit` value from the component's `state`. You can then type in the form and click the button (or press enter), and you should see your input rendered to the page. @@ -98,6 +98,25 @@ Submitting the form should run `handleSubmit` which should set the `submit` prop })(); ``` +`handleSubmit` should call `event.preventDefault` + +```js +const handleSubmit = MyForm.prototype.handleSubmit.toString(); +const allMatches = handleSubmit.match(/\bevent\.preventDefault\(\s*?\)/g) ?? []; +const blockCommented = handleSubmit.match( + /\/\*.*?\bevent\.preventDefault\(\s*?\).*?\*\//gs +); +const lineCommented = handleSubmit.match( + /\/\/.*?\bevent\.preventDefault\(\s*?\)/g +); +const commentedMatches = [...(blockCommented ?? []), ...(lineCommented ?? [])]; + +assert( + // At least one event.preventDefault() call exists and is not commented out + allMatches.length > commentedMatches.length +); +``` + The `h1` header should render the value of the `submit` field from the component's state. ```js @@ -149,7 +168,7 @@ class MyForm extends React.Component { } handleSubmit(event) { // Change code below this line - + // Change code above this line } render() { diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/react/give-sibling-elements-a-unique-key-attribute.md b/curriculum/challenges/portuguese/03-front-end-libraries/react/give-sibling-elements-a-unique-key-attribute.md index 23751b823b..49bf695b42 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/react/give-sibling-elements-a-unique-key-attribute.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/react/give-sibling-elements-a-unique-key-attribute.md @@ -8,7 +8,7 @@ dashedName: give-sibling-elements-a-unique-key-attribute # --description-- -The last challenge showed how the `map` method is used to dynamically render a number of elements based on user input. However, there was an important piece missing from that example. When you create an array of elements, each one needs a `key` attribute set to a unique value. React uses these keys to keep track of which items are added, changed, or removed. This helps make the re-rendering process more efficient when the list is modified in any way. +The last challenge showed how the `map` method is used to dynamically render a number of elements based on user input. However, there was an important piece missing from that example. When you create an array of elements, each one needs a `key` attribute set to a unique value. React uses these keys to keep track of which items are added, changed, or removed. This helps make the re-rendering process more efficient when the list is modified in any way. **Note:** Keys only need to be unique between sibling elements, they don't need to be globally unique in your application. diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/react/render-state-in-the-user-interface.md b/curriculum/challenges/portuguese/03-front-end-libraries/react/render-state-in-the-user-interface.md index 766b22bd9a..9a4f2fbf9a 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/react/render-state-in-the-user-interface.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/react/render-state-in-the-user-interface.md @@ -43,7 +43,7 @@ assert( ); ``` -The rendered `h1` header should contain text rendered from the component's state. +The rendered `h1` header should only contain text rendered from the component's state. ```js async () => { diff --git a/curriculum/challenges/portuguese/03-front-end-libraries/redux/use-const-for-action-types.md b/curriculum/challenges/portuguese/03-front-end-libraries/redux/use-const-for-action-types.md index 5893acce88..e34d2505f4 100644 --- a/curriculum/challenges/portuguese/03-front-end-libraries/redux/use-const-for-action-types.md +++ b/curriculum/challenges/portuguese/03-front-end-libraries/redux/use-const-for-action-types.md @@ -88,8 +88,9 @@ The `authReducer` function should handle multiple action types with a switch sta ```js const noWhiteSpace = __helpers.removeWhiteSpace(code); assert( - /constLOGIN=(['"`])LOGIN\1/.test(noWhiteSpace) && - /constLOGOUT=(['"`])LOGOUT\1/.test(noWhiteSpace) + (/constLOGIN=(['"`])LOGIN\1/.test(noWhiteSpace) && + /constLOGOUT=(['"`])LOGOUT\1/.test(noWhiteSpace)) || + /const(LOGIN|LOGOUT)=(['"`])\1\2,(?!\1)(LOGIN|LOGOUT)=(['"`])\3\4/.test(noWhiteSpace) ); ``` diff --git a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map.md b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map.md index 65592f0262..8367df6732 100644 --- a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map.md +++ b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map.md @@ -36,7 +36,7 @@ You can use HTML, JavaScript, CSS, and the D3 svg-based visualization library. R **User Story #11:** My tooltip should have a `data-education` property that corresponds to the `data-education` of the active area. -Here are the datasets you will need to complete this project: +Here are the datasets you will need to complete this project: - **US Education Data:**`https://cdn.freecodecamp.org/testable-projects-fcc/data/choropleth_map/for_user_education.json` - **US County Data:**`https://cdn.freecodecamp.org/testable-projects-fcc/data/choropleth_map/counties.json` diff --git a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram.md b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram.md index 0409447ea7..3f5196b244 100644 --- a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram.md +++ b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram.md @@ -36,7 +36,7 @@ You can use HTML, JavaScript, CSS, and the D3 svg-based visualization library. T **User Story #11:** My tooltip should have a `data-value` property that corresponds to the `data-value` of the active area. -For this project you can use any of the following datasets: +For this project you can use any of the following datasets: - **Kickstarter Pledges:** `https://cdn.freecodecamp.org/testable-projects-fcc/data/tree_map/kickstarter-funding-data.json` - **Movie Sales:** `https://cdn.freecodecamp.org/testable-projects-fcc/data/tree_map/movie-data.json` diff --git a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element.md b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element.md index 28ee20400f..869ca675f9 100644 --- a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element.md +++ b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element.md @@ -160,7 +160,7 @@ assert($('title').eq(8).text() == '9'); .attr("class", "bar") .append("title") .text((d) => d) - + svg.selectAll("text") .data(dataset) diff --git a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/add-axes-to-a-visualization.md b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/add-axes-to-a-visualization.md index 20dcceba1b..a1f0bd70dd 100644 --- a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/add-axes-to-a-visualization.md +++ b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/add-axes-to-a-visualization.md @@ -181,9 +181,9 @@ assert(code.match(/\.call\(\s*yAxis\s*\)/g)); .attr("y", (d) => yScale(d[1])) const xAxis = d3.axisBottom(xScale); - + const yAxis = d3.axisLeft(yScale); - + svg.append("g") .attr("transform", "translate(0," + (h - padding) + ")") diff --git a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/add-labels-to-scatter-plot-circles.md b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/add-labels-to-scatter-plot-circles.md index 0ad9ff3fba..a2cd64c0a4 100644 --- a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/add-labels-to-scatter-plot-circles.md +++ b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/add-labels-to-scatter-plot-circles.md @@ -218,7 +218,7 @@ assert( .attr("x", (d) => d[0] + 5) .attr("y", (d) => h - d[1]) .text((d) => (d[0] + ", " + d[1])) - + ``` diff --git a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/change-the-presentation-of-a-bar-chart.md b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/change-the-presentation-of-a-bar-chart.md index 9112736602..46b6e2613d 100644 --- a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/change-the-presentation-of-a-bar-chart.md +++ b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/change-the-presentation-of-a-bar-chart.md @@ -114,7 +114,7 @@ assert( height: 100px; /* Add your code below this line */ - + /* Add your code above this line */ display: inline-block; background-color: blue; diff --git a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/use-the-d3.max-and-d3.min-functions-to-find-minimum-and-maximum-values-in-a-dataset.md b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/use-the-d3.max-and-d3.min-functions-to-find-minimum-and-maximum-values-in-a-dataset.md index 786b313b21..7736dd35ef 100644 --- a/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/use-the-d3.max-and-d3.min-functions-to-find-minimum-and-maximum-values-in-a-dataset.md +++ b/curriculum/challenges/portuguese/04-data-visualization/data-visualization-with-d3/use-the-d3.max-and-d3.min-functions-to-find-minimum-and-maximum-values-in-a-dataset.md @@ -1,8 +1,7 @@ --- id: 587d7fac367417b2b2512bdc title: >- - Use the d3.max and d3.min Functions to Find Minimum and Maximum Values in a - Dataset + Use the d3.max and d3.min Functions to Find Minimum and Maximum Values in a Dataset challengeType: 6 forumTopicId: 301496 dashedName: >- diff --git a/curriculum/challenges/portuguese/04-data-visualization/json-apis-and-ajax/get-json-with-the-javascript-fetch-method.md b/curriculum/challenges/portuguese/04-data-visualization/json-apis-and-ajax/get-json-with-the-javascript-fetch-method.md index f1a4c26f29..36b522ce91 100644 --- a/curriculum/challenges/portuguese/04-data-visualization/json-apis-and-ajax/get-json-with-the-javascript-fetch-method.md +++ b/curriculum/challenges/portuguese/04-data-visualization/json-apis-and-ajax/get-json-with-the-javascript-fetch-method.md @@ -15,10 +15,10 @@ Here is the code for making a GET request to `/json/cats.json` ```js fetch('/json/cats.json') - .then(response => response.json()) - .then(data => { - document.getElementById('message').innerHTML = JSON.stringify(data); - }) + .then(response => response.json()) + .then(data => { + document.getElementById('message').innerHTML = JSON.stringify(data); + }) ``` diff --git a/curriculum/challenges/portuguese/04-data-visualization/json-apis-and-ajax/post-data-with-the-javascript-xmlhttprequest-method.md b/curriculum/challenges/portuguese/04-data-visualization/json-apis-and-ajax/post-data-with-the-javascript-xmlhttprequest-method.md index 059f7dce49..b1a807c2be 100644 --- a/curriculum/challenges/portuguese/04-data-visualization/json-apis-and-ajax/post-data-with-the-javascript-xmlhttprequest-method.md +++ b/curriculum/challenges/portuguese/04-data-visualization/json-apis-and-ajax/post-data-with-the-javascript-xmlhttprequest-method.md @@ -30,7 +30,7 @@ You've seen several of these methods before. Here the `open` method initializes # --instructions-- -Update the code so it makes a `POST` request to the API endpoint. Then type your name in the input field and click `Send Message`. Your AJAX function should replace `Reply from Server will be here.` with data from the server. Format the response to display your name appended with the text ` loves cats`. +Update the code so it makes a `POST` request to the API endpoint. Then type your name in the input field and click `Send Message`. Your AJAX function should replace `Reply from Server will be here.` with data from the server. Format the response to display your name appended with the text `loves cats`. # --hints-- diff --git a/curriculum/challenges/portuguese/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md b/curriculum/challenges/portuguese/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md index ce5af55213..3020f56e31 100644 --- a/curriculum/challenges/portuguese/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md +++ b/curriculum/challenges/portuguese/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md @@ -35,7 +35,7 @@ io.use( Be sure to add the `key` and `store` to the `session` middleware mounted on the app. This is necessary to tell *SocketIO* which session to relate to. -
      +
      Now, define the `success`, and `fail` callback functions: diff --git a/curriculum/challenges/portuguese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md b/curriculum/challenges/portuguese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md index 43740bdac5..3cc137ac92 100644 --- a/curriculum/challenges/portuguese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md +++ b/curriculum/challenges/portuguese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md @@ -78,7 +78,7 @@ GitHub strategy should be setup correctly thus far. (data) => { assert.match( data, - /passport\.use.*new GitHubStrategy/gi, + /passport\.use.*new GitHubStrategy/gis, 'Passport should use a new GitHubStrategy' ); assert.match( diff --git a/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/american-british-translator.md b/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/american-british-translator.md index 0f778edc57..5f932d6168 100644 --- a/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/american-british-translator.md +++ b/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/american-british-translator.md @@ -130,7 +130,7 @@ async (getUserInput) => { }; ``` -The `/api/translate` route should also handle the way titles/honorifics are abbreviated in American and British English. For example, Doctor Wright is abbreviated as "Dr Wright" in British English and "Dr. Wright" in American English. See `/public/american-to-british-titles.js` for the different titles your application should handle. +The `/api/translate` route should also handle the way titles/honorifics are abbreviated in American and British English. For example, Doctor Wright is abbreviated as "Dr Wright" in British English and "Dr. Wright" in American English. See `/components/american-to-british-titles.js` for the different titles your application should handle. ```js async (getUserInput) => { diff --git a/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/personal-library.md b/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/personal-library.md index f0bec1330e..6254a8c417 100644 --- a/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/personal-library.md +++ b/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/personal-library.md @@ -18,8 +18,7 @@ When you are done, make sure a working demo of your project is hosted somewhere # --instructions-- -1. Add your MongoDB connection string to `.env` without quotes as `DB` - Example: `DB=mongodb://admin:pass@1234.mlab.com:1234/fccpersonallib` +1. Add your MongoDB connection string to `.env` without quotes as `DB` Example: `DB=mongodb://admin:pass@1234.mlab.com:1234/fccpersonallib` 2. In your `.env` file set `NODE_ENV` to `test`, without quotes 3. You need to create all routes within `routes/api.js` 4. You will create all functional tests in `tests/2_functional-tests.js` diff --git a/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md b/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md index 79f9512fc1..b371014bf5 100644 --- a/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md +++ b/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md @@ -40,7 +40,7 @@ Write the following tests in `tests/1_unit-tests.js`: - Logic handles an invalid region (3x3 grid) placement - Valid puzzle strings pass the solver - Invalid puzzle strings fail the solver -- Solver returns the the expected solution for an incomplete puzzle +- Solver returns the expected solution for an incomplete puzzle Write the following tests in `tests/2_functional-tests.js` diff --git a/curriculum/challenges/portuguese/07-scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter.md b/curriculum/challenges/portuguese/07-scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter.md index adf4f36e7c..b03590db98 100644 --- a/curriculum/challenges/portuguese/07-scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter.md +++ b/curriculum/challenges/portuguese/07-scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter.md @@ -16,8 +16,7 @@ After going to that link, fork the project. Once you complete the project based We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you everything you need to know to complete this project: -
        -
      • +
        • Python for Everybody Video Course (14 hours)
        • diff --git a/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.md b/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.md index 284a5eabab..1585b497b2 100644 --- a/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.md +++ b/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.md @@ -12,7 +12,7 @@ dashedName: parsing-html-and-saving-data More resources: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas) +- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/tree/master/unit-1-reading-data-with-python-and-pandas/lesson-17-reading-html-tables/files) - [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- diff --git a/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.md b/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.md index 18d6487a0a..442d815a51 100644 --- a/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.md +++ b/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.md @@ -12,7 +12,7 @@ dashedName: reading-data-csv-and-txt More resources: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas) +- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/tree/master/unit-1-reading-data-with-python-and-pandas/lesson-1-reading-csv-and-txt-files/files) - [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- diff --git a/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.md b/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.md index 5502a07e7a..9a6275ac38 100644 --- a/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.md +++ b/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.md @@ -12,7 +12,7 @@ dashedName: reading-data-from-databases More resources: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas) +- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/tree/master/unit-1-reading-data-with-python-and-pandas/lesson-11-reading-data-from-relational-databases/files) - [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- diff --git a/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.md b/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.md index a16b2d0176..5a98490864 100644 --- a/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.md +++ b/curriculum/challenges/portuguese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.md @@ -12,7 +12,7 @@ dashedName: reading-data-introduction More resources: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas) +- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/tree/master/unit-1-reading-data-with-python-and-pandas/lesson-1-reading-csv-and-txt-files/files) - [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- diff --git a/curriculum/challenges/portuguese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-cross-site-scripting-xss-attacks-with-helmet.xssfilter.md b/curriculum/challenges/portuguese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-cross-site-scripting-xss-attacks-with-helmet.xssfilter.md index 82389f8d83..701f65a0cd 100644 --- a/curriculum/challenges/portuguese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-cross-site-scripting-xss-attacks-with-helmet.xssfilter.md +++ b/curriculum/challenges/portuguese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-cross-site-scripting-xss-attacks-with-helmet.xssfilter.md @@ -1,8 +1,7 @@ --- id: 587d8247367417b2b2512c39 title: >- - Mitigate the Risk of Cross Site Scripting (XSS) Attacks with - helmet.xssFilter() + Mitigate the Risk of Cross Site Scripting (XSS) Attacks with helmet.xssFilter() challengeType: 2 forumTopicId: 301583 dashedName: mitigate-the-risk-of-cross-site-scripting-xss-attacks-with-helmet-xssfilter diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/add-a-new-element-to-a-binary-search-tree.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/add-a-new-element-to-a-binary-search-tree.md index 35a51fab5f..77f653d0f4 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/add-a-new-element-to-a-binary-search-tree.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/add-a-new-element-to-a-binary-search-tree.md @@ -144,7 +144,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/check-if-an-element-is-present-in-a-binary-search-tree.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/check-if-an-element-is-present-in-a-binary-search-tree.md index e45bd5a51a..03daa65cb2 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/check-if-an-element-is-present-in-a-binary-search-tree.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/check-if-an-element-is-present-in-a-binary-search-tree.md @@ -145,7 +145,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/check-if-binary-search-tree.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/check-if-binary-search-tree.md index ddaf38f231..42081a1355 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/check-if-binary-search-tree.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/check-if-binary-search-tree.md @@ -89,7 +89,7 @@ function BinarySearchTree() { } function isBinarySearchTree(tree) { // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-doubly-linked-list.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-doubly-linked-list.md index 8e727deba5..16c2e122fa 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-doubly-linked-list.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-doubly-linked-list.md @@ -160,7 +160,7 @@ assert( DoublyLinkedList.prototype = Object.assign( DoublyLinkedList.prototype, { - + print() { if (this.head == null) { return null; @@ -204,7 +204,7 @@ var DoublyLinkedList = function() { this.head = null; this.tail = null; // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-hash-table.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-hash-table.md index 05f5c099bb..a33c3d5178 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-hash-table.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-hash-table.md @@ -210,7 +210,7 @@ var hash = string => { var HashTable = function() { this.collection = {}; // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-map-data-structure.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-map-data-structure.md index ac3d5754d0..0c32270e72 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-map-data-structure.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-map-data-structure.md @@ -158,7 +158,7 @@ assert( var Map = function() { this.collection = {}; // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-set-class.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-set-class.md index 8dae14f764..d818be6a80 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-set-class.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-set-class.md @@ -170,7 +170,7 @@ class Set { } // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-trie-search-tree.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-trie-search-tree.md index 1586e0b2e8..fb838c883e 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-trie-search-tree.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/create-a-trie-search-tree.md @@ -139,7 +139,7 @@ var Node = function() { }; var Trie = function() { // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/depth-first-search.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/depth-first-search.md index 7d86343817..8fedd91cc5 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/depth-first-search.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/depth-first-search.md @@ -16,7 +16,7 @@ Once it reaches one end of a path, the search will backtrack to the last node wi The animation below shows how the algorithm works. The algorithm starts with the top node and visits the nodes in the numbered order. - + Notice how, unlike breadth-first search, every time a node is visited, it doesn't visit all of its neighbors. Instead, it first visits one of its neighbors and continues down that path until there are no more nodes to be visited on that path. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.md index b049822d4a..eb71f5ea47 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.md @@ -261,7 +261,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` @@ -278,7 +278,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line this.findMinHeight = function(root = this.root) { // empty tree. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree.md index 590820dd49..23077f9d93 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree.md @@ -187,7 +187,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap.md index d3b5a44d78..158817a64d 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap.md @@ -125,14 +125,14 @@ function createRandomArray(size = 5){ let a = new Array(size); for(let i = 0; i < size; i++) a[i] = Math.floor(Math.random() * 100); - + return a; } const array = createRandomArray(25); var MinHeap = function() { // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/insert-an-element-into-a-max-heap.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/insert-an-element-into-a-max-heap.md index 74e6b693f7..e20657a87c 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/insert-an-element-into-a-max-heap.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/insert-an-element-into-a-max-heap.md @@ -123,7 +123,7 @@ assert( ```js var MaxHeap = function() { // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/invert-a-binary-tree.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/invert-a-binary-tree.md index bb2226fac8..8be38b0d5d 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/invert-a-binary-tree.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/invert-a-binary-tree.md @@ -160,7 +160,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data.md index 8c40ae5161..1c79329128 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data.md @@ -124,7 +124,7 @@ class Set { return newSet; } // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.md index 71d0bc063e..ea0caa1b3e 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.md @@ -200,7 +200,7 @@ class Set { return newSet; } // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data.md index e2bef36377..a108cb3b4e 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data.md @@ -101,7 +101,7 @@ class Set { return newSet; } // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list.md index 871cf51e9d..a202036ff0 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list.md @@ -194,7 +194,7 @@ function LinkedList() { previous = currentNode; currentNode = currentNode.next; } - + if (currentNode.next === null && currentNode.element !== element) { return; } diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/remove-items-from-a-set-in-es6.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/remove-items-from-a-set-in-es6.md index b676bb7eeb..c958d1922c 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/remove-items-from-a-set-in-es6.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/remove-items-from-a-set-in-es6.md @@ -48,8 +48,11 @@ assert( ```js function checkSet(){ - var set = null; - return set; + // Only change code below this line + var set = null; + + // Only change code above this line + return set; } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/reverse-a-doubly-linked-list.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/reverse-a-doubly-linked-list.md index 18293576f2..58edfaa2a5 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/reverse-a-doubly-linked-list.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/reverse-a-doubly-linked-list.md @@ -165,7 +165,7 @@ var DoublyLinkedList = function() { this.head = null; this.tail = null; // Only change code below this line - + // Only change code above this line }; ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree.md index d048a3a43c..b02f10043d 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree.md @@ -214,7 +214,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree.md index 8dc78340bf..c03fb75077 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree.md @@ -278,7 +278,7 @@ function Node(value) { function BinarySearchTree() { this.root = null; // Only change code below this line - + // Only change code above this line } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-101-optimum-polynomial.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-101-optimum-polynomial.md index 7573114475..cd51f0f2ec 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-101-optimum-polynomial.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-101-optimum-polynomial.md @@ -10,26 +10,30 @@ dashedName: problem-101-optimum-polynomial If we are presented with the first k terms of a sequence it is impossible to say with certainty the value of the next term, as there are infinitely many polynomial functions that can model the sequence. -As an example, let us consider the sequence of cube numbers. This is defined by the generating function, un = n3: 1, 8, 27, 64, 125, 216, ... +As an example, let us consider the sequence of cube numbers. This is defined by the generating function, $u_n = n^3: 1, 8, 27, 64, 125, 216, \ldots$ Suppose we were only given the first two terms of this sequence. Working on the principle that "simple is best" we should assume a linear relationship and predict the next term to be 15 (common difference 7). Even if we were presented with the first three terms, by the same principle of simplicity, a quadratic relationship should be assumed. -We shall define OP(k, n) to be the nth term of the optimum polynomial generating function for the first k terms of a sequence. It should be clear that OP(k, n) will accurately generate the terms of the sequence for n ≤ k, and potentially the first incorrect term (FIT) will be OP(k, k+1); in which case we shall call it a bad OP (BOP). +We shall define $OP(k, n)$ to be the $n^{th}$ term of the optimum polynomial generating function for the first k terms of a sequence. It should be clear that $OP(k, n)$ will accurately generate the terms of the sequence for $n ≤ k$, and potentially the first incorrect term (FIT) will be $OP(k, k+1)$; in which case we shall call it a bad OP (BOP). -As a basis, if we were only given the first term of sequence, it would be most sensible to assume constancy; that is, for n ≥ 2, OP(1, n) = u1. +As a basis, if we were only given the first term of sequence, it would be most sensible to assume constancy; that is, for $n ≥ 2, OP(1, n) = u_1$. Hence we obtain the following OPs for the cubic sequence: -OP(1, n) = 1 1, 1, 1, 1, ... OP(2, n) = 7n−6 1, 8, 15, ... OP(3, n) = 6n2−11n+6 1, 8, 27, 58, ... OP(4, n) = n3 1, 8, 27, 64, 125, ... +$$\begin{array}{ll} OP(1, n) = 1 & 1, {\color{red}1}, 1, 1, \ldots \\\\ OP(2, n) = 7n−6 & 1, 8, {\color{red}{15}}, \ldots \\\\ OP(3, n) = 6n^2−11n+6 & 1, 8, 27, {\color{red}{58}}, \ldots \\\\ OP(4, n) = n^3 & 1, 8, 27, 64, 125, \ldots \end{array}$$ -Clearly no BOPs exist for k ≥ 4. By considering the sum of FITs generated by the BOPs (indicated in red above), we obtain 1 + 15 + 58 = 74. Consider the following tenth degree polynomial generating function: un = 1 − n + n2 − n3 + n4 − n5 + n6 − n7 + n8 − n9 + n10 Find the sum of FITs for the BOPs. +Clearly no BOPs exist for k ≥ 4. By considering the sum of FITs generated by the BOPs (indicated in $\color{red}{red}$ above), we obtain 1 + 15 + 58 = 74. Consider the following tenth degree polynomial generating function: + +$$u_n = 1 − n + n^2 − n^3 + n^4 − n^5 + n^6 − n^7 + n^8 − n^9 + n^{10}$$ + +Find the sum of FITs for the BOPs. # --hints-- -`euler101()` should return 37076114526. +`optimumPolynomial()` should return `37076114526`. ```js -assert.strictEqual(euler101(), 37076114526); +assert.strictEqual(optimumPolynomial(), 37076114526); ``` # --seed-- @@ -37,12 +41,12 @@ assert.strictEqual(euler101(), 37076114526); ## --seed-contents-- ```js -function euler101() { +function optimumPolynomial() { return true; } -euler101(); +optimumPolynomial(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-103-special-subset-sums-optimum.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-103-special-subset-sums-optimum.md index 1ba5808084..677153bd67 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-103-special-subset-sums-optimum.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-103-special-subset-sums-optimum.md @@ -8,30 +8,29 @@ dashedName: problem-103-special-subset-sums-optimum # --description-- -Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: +Let $S(A)$ represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: -S(B) ≠ S(C); that is, sums of subsets cannot be equal. +1. $S(B) ≠ S(C)$; that is, sums of subsets cannot be equal. +2. If B contains more elements than C then $S(B) > S(C)$. -If B contains more elements than C then S(B) > S(C). +If $S(A)$ is minimised for a given n, we shall call it an optimum special sum set. The first five optimum special sum sets are given below. -If S(A) is minimised for a given n, we shall call it an optimum special sum set. The first five optimum special sum sets are given below. +$$\begin{align} & n = 1: \\{1\\} \\\\ & n = 2: \\{1, 2\\} \\\\ & n = 3: \\{2, 3, 4\\} \\\\ & n = 4: \\{3, 5, 6, 7\\} \\\\ & n = 5: \\{6, 9, 11, 12, 13\\} \\\\ \end{align}$$ -n = 1: {1}n = 2: {1, 2}n = 3: {2, 3, 4}n = 4: {3, 5, 6, 7}n = 5: {6, 9, 11, 12, 13} +It seems that for a given optimum set, $A = \\{a_1, a_2, \ldots, a_n\\}$, the next optimum set is of the form $B = \\{b, a_1 + b, a_2 + b, \ldots, a_n + b\\}$, where b is the "middle" element on the previous row. -It seems that for a given optimum set, A = {a1, a2, ... , an}, the next optimum set is of the form B = {b, a1+b, a2+b, ... ,an+b}, where b is the "middle" element on the previous row. +By applying this "rule" we would expect the optimum set for $n = 6$ to be $A = \\{11, 17, 20, 22, 23, 24\\}$, with $S(A) = 117$. However, this is not the optimum set, as we have merely applied an algorithm to provide a near optimum set. The optimum set for $n = 6$ is $A = \\{11, 18, 19, 20, 22, 25\\}$, with $S(A) = 115$ and corresponding set string: `111819202225`. -By applying this "rule" we would expect the optimum set for n = 6 to be A = {11, 17, 20, 22, 23, 24}, with S(A) = 117. However, this is not the optimum set, as we have merely applied an algorithm to provide a near optimum set. The optimum set for n = 6 is A = {11, 18, 19, 20, 22, 25}, with S(A) = 115 and corresponding set string: 111819202225. +Given that A is an optimum special sum set for $n = 7$, find its set string. -Given that A is an optimum special sum set for n = 7, find its set string. - -NOTE: This problem is related to Problem 105 and Problem 106. +**Note:** This problem is related to Problem 105 and Problem 106. # --hints-- -`euler103()` should return 20313839404245. +`optimumSpecialSumSet()` should return the string `20313839404245`. ```js -assert.strictEqual(euler103(), 20313839404245); +assert.strictEqual(optimumSpecialSumSet(), '20313839404245'); ``` # --seed-- @@ -39,12 +38,12 @@ assert.strictEqual(euler103(), 20313839404245); ## --seed-contents-- ```js -function euler103() { +function optimumSpecialSumSet() { return true; } -euler103(); +optimumSpecialSumSet(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-104-pandigital-fibonacci-ends.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-104-pandigital-fibonacci-ends.md index 625840f94a..1c61ea7c2e 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-104-pandigital-fibonacci-ends.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-104-pandigital-fibonacci-ends.md @@ -10,18 +10,18 @@ dashedName: problem-104-pandigital-fibonacci-ends The Fibonacci sequence is defined by the recurrence relation: -Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. +$F_n = F_{n − 1} + F_{n − 2}$, where $F_1 = 1$ and $F_2 = 1$ -It turns out that F541, which contains 113 digits, is the first Fibonacci number for which the last nine digits are 1-9 pandigital (contain all the digits 1 to 9, but not necessarily in order). And F2749, which contains 575 digits, is the first Fibonacci number for which the first nine digits are 1-9 pandigital. +It turns out that $F_{541}$, which contains 113 digits, is the first Fibonacci number for which the last nine digits are 1 - 9 pandigital (contain all the digits 1 to 9, but not necessarily in order). And $F_{2749}$, which contains 575 digits, is the first Fibonacci number for which the first nine digits are 1 - 9 pandigital. -Given that Fk is the first Fibonacci number for which the first nine digits AND the last nine digits are 1-9 pandigital, find k. +Given that $F_k$ is the first Fibonacci number for which the first nine digits AND the last nine digits are 1 - 9 pandigital, find `k`. # --hints-- -`euler104()` should return 329468. +`pandigitalFibonacciEnds()` should return `329468`. ```js -assert.strictEqual(euler104(), 329468); +assert.strictEqual(pandigitalFibonacciEnds(), 329468); ``` # --seed-- @@ -29,12 +29,12 @@ assert.strictEqual(euler104(), 329468); ## --seed-contents-- ```js -function euler104() { +function pandigitalFibonacciEnds() { return true; } -euler104(); +pandigitalFibonacciEnds(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-105-special-subset-sums-testing.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-105-special-subset-sums-testing.md index 28d4d6ac86..0a5d611f90 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-105-special-subset-sums-testing.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-105-special-subset-sums-testing.md @@ -8,37 +8,48 @@ dashedName: problem-105-special-subset-sums-testing # --description-- -Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: +Let $S(A)$ represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: -S(B) ≠ S(C); that is, sums of subsets cannot be equal. +1. $S(B) ≠ S(C)$; that is, sums of subsets cannot be equal. +2. If B contains more elements than C then $S(B) > S(C)$. -If B contains more elements than C then S(B) > S(C). +For example, {81, 88, 75, 42, 87, 84, 86, 65} is not a special sum set because 65 + 87 + 88 = 75 + 81 + 84, whereas {157, 150, 164, 119, 79, 159, 161, 139, 158} satisfies both rules for all possible subset pair combinations and $S(A) = 1286$. -For example, {81, 88, 75, 42, 87, 84, 86, 65} is not a special sum set because 65 + 87 + 88 = 75 + 81 + 84, whereas {157, 150, 164, 119, 79, 159, 161, 139, 158} satisfies both rules for all possible subset pair combinations and S(A) = 1286. +Using `sets`, an array with one-hundred sets, containing seven to twelve elements (the two examples given above are the first two sets), identify all the special sum sets, $A_1, A_2, \ldots, A_k$, and find the value of $(A_1) + S(A_2) + \cdots + S(A_k)$. -Using sets.txt (right click and "Save Link/Target As..."), a 4K text file with one-hundred sets containing seven to twelve elements (the two examples given above are the first two sets in the file), identify all the special sum sets, A1, A2, ..., Ak, and find the value of S(A1) + S(A2) + ... + S(Ak). - -NOTE: This problem is related to Problem 103 and Problem 106. +**Note:** This problem is related to Problem 103 and Problem 106. # --hints-- -`euler105()` should return 73702. +`testingSpecialSubsetSums(testSets)` should return `73702`. ```js -assert.strictEqual(euler105(), 73702); +assert.strictEqual(testingSpecialSubsetSums(_testSets), 73702); ``` # --seed-- +## --after-user-code-- + +```js +const _testSets = [ + [81,88,75,42,87,84,86,65],[157,150,164,119,79,159,161,139,158],[673,465,569,603,629,592,584,300,601,599,600],[90,85,83,84,65,87,76,46],[165,168,169,190,162,85,176,167,127],[224,275,278,249,277,279,289,295,139],[354,370,362,384,359,324,360,180,350,270],[599,595,557,298,448,596,577,667,597,588,602],[175,199,137,88,187,173,168,171,174],[93,187,196,144,185,178,186,202,182],[157,155,81,158,119,176,152,167,159],[184,165,159,166,163,167,174,124,83],[1211,1212,1287,605,1208,1189,1060,1216,1243,1200,908,1210],[339,299,153,305,282,304,313,306,302,228],[94,104,63,112,80,84,93,96],[41,88,82,85,61,74,83,81],[90,67,84,83,82,97,86,41],[299,303,151,301,291,302,307,377,333,280],[55,40,48,44,25,42,41],[1038,1188,1255,1184,594,890,1173,1151,1186,1203,1187,1195],[76,132,133,144,135,99,128,154],[77,46,108,81,85,84,93,83],[624,596,391,605,529,610,607,568,604,603,453],[83,167,166,189,163,174,160,165,133],[308,281,389,292,346,303,302,304,300,173],[593,1151,1187,1184,890,1040,1173,1186,1195,1255,1188,1203],[68,46,64,33,60,58,65],[65,43,88,87,86,99,93,90],[83,78,107,48,84,87,96,85],[1188,1173,1256,1038,1187,1151,890,1186,1184,1203,594,1195],[302,324,280,296,294,160,367,298,264,299],[521,760,682,687,646,664,342,698,692,686,672],[56,95,86,97,96,89,108,120],[344,356,262,343,340,382,337,175,361,330],[47,44,42,27,41,40,37],[139,155,161,158,118,166,154,156,78],[118,157,164,158,161,79,139,150,159],[299,292,371,150,300,301,281,303,306,262],[85,77,86,84,44,88,91,67],[88,85,84,44,65,91,76,86],[138,141,127,96,136,154,135,76],[292,308,302,346,300,324,304,305,238,166],[354,342,341,257,348,343,345,321,170,301],[84,178,168,167,131,170,193,166,162],[686,701,706,673,694,687,652,343,683,606,518],[295,293,301,367,296,279,297,263,323,159],[1038,1184,593,890,1188,1173,1187,1186,1195,1150,1203,1255],[343,364,388,402,191,383,382,385,288,374],[1187,1036,1183,591,1184,1175,888,1197,1182,1219,1115,1167],[151,291,307,303,345,238,299,323,301,302],[140,151,143,138,99,69,131,137],[29,44,42,59,41,36,40],[348,329,343,344,338,315,169,359,375,271],[48,39,34,37,50,40,41],[593,445,595,558,662,602,591,297,610,580,594],[686,651,681,342,541,687,691,707,604,675,699],[180,99,189,166,194,188,144,187,199],[321,349,335,343,377,176,265,356,344,332],[1151,1255,1195,1173,1184,1186,1188,1187,1203,593,1038,891],[90,88,100,83,62,113,80,89],[308,303,238,300,151,304,324,293,346,302],[59,38,50,41,42,35,40],[352,366,174,355,344,265,343,310,338,331],[91,89,93,90,117,85,60,106],[146,186,166,175,202,92,184,183,189],[82,67,96,44,80,79,88,76],[54,50,58,66,31,61,64],[343,266,344,172,308,336,364,350,359,333],[88,49,87,82,90,98,86,115],[20,47,49,51,54,48,40],[159,79,177,158,157,152,155,167,118],[1219,1183,1182,1115,1035,1186,591,1197,1167,887,1184,1175],[611,518,693,343,704,667,686,682,677,687,725],[607,599,634,305,677,604,603,580,452,605,591],[682,686,635,675,692,730,687,342,517,658,695],[662,296,573,598,592,584,553,593,595,443,591],[180,185,186,199,187,210,93,177,149],[197,136,179,185,156,182,180,178,99],[271,298,218,279,285,282,280,238,140],[1187,1151,890,593,1194,1188,1184,1173,1038,1186,1255,1203],[169,161,177,192,130,165,84,167,168],[50,42,43,41,66,39,36],[590,669,604,579,448,599,560,299,601,597,598],[174,191,206,179,184,142,177,180,90],[298,299,297,306,164,285,374,269,329,295],[181,172,162,138,170,195,86,169,168],[1184,1197,591,1182,1186,889,1167,1219,1183,1033,1115,1175],[644,695,691,679,667,687,340,681,770,686,517],[606,524,592,576,628,593,591,584,296,444,595],[94,127,154,138,135,74,136,141],[179,168,172,178,177,89,198,186,137],[302,299,291,300,298,149,260,305,280,370],[678,517,670,686,682,768,687,648,342,692,702],[302,290,304,376,333,303,306,298,279,153],[95,102,109,54,96,75,85,97],[150,154,146,78,152,151,162,173,119],[150,143,157,152,184,112,154,151,132],[36,41,54,40,25,44,42],[37,48,34,59,39,41,40],[681,603,638,611,584,303,454,607,606,605,596] +]; +``` + ## --seed-contents-- ```js -function euler105() { +function testingSpecialSubsetSums(sets) { return true; } -euler105(); +const testSets = [ + [81,88,75,42,87,84,86,65],[157,150,164,119,79,159,161,139,158],[673,465,569,603,629,592,584,300,601,599,600],[90,85,83,84,65,87,76,46],[165,168,169,190,162,85,176,167,127],[224,275,278,249,277,279,289,295,139],[354,370,362,384,359,324,360,180,350,270],[599,595,557,298,448,596,577,667,597,588,602],[175,199,137,88,187,173,168,171,174],[93,187,196,144,185,178,186,202,182],[157,155,81,158,119,176,152,167,159],[184,165,159,166,163,167,174,124,83],[1211,1212,1287,605,1208,1189,1060,1216,1243,1200,908,1210],[339,299,153,305,282,304,313,306,302,228],[94,104,63,112,80,84,93,96],[41,88,82,85,61,74,83,81],[90,67,84,83,82,97,86,41],[299,303,151,301,291,302,307,377,333,280],[55,40,48,44,25,42,41],[1038,1188,1255,1184,594,890,1173,1151,1186,1203,1187,1195],[76,132,133,144,135,99,128,154],[77,46,108,81,85,84,93,83],[624,596,391,605,529,610,607,568,604,603,453],[83,167,166,189,163,174,160,165,133],[308,281,389,292,346,303,302,304,300,173],[593,1151,1187,1184,890,1040,1173,1186,1195,1255,1188,1203],[68,46,64,33,60,58,65],[65,43,88,87,86,99,93,90],[83,78,107,48,84,87,96,85],[1188,1173,1256,1038,1187,1151,890,1186,1184,1203,594,1195],[302,324,280,296,294,160,367,298,264,299],[521,760,682,687,646,664,342,698,692,686,672],[56,95,86,97,96,89,108,120],[344,356,262,343,340,382,337,175,361,330],[47,44,42,27,41,40,37],[139,155,161,158,118,166,154,156,78],[118,157,164,158,161,79,139,150,159],[299,292,371,150,300,301,281,303,306,262],[85,77,86,84,44,88,91,67],[88,85,84,44,65,91,76,86],[138,141,127,96,136,154,135,76],[292,308,302,346,300,324,304,305,238,166],[354,342,341,257,348,343,345,321,170,301],[84,178,168,167,131,170,193,166,162],[686,701,706,673,694,687,652,343,683,606,518],[295,293,301,367,296,279,297,263,323,159],[1038,1184,593,890,1188,1173,1187,1186,1195,1150,1203,1255],[343,364,388,402,191,383,382,385,288,374],[1187,1036,1183,591,1184,1175,888,1197,1182,1219,1115,1167],[151,291,307,303,345,238,299,323,301,302],[140,151,143,138,99,69,131,137],[29,44,42,59,41,36,40],[348,329,343,344,338,315,169,359,375,271],[48,39,34,37,50,40,41],[593,445,595,558,662,602,591,297,610,580,594],[686,651,681,342,541,687,691,707,604,675,699],[180,99,189,166,194,188,144,187,199],[321,349,335,343,377,176,265,356,344,332],[1151,1255,1195,1173,1184,1186,1188,1187,1203,593,1038,891],[90,88,100,83,62,113,80,89],[308,303,238,300,151,304,324,293,346,302],[59,38,50,41,42,35,40],[352,366,174,355,344,265,343,310,338,331],[91,89,93,90,117,85,60,106],[146,186,166,175,202,92,184,183,189],[82,67,96,44,80,79,88,76],[54,50,58,66,31,61,64],[343,266,344,172,308,336,364,350,359,333],[88,49,87,82,90,98,86,115],[20,47,49,51,54,48,40],[159,79,177,158,157,152,155,167,118],[1219,1183,1182,1115,1035,1186,591,1197,1167,887,1184,1175],[611,518,693,343,704,667,686,682,677,687,725],[607,599,634,305,677,604,603,580,452,605,591],[682,686,635,675,692,730,687,342,517,658,695],[662,296,573,598,592,584,553,593,595,443,591],[180,185,186,199,187,210,93,177,149],[197,136,179,185,156,182,180,178,99],[271,298,218,279,285,282,280,238,140],[1187,1151,890,593,1194,1188,1184,1173,1038,1186,1255,1203],[169,161,177,192,130,165,84,167,168],[50,42,43,41,66,39,36],[590,669,604,579,448,599,560,299,601,597,598],[174,191,206,179,184,142,177,180,90],[298,299,297,306,164,285,374,269,329,295],[181,172,162,138,170,195,86,169,168],[1184,1197,591,1182,1186,889,1167,1219,1183,1033,1115,1175],[644,695,691,679,667,687,340,681,770,686,517],[606,524,592,576,628,593,591,584,296,444,595],[94,127,154,138,135,74,136,141],[179,168,172,178,177,89,198,186,137],[302,299,291,300,298,149,260,305,280,370],[678,517,670,686,682,768,687,648,342,692,702],[302,290,304,376,333,303,306,298,279,153],[95,102,109,54,96,75,85,97],[150,154,146,78,152,151,162,173,119],[150,143,157,152,184,112,154,151,132],[36,41,54,40,25,44,42],[37,48,34,59,39,41,40],[681,603,638,611,584,303,454,607,606,605,596] +]; + +testingSpecialSubsetSums(testSets); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-106-special-subset-sums-meta-testing.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-106-special-subset-sums-meta-testing.md index bb1db2e260..e771a72835 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-106-special-subset-sums-meta-testing.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-106-special-subset-sums-meta-testing.md @@ -8,11 +8,10 @@ dashedName: problem-106-special-subset-sums-meta-testing # --description-- -Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: +Let $S(A)$ represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: -S(B) ≠ S(C); that is, sums of subsets cannot be equal. - -If B contains more elements than C then S(B) > S(C). +1. $S(B) ≠ S(C)$; that is, sums of subsets cannot be equal. +2. If B contains more elements than C then $S(B) > S(C)$. For this problem we shall assume that a given set contains n strictly increasing elements and it already satisfies the second rule. @@ -20,14 +19,14 @@ Surprisingly, out of the 25 possible subset pairs that can be obtained from a se For n = 12, how many of the 261625 subset pairs that can be obtained need to be tested for equality? -NOTE: This problem is related to Problem 103 and Problem 105. +**Note:** This problem is related to Problem 103 and Problem 105. # --hints-- -`euler106()` should return 21384. +`subsetSumsMetaTesting()` should return `21384`. ```js -assert.strictEqual(euler106(), 21384); +assert.strictEqual(subsetSumsMetaTesting(), 21384); ``` # --seed-- @@ -35,12 +34,12 @@ assert.strictEqual(euler106(), 21384); ## --seed-contents-- ```js -function euler106() { +function subsetSumsMetaTesting() { return true; } -euler106(); +subsetSumsMetaTesting(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-107-minimal-network.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-107-minimal-network.md index f51dfe801d..312e9f3312 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-107-minimal-network.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-107-minimal-network.md @@ -10,29 +10,58 @@ dashedName: problem-107-minimal-network The following undirected network consists of seven vertices and twelve edges with a total weight of 243. -The same network can be represented by the matrix below. ABCDEFG A-161221--- B16--1720-- C12--28-31- D211728-181923 E-20-18--11 F--3119--27 G---231127- However, it is possible to optimise the network by removing some edges and still ensure that all points on the network remain connected. The network which achieves the maximum saving is shown below. It has a weight of 93, representing a saving of 243 − 93 = 150 from the original network. +Network with seven vertices and twelve edges -Using network.txt (right click and 'Save Link/Target As...'), a 6K text file containing a network with forty vertices, and given in matrix form, find the maximum saving which can be achieved by removing redundant edges whilst ensuring that the network remains connected. +The same network can be represented by the matrix below. + +| | A | B | C | D | E | F | G | +| - | -- | -- | -- | -- | -- | -- | -- | +| A | - | 16 | 12 | 21 | - | - | - | +| B | 16 | - | - | 17 | 20 | - | - | +| C | 12 | - | - | 28 | - | 31 | - | +| D | 21 | 17 | 28 | - | 18 | 19 | 23 | +| E | - | 20 | - | 18 | - | - | 11 | +| F | - | - | 31 | 19 | - | - | 27 | +| G | - | - | - | 23 | 11 | 27 | - | + + +However, it is possible to optimise the network by removing some edges and still ensure that all points on the network remain connected. The network which achieves the maximum saving is shown below. It has a weight of 93, representing a saving of 243 − 93 = 150 from the original network. + +Network wtih seven vertices and left six edges: AB, BD, CA, DE, DF, EG + +Using `network`, an 2D array representing network in matrix form, find the maximum saving which can be achieved by removing redundant edges whilst ensuring that the network remains connected. Vertices not having connection will be represented with `-1`. # --hints-- -`euler107()` should return 259679. +`minimalNetwork(testNetwork)` should return `259679`. ```js -assert.strictEqual(euler107(), 259679); +assert.strictEqual(minimalNetwork(_testNetwork), 259679); ``` # --seed-- +## --after-user-code-- + +```js +const _testNetwork = [ + [-1,-1,-1,427,668,495,377,678,-1,177,-1,-1,870,-1,869,624,300,609,131,-1,251,-1,-1,-1,856,221,514,-1,591,762,182,56,-1,884,412,273,636,-1,-1,774],[-1,-1,262,-1,-1,508,472,799,-1,956,578,363,940,143,-1,162,122,910,-1,729,802,941,922,573,531,539,667,607,-1,920,-1,-1,315,649,937,-1,185,102,636,289],[-1,262,-1,-1,926,-1,958,158,647,47,621,264,81,-1,402,813,649,386,252,391,264,637,349,-1,-1,-1,108,-1,727,225,578,699,-1,898,294,-1,575,168,432,833],[427,-1,-1,-1,366,-1,-1,635,-1,32,962,468,893,854,718,427,448,916,258,-1,760,909,529,311,404,-1,-1,588,680,875,-1,615,-1,409,758,221,-1,-1,76,257],[668,-1,926,366,-1,-1,-1,250,268,-1,503,944,-1,677,-1,727,793,457,981,191,-1,-1,-1,351,969,925,987,328,282,589,-1,873,477,-1,-1,19,450,-1,-1,-1],[495,508,-1,-1,-1,-1,-1,765,711,819,305,302,926,-1,-1,582,-1,861,-1,683,293,-1,-1,66,-1,27,-1,-1,290,-1,786,-1,554,817,33,-1,54,506,386,381],[377,472,958,-1,-1,-1,-1,-1,-1,120,42,-1,134,219,457,639,538,374,-1,-1,-1,966,-1,-1,-1,-1,-1,449,120,797,358,232,550,-1,305,997,662,744,686,239],[678,799,158,635,250,765,-1,-1,-1,35,-1,106,385,652,160,-1,890,812,605,953,-1,-1,-1,79,-1,712,613,312,452,-1,978,900,-1,901,-1,-1,225,533,770,722],[-1,-1,647,-1,268,711,-1,-1,-1,283,-1,172,-1,663,236,36,403,286,986,-1,-1,810,761,574,53,793,-1,-1,777,330,936,883,286,-1,174,-1,-1,-1,828,711],[177,956,47,32,-1,819,120,35,283,-1,50,-1,565,36,767,684,344,489,565,-1,-1,103,810,463,733,665,494,644,863,25,385,-1,342,470,-1,-1,-1,730,582,468],[-1,578,621,962,503,305,42,-1,-1,50,-1,155,519,-1,-1,256,990,801,154,53,474,650,402,-1,-1,-1,966,-1,-1,406,989,772,932,7,-1,823,391,-1,-1,933],[-1,363,264,468,944,302,-1,106,172,-1,155,-1,-1,-1,380,438,-1,41,266,-1,-1,104,867,609,-1,270,861,-1,-1,165,-1,675,250,686,995,366,191,-1,433,-1],[870,940,81,893,-1,926,134,385,-1,565,519,-1,-1,313,851,-1,-1,-1,248,220,-1,826,359,829,-1,234,198,145,409,68,359,-1,814,218,186,-1,-1,929,203,-1],[-1,143,-1,854,677,-1,219,652,663,36,-1,-1,313,-1,132,-1,433,598,-1,-1,168,870,-1,-1,-1,128,437,-1,383,364,966,227,-1,-1,807,993,-1,-1,526,17],[869,-1,402,718,-1,-1,457,160,236,767,-1,380,851,132,-1,-1,596,903,613,730,-1,261,-1,142,379,885,89,-1,848,258,112,-1,900,-1,-1,818,639,268,600,-1],[624,162,813,427,727,582,639,-1,36,684,256,438,-1,-1,-1,-1,539,379,664,561,542,-1,999,585,-1,-1,321,398,-1,-1,950,68,193,-1,697,-1,390,588,848,-1],[300,122,649,448,793,-1,538,890,403,344,990,-1,-1,433,596,539,-1,-1,73,-1,318,-1,-1,500,-1,968,-1,291,-1,-1,765,196,504,757,-1,542,-1,395,227,148],[609,910,386,916,457,861,374,812,286,489,801,41,-1,598,903,379,-1,-1,-1,946,136,399,-1,941,707,156,757,258,251,-1,807,-1,-1,-1,461,501,-1,-1,616,-1],[131,-1,252,258,981,-1,-1,605,986,565,154,266,248,-1,613,664,73,-1,-1,686,-1,-1,575,627,817,282,-1,698,398,222,-1,649,-1,-1,-1,-1,-1,654,-1,-1],[-1,729,391,-1,191,683,-1,953,-1,-1,53,-1,220,-1,730,561,-1,946,686,-1,-1,389,729,553,304,703,455,857,260,-1,991,182,351,477,867,-1,-1,889,217,853],[251,802,264,760,-1,293,-1,-1,-1,-1,474,-1,-1,168,-1,542,318,136,-1,-1,-1,-1,392,-1,-1,-1,267,407,27,651,80,927,-1,974,977,-1,-1,457,117,-1],[-1,941,637,909,-1,-1,966,-1,810,103,650,104,826,870,261,-1,-1,399,-1,389,-1,-1,-1,202,-1,-1,-1,-1,867,140,403,962,785,-1,511,-1,1,-1,707,-1],[-1,922,349,529,-1,-1,-1,-1,761,810,402,867,359,-1,-1,999,-1,-1,575,729,392,-1,-1,388,939,-1,959,-1,83,463,361,-1,-1,512,931,-1,224,690,369,-1],[-1,573,-1,311,351,66,-1,79,574,463,-1,609,829,-1,142,585,500,941,627,553,-1,202,388,-1,164,829,-1,620,523,639,936,-1,-1,490,-1,695,-1,505,109,-1],[856,531,-1,404,969,-1,-1,-1,53,733,-1,-1,-1,-1,379,-1,-1,707,817,304,-1,-1,939,164,-1,-1,616,716,728,-1,889,349,-1,963,150,447,-1,292,586,264],[221,539,-1,-1,925,27,-1,712,793,665,-1,270,234,128,885,-1,968,156,282,703,-1,-1,-1,829,-1,-1,-1,822,-1,-1,-1,736,576,-1,697,946,443,-1,205,194],[514,667,108,-1,987,-1,-1,613,-1,494,966,861,198,437,89,321,-1,757,-1,455,267,-1,959,-1,616,-1,-1,-1,349,156,339,-1,102,790,359,-1,439,938,809,260],[-1,607,-1,588,328,-1,449,312,-1,644,-1,-1,145,-1,-1,398,291,258,698,857,407,-1,-1,620,716,822,-1,-1,293,486,943,-1,779,-1,6,880,116,775,-1,947],[591,-1,727,680,282,290,120,452,777,863,-1,-1,409,383,848,-1,-1,251,398,260,27,867,83,523,728,-1,349,293,-1,212,684,505,341,384,9,992,507,48,-1,-1],[762,920,225,875,589,-1,797,-1,330,25,406,165,68,364,258,-1,-1,-1,222,-1,651,140,463,639,-1,-1,156,486,212,-1,-1,349,723,-1,-1,186,-1,36,240,752],[182,-1,578,-1,-1,786,358,978,936,385,989,-1,359,966,112,950,765,807,-1,991,80,403,361,936,889,-1,339,943,684,-1,-1,965,302,676,725,-1,327,134,-1,147],[56,-1,699,615,873,-1,232,900,883,-1,772,675,-1,227,-1,68,196,-1,649,182,927,962,-1,-1,349,736,-1,-1,505,349,965,-1,474,178,833,-1,-1,555,853,-1],[-1,315,-1,-1,477,554,550,-1,286,342,932,250,814,-1,900,193,504,-1,-1,351,-1,785,-1,-1,-1,576,102,779,341,723,302,474,-1,689,-1,-1,-1,451,-1,-1],[884,649,898,409,-1,817,-1,901,-1,470,7,686,218,-1,-1,-1,757,-1,-1,477,974,-1,512,490,963,-1,790,-1,384,-1,676,178,689,-1,245,596,445,-1,-1,343],[412,937,294,758,-1,33,305,-1,174,-1,-1,995,186,807,-1,697,-1,461,-1,867,977,511,931,-1,150,697,359,6,9,-1,725,833,-1,245,-1,949,-1,270,-1,112],[273,-1,-1,221,19,-1,997,-1,-1,-1,823,366,-1,993,818,-1,542,501,-1,-1,-1,-1,-1,695,447,946,-1,880,992,186,-1,-1,-1,596,949,-1,91,-1,768,273],[636,185,575,-1,450,54,662,225,-1,-1,391,191,-1,-1,639,390,-1,-1,-1,-1,-1,1,224,-1,-1,443,439,116,507,-1,327,-1,-1,445,-1,91,-1,248,-1,344],[-1,102,168,-1,-1,506,744,533,-1,730,-1,-1,929,-1,268,588,395,-1,654,889,457,-1,690,505,292,-1,938,775,48,36,134,555,451,-1,270,-1,248,-1,371,680],[-1,636,432,76,-1,386,686,770,828,582,-1,433,203,526,600,848,227,616,-1,217,117,707,369,109,586,205,809,-1,-1,240,-1,853,-1,-1,-1,768,-1,371,-1,540],[774,289,833,257,-1,381,239,722,711,468,933,-1,-1,17,-1,-1,148,-1,-1,853,-1,-1,-1,-1,264,194,260,947,-1,752,147,-1,-1,343,112,273,344,680,540,-1] +]; +``` + ## --seed-contents-- ```js -function euler107() { +function minimalNetwork(network) { return true; } -euler107(); +const testNetwork = [ + [-1,-1,-1,427,668,495,377,678,-1,177,-1,-1,870,-1,869,624,300,609,131,-1,251,-1,-1,-1,856,221,514,-1,591,762,182,56,-1,884,412,273,636,-1,-1,774],[-1,-1,262,-1,-1,508,472,799,-1,956,578,363,940,143,-1,162,122,910,-1,729,802,941,922,573,531,539,667,607,-1,920,-1,-1,315,649,937,-1,185,102,636,289],[-1,262,-1,-1,926,-1,958,158,647,47,621,264,81,-1,402,813,649,386,252,391,264,637,349,-1,-1,-1,108,-1,727,225,578,699,-1,898,294,-1,575,168,432,833],[427,-1,-1,-1,366,-1,-1,635,-1,32,962,468,893,854,718,427,448,916,258,-1,760,909,529,311,404,-1,-1,588,680,875,-1,615,-1,409,758,221,-1,-1,76,257],[668,-1,926,366,-1,-1,-1,250,268,-1,503,944,-1,677,-1,727,793,457,981,191,-1,-1,-1,351,969,925,987,328,282,589,-1,873,477,-1,-1,19,450,-1,-1,-1],[495,508,-1,-1,-1,-1,-1,765,711,819,305,302,926,-1,-1,582,-1,861,-1,683,293,-1,-1,66,-1,27,-1,-1,290,-1,786,-1,554,817,33,-1,54,506,386,381],[377,472,958,-1,-1,-1,-1,-1,-1,120,42,-1,134,219,457,639,538,374,-1,-1,-1,966,-1,-1,-1,-1,-1,449,120,797,358,232,550,-1,305,997,662,744,686,239],[678,799,158,635,250,765,-1,-1,-1,35,-1,106,385,652,160,-1,890,812,605,953,-1,-1,-1,79,-1,712,613,312,452,-1,978,900,-1,901,-1,-1,225,533,770,722],[-1,-1,647,-1,268,711,-1,-1,-1,283,-1,172,-1,663,236,36,403,286,986,-1,-1,810,761,574,53,793,-1,-1,777,330,936,883,286,-1,174,-1,-1,-1,828,711],[177,956,47,32,-1,819,120,35,283,-1,50,-1,565,36,767,684,344,489,565,-1,-1,103,810,463,733,665,494,644,863,25,385,-1,342,470,-1,-1,-1,730,582,468],[-1,578,621,962,503,305,42,-1,-1,50,-1,155,519,-1,-1,256,990,801,154,53,474,650,402,-1,-1,-1,966,-1,-1,406,989,772,932,7,-1,823,391,-1,-1,933],[-1,363,264,468,944,302,-1,106,172,-1,155,-1,-1,-1,380,438,-1,41,266,-1,-1,104,867,609,-1,270,861,-1,-1,165,-1,675,250,686,995,366,191,-1,433,-1],[870,940,81,893,-1,926,134,385,-1,565,519,-1,-1,313,851,-1,-1,-1,248,220,-1,826,359,829,-1,234,198,145,409,68,359,-1,814,218,186,-1,-1,929,203,-1],[-1,143,-1,854,677,-1,219,652,663,36,-1,-1,313,-1,132,-1,433,598,-1,-1,168,870,-1,-1,-1,128,437,-1,383,364,966,227,-1,-1,807,993,-1,-1,526,17],[869,-1,402,718,-1,-1,457,160,236,767,-1,380,851,132,-1,-1,596,903,613,730,-1,261,-1,142,379,885,89,-1,848,258,112,-1,900,-1,-1,818,639,268,600,-1],[624,162,813,427,727,582,639,-1,36,684,256,438,-1,-1,-1,-1,539,379,664,561,542,-1,999,585,-1,-1,321,398,-1,-1,950,68,193,-1,697,-1,390,588,848,-1],[300,122,649,448,793,-1,538,890,403,344,990,-1,-1,433,596,539,-1,-1,73,-1,318,-1,-1,500,-1,968,-1,291,-1,-1,765,196,504,757,-1,542,-1,395,227,148],[609,910,386,916,457,861,374,812,286,489,801,41,-1,598,903,379,-1,-1,-1,946,136,399,-1,941,707,156,757,258,251,-1,807,-1,-1,-1,461,501,-1,-1,616,-1],[131,-1,252,258,981,-1,-1,605,986,565,154,266,248,-1,613,664,73,-1,-1,686,-1,-1,575,627,817,282,-1,698,398,222,-1,649,-1,-1,-1,-1,-1,654,-1,-1],[-1,729,391,-1,191,683,-1,953,-1,-1,53,-1,220,-1,730,561,-1,946,686,-1,-1,389,729,553,304,703,455,857,260,-1,991,182,351,477,867,-1,-1,889,217,853],[251,802,264,760,-1,293,-1,-1,-1,-1,474,-1,-1,168,-1,542,318,136,-1,-1,-1,-1,392,-1,-1,-1,267,407,27,651,80,927,-1,974,977,-1,-1,457,117,-1],[-1,941,637,909,-1,-1,966,-1,810,103,650,104,826,870,261,-1,-1,399,-1,389,-1,-1,-1,202,-1,-1,-1,-1,867,140,403,962,785,-1,511,-1,1,-1,707,-1],[-1,922,349,529,-1,-1,-1,-1,761,810,402,867,359,-1,-1,999,-1,-1,575,729,392,-1,-1,388,939,-1,959,-1,83,463,361,-1,-1,512,931,-1,224,690,369,-1],[-1,573,-1,311,351,66,-1,79,574,463,-1,609,829,-1,142,585,500,941,627,553,-1,202,388,-1,164,829,-1,620,523,639,936,-1,-1,490,-1,695,-1,505,109,-1],[856,531,-1,404,969,-1,-1,-1,53,733,-1,-1,-1,-1,379,-1,-1,707,817,304,-1,-1,939,164,-1,-1,616,716,728,-1,889,349,-1,963,150,447,-1,292,586,264],[221,539,-1,-1,925,27,-1,712,793,665,-1,270,234,128,885,-1,968,156,282,703,-1,-1,-1,829,-1,-1,-1,822,-1,-1,-1,736,576,-1,697,946,443,-1,205,194],[514,667,108,-1,987,-1,-1,613,-1,494,966,861,198,437,89,321,-1,757,-1,455,267,-1,959,-1,616,-1,-1,-1,349,156,339,-1,102,790,359,-1,439,938,809,260],[-1,607,-1,588,328,-1,449,312,-1,644,-1,-1,145,-1,-1,398,291,258,698,857,407,-1,-1,620,716,822,-1,-1,293,486,943,-1,779,-1,6,880,116,775,-1,947],[591,-1,727,680,282,290,120,452,777,863,-1,-1,409,383,848,-1,-1,251,398,260,27,867,83,523,728,-1,349,293,-1,212,684,505,341,384,9,992,507,48,-1,-1],[762,920,225,875,589,-1,797,-1,330,25,406,165,68,364,258,-1,-1,-1,222,-1,651,140,463,639,-1,-1,156,486,212,-1,-1,349,723,-1,-1,186,-1,36,240,752],[182,-1,578,-1,-1,786,358,978,936,385,989,-1,359,966,112,950,765,807,-1,991,80,403,361,936,889,-1,339,943,684,-1,-1,965,302,676,725,-1,327,134,-1,147],[56,-1,699,615,873,-1,232,900,883,-1,772,675,-1,227,-1,68,196,-1,649,182,927,962,-1,-1,349,736,-1,-1,505,349,965,-1,474,178,833,-1,-1,555,853,-1],[-1,315,-1,-1,477,554,550,-1,286,342,932,250,814,-1,900,193,504,-1,-1,351,-1,785,-1,-1,-1,576,102,779,341,723,302,474,-1,689,-1,-1,-1,451,-1,-1],[884,649,898,409,-1,817,-1,901,-1,470,7,686,218,-1,-1,-1,757,-1,-1,477,974,-1,512,490,963,-1,790,-1,384,-1,676,178,689,-1,245,596,445,-1,-1,343],[412,937,294,758,-1,33,305,-1,174,-1,-1,995,186,807,-1,697,-1,461,-1,867,977,511,931,-1,150,697,359,6,9,-1,725,833,-1,245,-1,949,-1,270,-1,112],[273,-1,-1,221,19,-1,997,-1,-1,-1,823,366,-1,993,818,-1,542,501,-1,-1,-1,-1,-1,695,447,946,-1,880,992,186,-1,-1,-1,596,949,-1,91,-1,768,273],[636,185,575,-1,450,54,662,225,-1,-1,391,191,-1,-1,639,390,-1,-1,-1,-1,-1,1,224,-1,-1,443,439,116,507,-1,327,-1,-1,445,-1,91,-1,248,-1,344],[-1,102,168,-1,-1,506,744,533,-1,730,-1,-1,929,-1,268,588,395,-1,654,889,457,-1,690,505,292,-1,938,775,48,36,134,555,451,-1,270,-1,248,-1,371,680],[-1,636,432,76,-1,386,686,770,828,582,-1,433,203,526,600,848,227,616,-1,217,117,707,369,109,586,205,809,-1,-1,240,-1,853,-1,-1,-1,768,-1,371,-1,540],[774,289,833,257,-1,381,239,722,711,468,933,-1,-1,17,-1,-1,148,-1,-1,853,-1,-1,-1,-1,264,194,260,947,-1,752,147,-1,-1,343,112,273,344,680,540,-1] +]; + +minimalNetwork(testNetwork); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-108-diophantine-reciprocals-i.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-108-diophantine-reciprocals-i.md index d216cfa9fd..3b8d6f014f 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-108-diophantine-reciprocals-i.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-108-diophantine-reciprocals-i.md @@ -10,19 +10,17 @@ dashedName: problem-108-diophantine-reciprocals-i In the following equation x, y, and n are positive integers. -1/`x` + 1/`y` = 1/`n` +$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$ For `n` = 4 there are exactly three distinct solutions: -1/5 + 1/20 = 1/4 -1/6 + 1/12 = 1/4 -1/8 + 1/8 = 1/4 +$$\begin{align} & \frac{1}{5} + \frac{1}{20} = \frac{1}{4}\\\\ \\\\ & \frac{1}{6} + \frac{1}{12} = \frac{1}{4}\\\\ \\\\ & \frac{1}{8} + \frac{1}{8} = \frac{1}{4} \end{align}$$ What is the least value of `n` for which the number of distinct solutions exceeds one-thousand? # --hints-- -`diophantineOne()` should return 180180. +`diophantineOne()` should return `180180`. ```js assert.strictEqual(diophantineOne(), 180180); diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-109-darts.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-109-darts.md index e7a580b45b..3b16fe7ac6 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-109-darts.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-109-darts.md @@ -10,28 +10,26 @@ dashedName: problem-109-darts In the game of darts a player throws three darts at a target board which is split into twenty equal sized sections numbered one to twenty. -The score of a dart is determined by the number of the region that the dart lands in. A dart landing outside the red/green outer ring scores zero. The black and cream regions inside this ring represent single scores. However, the red/green outer ring and middle ring score double and treble scores respectively. At the centre of the board are two concentric circles called the bull region, or bulls-eye. The outer bull is worth 25 points and the inner bull is a double, worth 50 points. There are many variations of rules but in the most popular game the players will begin with a score 301 or 501 and the first player to reduce their running total to zero is a winner. However, it is normal to play a "doubles out" system, which means that the player must land a double (including the double bulls-eye at the centre of the board) on their final dart to win; any other dart that would reduce their running total to one or lower means the score for that set of three darts is "bust". When a player is able to finish on their current score it is called a "checkout" and the highest checkout is 170: T20 T20 D25 (two treble 20s and double bull). There are exactly eleven distinct ways to checkout on a score of 6: +Darts board -D3 +The score of a dart is determined by the number of the region that the dart lands in. A dart landing outside the red/green outer ring scores zero. The black and cream regions inside this ring represent single scores. However, the red/green outer ring and middle ring score double and treble scores respectively. -D1 D2 +At the center of the board are two concentric circles called the bull region, or bulls-eye. The outer bull is worth 25 points and the inner bull is a double, worth 50 points. -S2 D2 +There are many variations of rules but in the most popular game the players will begin with a score of 301 or 501 and the first player to reduce their running total to zero is a winner. However, it is normal to play a "doubles out" system, which means that the player must land a double (including the double bulls-eye at the center of the board) on their final dart to win; any other dart that would reduce their running total to one or lower means the score for that set of three darts is "bust". -D2 D1 +When a player is able to finish on their current score it is called a "checkout" and the highest checkout is 170: T20 T20 D25 (two treble 20s and double bull). There are exactly eleven distinct ways to checkout on a score of 6: -S4 D1 +$$\begin{array} \text{D3} & & \\\\ D1 & D2 & \\\\ S2 & D2 & \\\\ D2 & D1 & \\\\ S4 & D1 & \\\\ S1 & S1 & D2 \\\\ S1 & T1 & D1 \\\\ S1 & S3 & D1 \\\\ D1 & D1 & D1 \\\\ D1 & S2 & D1 \\\\ S2 & S2 & D1 \end{array}$$ -S1 S1 D2 S1 T1 D1 S1 S3 D1 D1 D1 D1 D1 S2 D1 S2 S2 D1 - -Note that D1 D2 is considered different to D2 D1 as they finish on different doubles. However, the combination S1 T1 D1 is considered the same as T1 S1 D1. In addition we shall not include misses in considering combinations; for example, D3 is the same as 0 D3 and 0 0 D3. Incredibly there are 42336 distinct ways of checking out in total. How many distinct ways can a player checkout with a score less than 100? +Note that D1 D2 is considered different from D2 D1 as they finish on different doubles. However, the combination S1 T1 D1 is considered the same as T1 S1 D1. In addition, we shall not include misses in considering combinations; for example, D3 is the same as 0 D3 and 0 0 D3. Incredibly there are 42336 distinct ways of checking out in total. How many distinct ways can a player checkout with a score less than 100? # --hints-- -`euler109()` should return 38182. +`darts()` should return `38182`. ```js -assert.strictEqual(euler109(), 38182); +assert.strictEqual(darts(), 38182); ``` # --seed-- @@ -39,12 +37,12 @@ assert.strictEqual(euler109(), 38182); ## --seed-contents-- ```js -function euler109() { +function darts() { return true; } -euler109(); +darts(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-110-diophantine-reciprocals-ii.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-110-diophantine-reciprocals-ii.md index c50c81a164..79070c6654 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-110-diophantine-reciprocals-ii.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-110-diophantine-reciprocals-ii.md @@ -10,15 +10,17 @@ dashedName: problem-110-diophantine-reciprocals-ii In the following equation x, y, and n are positive integers. -1/`x` + 1/`y` = 1/`n` +$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$ It can be verified that when `n` = 1260 there are 113 distinct solutions and this is the least value of `n` for which the total number of distinct solutions exceeds one hundred. What is the least value of `n` for which the number of distinct solutions exceeds four million? +**Note:** This problem is a much more difficult version of Problem 108 and as it is well beyond the limitations of a brute force approach it requires a clever implementation. + # --hints-- -`diophantineTwo()` should return 9350130049860600. +`diophantineTwo()` should return `9350130049860600`. ```js assert.strictEqual(diophantineTwo(), 9350130049860600); diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-111-primes-with-runs.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-111-primes-with-runs.md index 920085b1f3..a6a9958de7 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-111-primes-with-runs.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-111-primes-with-runs.md @@ -10,24 +10,35 @@ dashedName: problem-111-primes-with-runs Considering 4-digit primes containing repeated digits it is clear that they cannot all be the same: 1111 is divisible by 11, 2222 is divisible by 22, and so on. But there are nine 4-digit primes containing three ones: -1117, 1151, 1171, 1181, 1511, 1811, 2111, 4111, 8111 +$$1117, 1151, 1171, 1181, 1511, 1811, 2111, 4111, 8111$$ -We shall say that M(n, d) represents the maximum number of repeated digits for an n-digit prime where d is the repeated digit, N(n, d) represents the number of such primes, and S(n, d) represents the sum of these primes. +We shall say that $M(n, d)$ represents the maximum number of repeated digits for an n-digit prime where d is the repeated digit, $N(n, d)$ represents the number of such primes, and $S(n, d)$ represents the sum of these primes. -So M(4, 1) = 3 is the maximum number of repeated digits for a 4-digit prime where one is the repeated digit, there are N(4, 1) = 9 such primes, and the sum of these primes is S(4, 1) = 22275. It turns out that for d = 0, it is only possible to have M(4, 0) = 2 repeated digits, but there are N(4, 0) = 13 such cases. +So $M(4, 1) = 3$ is the maximum number of repeated digits for a 4-digit prime where one is the repeated digit, there are $N(4, 1) = 9$ such primes, and the sum of these primes is $S(4, 1) = 22275$. It turns out that for d = 0, it is only possible to have $M(4, 0) = 2$ repeated digits, but there are $N(4, 0) = 13$ such cases. In the same way we obtain the following results for 4-digit primes. -Digit, d M(4, d) N(4, d) S(4, d) 0 2 13 67061 1 3 9 22275 2 3 1 2221 3 3 12 46214 4 3 2 8888 5 3 1 5557 6 3 1 6661 7 3 9 57863 8 3 1 8887 9 3 7 48073 +| Digit, d | $M(4, d)$ | $N(4, d)$ | $S(4, d)$ | +| -------- | --------- | --------- | --------- | +| 0 | 2 | 13 | 67061 | +| 1 | 3 | 9 | 22275 | +| 2 | 3 | 1 | 2221 | +| 3 | 3 | 12 | 46214 | +| 4 | 3 | 2 | 8888 | +| 5 | 3 | 1 | 5557 | +| 6 | 3 | 1 | 6661 | +| 7 | 3 | 9 | 57863 | +| 8 | 3 | 1 | 8887 | +| 9 | 3 | 7 | 48073 | -For d = 0 to 9, the sum of all S(4, d) is 273700. Find the sum of all S(10, d). +For d = 0 to 9, the sum of all $S(4, d)$ is 273700. Find the sum of all $S(10, d)$. # --hints-- -`euler111()` should return 612407567715. +`primesWithRuns()` should return `612407567715`. ```js -assert.strictEqual(euler111(), 612407567715); +assert.strictEqual(primesWithRuns(), 612407567715); ``` # --seed-- @@ -35,12 +46,12 @@ assert.strictEqual(euler111(), 612407567715); ## --seed-contents-- ```js -function euler111() { +function primesWithRuns() { return true; } -euler111(); +primesWithRuns(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-112-bouncy-numbers.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-112-bouncy-numbers.md index cd998d5bde..d2b8f07198 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-112-bouncy-numbers.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-112-bouncy-numbers.md @@ -22,10 +22,10 @@ Find the least number for which the proportion of bouncy numbers is exactly 99%. # --hints-- -`euler112()` should return 1587000. +`bouncyNumbers()` should return `1587000`. ```js -assert.strictEqual(euler112(), 1587000); +assert.strictEqual(bouncyNumbers(), 1587000); ``` # --seed-- @@ -33,12 +33,12 @@ assert.strictEqual(euler112(), 1587000); ## --seed-contents-- ```js -function euler112() { +function bouncyNumbers() { return true; } -euler112(); +bouncyNumbers(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-113-non-bouncy-numbers.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-113-non-bouncy-numbers.md index bc28697a24..a06f41a9a5 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-113-non-bouncy-numbers.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-113-non-bouncy-numbers.md @@ -14,16 +14,16 @@ Similarly if no digit is exceeded by the digit to its right it is called a decre We shall call a positive integer that is neither increasing nor decreasing a "bouncy" number; for example, 155349. -As n increases, the proportion of bouncy numbers below n increases such that there are only 12951 numbers below one-million that are not bouncy and only 277032 non-bouncy numbers below 1010. +As n increases, the proportion of bouncy numbers below n increases such that there are only 12951 numbers below one-million that are not bouncy and only 277032 non-bouncy numbers below ${10}^{10}$. -How many numbers below a googol (10100) are not bouncy? +How many numbers below a googol (${10}^{100}$) are not bouncy? # --hints-- -`euler113()` should return 51161058134250. +`nonBouncyNumbers()` should return `51161058134250`. ```js -assert.strictEqual(euler113(), 51161058134250); +assert.strictEqual(nonBouncyNumbers(), 51161058134250); ``` # --seed-- @@ -31,12 +31,12 @@ assert.strictEqual(euler113(), 51161058134250); ## --seed-contents-- ```js -function euler113() { +function nonBouncyNumbers() { return true; } -euler113(); +nonBouncyNumbers(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-114-counting-block-combinations-i.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-114-counting-block-combinations-i.md index c9ec66c9aa..c6690bddf5 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-114-counting-block-combinations-i.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-114-counting-block-combinations-i.md @@ -10,14 +10,18 @@ dashedName: problem-114-counting-block-combinations-i A row measuring seven units in length has red blocks with a minimum length of three units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square. There are exactly seventeen ways of doing this. -How many ways can a row measuring fifty units in length be filled? NOTE: Although the example above does not lend itself to the possibility, in general it is permitted to mix block sizes. For example, on a row measuring eight units in length you could use red (3), black (1), and red (4). +Possible ways of placing block with a minimum length of three units, on a row with length of seven units + +How many ways can a row measuring fifty units in length be filled? + +**Note:** Although the example above does not lend itself to the possibility, in general it is permitted to mix block sizes. For example, on a row measuring eight units in length you could use red (3), black (1), and red (4). # --hints-- -`euler114()` should return 16475640049. +`countingBlockOne()` should return `16475640049`. ```js -assert.strictEqual(euler114(), 16475640049); +assert.strictEqual(countingBlockOne(), 16475640049); ``` # --seed-- @@ -25,12 +29,12 @@ assert.strictEqual(euler114(), 16475640049); ## --seed-contents-- ```js -function euler114() { +function countingBlockOne() { return true; } -euler114(); +countingBlockOne(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-115-counting-block-combinations-ii.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-115-counting-block-combinations-ii.md index 069a8a2c38..1e65da5610 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-115-counting-block-combinations-ii.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-115-counting-block-combinations-ii.md @@ -8,26 +8,26 @@ dashedName: problem-115-counting-block-combinations-ii # --description-- -NOTE: This is a more difficult version of Problem 114. +A row measuring `n` units in length has red blocks with a minimum length of `m` units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square. -A row measuring n units in length has red blocks with a minimum length of m units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square. +Let the fill-count function, $F(m, n)$, represent the number of ways that a row can be filled. -Let the fill-count function, F(m, n), represent the number of ways that a row can be filled. - -For example, F(3, 29) = 673135 and F(3, 30) = 1089155. +For example, $F(3, 29) = 673135$ and $F(3, 30) = 1089155$. That is, for m = 3, it can be seen that n = 30 is the smallest value for which the fill-count function first exceeds one million. -In the same way, for m = 10, it can be verified that F(10, 56) = 880711 and F(10, 57) = 1148904, so n = 57 is the least value for which the fill-count function first exceeds one million. +In the same way, for m = 10, it can be verified that $F(10, 56) = 880711$ and $F(10, 57) = 1148904$, so n = 57 is the least value for which the fill-count function first exceeds one million. -For m = 50, find the least value of n for which the fill-count function first exceeds one million. +For m = 50, find the least value of `n` for which the fill-count function first exceeds one million. + +**Note:** This is a more difficult version of Problem 114. # --hints-- -`euler115()` should return 168. +`countingBlockTwo()` should return `168`. ```js -assert.strictEqual(euler115(), 168); +assert.strictEqual(countingBlockTwo(), 168); ``` # --seed-- @@ -35,12 +35,12 @@ assert.strictEqual(euler115(), 168); ## --seed-contents-- ```js -function euler115() { +function countingBlockTwo() { return true; } -euler115(); +countingBlockTwo(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-116-red-green-or-blue-tiles.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-116-red-green-or-blue-tiles.md index 1f61195dea..a88bc07a34 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-116-red-green-or-blue-tiles.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-116-red-green-or-blue-tiles.md @@ -12,18 +12,26 @@ A row of five black square tiles is to have a number of its tiles replaced with If red tiles are chosen there are exactly seven ways this can be done. +Possible ways to placing red oblong on a row with length of five units + If green tiles are chosen there are three ways. +Possible ways of placing green oblong on a row with length of five units + And if blue tiles are chosen there are two ways. -Assuming that colours cannot be mixed there are 7 + 3 + 2 = 12 ways of replacing the black tiles in a row measuring five units in length. How many different ways can the black tiles in a row measuring fifty units in length be replaced if colours cannot be mixed and at least one coloured tile must be used? NOTE: This is related to Problem 117. +Possible ways of placing blue oblong on a row with length of five units + +Assuming that colors cannot be mixed there are 7 + 3 + 2 = 12 ways of replacing the black tiles in a row measuring five units in length. How many different ways can the black tiles in a row measuring fifty units in length be replaced if colors cannot be mixed and at least one colored tile must be used? + +**Note:** This is related to Problem 117. # --hints-- -`euler116()` should return 20492570929. +`redGreenBlueOne()` should return `20492570929`. ```js -assert.strictEqual(euler116(), 20492570929); +assert.strictEqual(redGreenBlueOne(), 20492570929); ``` # --seed-- @@ -31,12 +39,12 @@ assert.strictEqual(euler116(), 20492570929); ## --seed-contents-- ```js -function euler116() { +function redGreenBlueOne() { return true; } -euler116(); +redGreenBlueOne(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-117-red-green-and-blue-tiles.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-117-red-green-and-blue-tiles.md index 80f46d1201..ed6d035559 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-117-red-green-and-blue-tiles.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-117-red-green-and-blue-tiles.md @@ -10,14 +10,18 @@ dashedName: problem-117-red-green-and-blue-tiles Using a combination of black square tiles and oblong tiles chosen from: red tiles measuring two units, green tiles measuring three units, and blue tiles measuring four units, it is possible to tile a row measuring five units in length in exactly fifteen different ways. -How many ways can a row measuring fifty units in length be tiled? NOTE: This is related to Problem 116. +Possible ways of placing red, green and blue oblongs on a row with length of five units + +How many ways can a row measuring fifty units in length be tiled? + +**Note**: This is related to Problem 116. # --hints-- -`euler117()` should return 100808458960497. +`redGreenBlueTilesTwo()` should return `100808458960497`. ```js -assert.strictEqual(euler117(), 100808458960497); +assert.strictEqual(redGreenBlueTilesTwo(), 100808458960497); ``` # --seed-- @@ -25,12 +29,12 @@ assert.strictEqual(euler117(), 100808458960497); ## --seed-contents-- ```js -function euler117() { +function redGreenBlueTilesTwo() { return true; } -euler117(); +redGreenBlueTilesTwo(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-118-pandigital-prime-sets.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-118-pandigital-prime-sets.md index 8bcd4b5dcd..00a0605319 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-118-pandigital-prime-sets.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-118-pandigital-prime-sets.md @@ -8,16 +8,16 @@ dashedName: problem-118-pandigital-prime-sets # --description-- -Using all of the digits 1 through 9 and concatenating them freely to form decimal integers, different sets can be formed. Interestingly with the set {2,5,47,89,631}, all of the elements belonging to it are prime. +Using all of the digits 1 through 9 and concatenating them freely to form decimal integers, different sets can be formed. Interestingly with the set $\\{2, 5, 47, 89, 631\\}$, all of the elements belonging to it are prime. How many distinct sets containing each of the digits one through nine exactly once contain only prime elements? # --hints-- -`euler118()` should return 44680. +`pandigitalPrimeSets()` should return `44680`. ```js -assert.strictEqual(euler118(), 44680); +assert.strictEqual(pandigitalPrimeSets(), 44680); ``` # --seed-- @@ -25,12 +25,12 @@ assert.strictEqual(euler118(), 44680); ## --seed-contents-- ```js -function euler118() { +function pandigitalPrimeSets() { return true; } -euler118(); +pandigitalPrimeSets(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-119-digit-power-sum.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-119-digit-power-sum.md index 40853a1314..72ed8397d7 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-119-digit-power-sum.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-119-digit-power-sum.md @@ -8,20 +8,20 @@ dashedName: problem-119-digit-power-sum # --description-- -The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with this property is 614656 = 284. +The number 512 is interesting because it is equal to the sum of its digits raised to some power: $5 + 1 + 2 = 8$, and $8^3 = 512$. Another example of a number with this property is $614656 = 28^4$. -We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a sum. +We shall define an to be the $n-th$ term of this sequence and insist that a number must contain at least two digits to have a sum. -You are given that a2 = 512 and a10 = 614656. +You are given that $a_2 = 512$ and $a_{10} = 614656$. -Find a30. +Find $a_{30}$. # --hints-- -`euler119()` should return 248155780267521. +`digitPowerSum()` should return `248155780267521`. ```js -assert.strictEqual(euler119(), 248155780267521); +assert.strictEqual(digitPowerSum(), 248155780267521); ``` # --seed-- @@ -29,12 +29,12 @@ assert.strictEqual(euler119(), 248155780267521); ## --seed-contents-- ```js -function euler119() { +function digitPowerSum() { return true; } -euler119(); +digitPowerSum(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-120-square-remainders.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-120-square-remainders.md index 6bcf398e78..828f12b906 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-120-square-remainders.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-120-square-remainders.md @@ -8,18 +8,18 @@ dashedName: problem-120-square-remainders # --description-- -Let r be the remainder when (a−1)n + (a+1)n is divided by a2. +Let `r` be the remainder when ${(a − 1)}^n + {(a + 1)}^n$ is divided by $a^2$. -For example, if a = 7 and n = 3, then r = 42: 63 + 83 = 728 ≡ 42 mod 49. And as n varies, so too will r, but for a = 7 it turns out that rmax = 42. +For example, if $a = 7$ and $n = 3$, then $r = 42: 6^3 + 8^3 = 728 ≡ 42 \\ \text{mod}\\ 49$. And as `n` varies, so too will `r`, but for $a = 7$ it turns out that $r_{max} = 42$. -For 3 ≤ a ≤ 1000, find ∑ rmax. +For $3 ≤ a ≤ 1000$, find $\sum{r}_{max}$. # --hints-- -`euler120()` should return 333082500. +`squareRemainders()` should return `333082500`. ```js -assert.strictEqual(euler120(), 333082500); +assert.strictEqual(squareRemainders(), 333082500); ``` # --seed-- @@ -27,12 +27,12 @@ assert.strictEqual(euler120(), 333082500); ## --seed-contents-- ```js -function euler120() { +function squareRemainders() { return true; } -euler120(); +squareRemainders(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-15-lattice-paths.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-15-lattice-paths.md index b3b0a499c3..225a31ee93 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-15-lattice-paths.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-15-lattice-paths.md @@ -10,7 +10,7 @@ dashedName: problem-15-lattice-paths Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner. -a diagram of 6 2 by 2 grids showing all the routes to the bottom right corner +a diagram of 6 2 by 2 grids showing all the routes to the bottom right corner How many such routes are there through a given `gridSize`? diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.md index b632361a8b..fa659c2f46 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.md @@ -1,8 +1,7 @@ --- id: 5900f4031000cf542c50ff15 title: >- - Problem 150: Searching a triangular array for a sub-triangle having - minimum-sum + Problem 150: Searching a triangular array for a sub-triangle having minimum-sum challengeType: 5 forumTopicId: 301781 dashedName: problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md index c447c7ce9f..6b979cb0d7 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md @@ -1,8 +1,7 @@ --- id: 5900f40a1000cf542c50ff1d title: >- - Problem 158: Exploring strings for which only one character comes - lexicographically after its neighbour to the left + Problem 158: Exploring strings for which only one character comes lexicographically after its neighbour to the left challengeType: 5 forumTopicId: 301789 dashedName: >- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value.md index e511646823..8082f00bff 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value.md @@ -1,8 +1,7 @@ --- id: 5900f4111000cf542c50ff23 title: >- - Problem 164: Numbers for which no three consecutive digits have a sum greater - than a given value + Problem 164: Numbers for which no three consecutive digits have a sum greater than a given value challengeType: 5 forumTopicId: 301798 dashedName: >- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-169-exploring-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-169-exploring-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md index 0cfb0034f4..e0bf8ea804 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-169-exploring-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-169-exploring-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md @@ -1,8 +1,7 @@ --- id: 5900f4151000cf542c50ff28 title: >- - Problem 169: Exploring the number of different ways a number can be expressed - as a sum of powers of 2 + Problem 169: Exploring the number of different ways a number can be expressed as a sum of powers of 2 challengeType: 5 forumTopicId: 301803 dashedName: >- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-170-find-the-largest-0-to-9-pandigital-that-can-be-formed-by-concatenating-products.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-170-find-the-largest-0-to-9-pandigital-that-can-be-formed-by-concatenating-products.md index f12d0490f2..7a7e20558b 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-170-find-the-largest-0-to-9-pandigital-that-can-be-formed-by-concatenating-products.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-170-find-the-largest-0-to-9-pandigital-that-can-be-formed-by-concatenating-products.md @@ -1,8 +1,7 @@ --- id: 5900f4161000cf542c50ff29 title: >- - Problem 170: Find the largest 0 to 9 pandigital that can be formed by - concatenating products + Problem 170: Find the largest 0 to 9 pandigital that can be formed by concatenating products challengeType: 5 forumTopicId: 301805 dashedName: >- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square.md index d03ddf909b..2b355e111f 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square.md @@ -1,8 +1,7 @@ --- id: 5900f4181000cf542c50ff2a title: >- - Problem 171: Finding numbers for which the sum of the squares of the digits is - a square + Problem 171: Finding numbers for which the sum of the squares of the digits is a square challengeType: 5 forumTopicId: 301806 dashedName: >- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-173-using-up-to-one-million-tiles-how-many-different-hollow-square-laminae-can-be-formed.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-173-using-up-to-one-million-tiles-how-many-different-hollow-square-laminae-can-be-formed.md index a07789fd1d..700b710e80 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-173-using-up-to-one-million-tiles-how-many-different-hollow-square-laminae-can-be-formed.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-173-using-up-to-one-million-tiles-how-many-different-hollow-square-laminae-can-be-formed.md @@ -1,8 +1,7 @@ --- id: 5900f41a1000cf542c50ff2c title: >- - Problem 173: Using up to one million tiles how many different "hollow" square - laminae can be formed? + Problem 173: Using up to one million tiles how many different "hollow" square laminae can be formed? challengeType: 5 forumTopicId: 301808 dashedName: >- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-174-counting-the-number-of-hollow-square-laminae-that-can-form-one-two-three-...-distinct-arrangements.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-174-counting-the-number-of-hollow-square-laminae-that-can-form-one-two-three-...-distinct-arrangements.md index e7183612d5..1327791938 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-174-counting-the-number-of-hollow-square-laminae-that-can-form-one-two-three-...-distinct-arrangements.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-174-counting-the-number-of-hollow-square-laminae-that-can-form-one-two-three-...-distinct-arrangements.md @@ -1,8 +1,7 @@ --- id: 5900f41a1000cf542c50ff2d title: >- - Problem 174: Counting the number of "hollow" square laminae that can form one, - two, three, ... distinct arrangements + Problem 174: Counting the number of "hollow" square laminae that can form one, two, three, ... distinct arrangements challengeType: 5 forumTopicId: 301809 dashedName: >- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-175-fractions-involving-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-175-fractions-involving-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md index 8f32fcb4bd..cd3abbf807 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-175-fractions-involving-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-175-fractions-involving-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md @@ -1,8 +1,7 @@ --- id: 5900f41c1000cf542c50ff2e title: >- - Problem 175: Fractions involving the number of different ways a number can be - expressed as a sum of powers of 2 + Problem 175: Fractions involving the number of different ways a number can be expressed as a sum of powers of 2 challengeType: 5 forumTopicId: 301810 dashedName: >- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-181-investigating-in-how-many-ways-objects-of-two-different-colours-can-be-grouped.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-181-investigating-in-how-many-ways-objects-of-two-different-colours-can-be-grouped.md index 01c3730a1a..1aa8a4d087 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-181-investigating-in-how-many-ways-objects-of-two-different-colours-can-be-grouped.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-181-investigating-in-how-many-ways-objects-of-two-different-colours-can-be-grouped.md @@ -1,8 +1,7 @@ --- id: 5900f4231000cf542c50ff34 title: >- - Problem 181: Investigating in how many ways objects of two different colours - can be grouped + Problem 181: Investigating in how many ways objects of two different colours can be grouped challengeType: 5 forumTopicId: 301817 dashedName: >- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-182-rsa-encryption.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-182-rsa-encryption.md index 7ffc6ae376..c739b6384a 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-182-rsa-encryption.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-182-rsa-encryption.md @@ -10,26 +10,15 @@ dashedName: problem-182-rsa-encryption The RSA encryption is based on the following procedure: -Generate two distinct primes `p` and `q`. -Compute `n=p*q` and `φ=(p-1)(q-1)`. -Find an integer `e`, `1 < e < φ`, such that `gcd(e,φ) = 1` +Generate two distinct primes `p` and `q`. Compute `n=p*q` and `φ=(p-1)(q-1)`. Find an integer `e`, `1 < e < φ`, such that `gcd(e,φ) = 1` -A message in this system is a number in the interval `[0,n-1]`. -A text to be encrypted is then somehow converted to messages (numbers in the interval `[0,n-1]`). -To encrypt the text, for each message, `m`, c=me mod n is calculated. +A message in this system is a number in the interval `[0,n-1]`. A text to be encrypted is then somehow converted to messages (numbers in the interval `[0,n-1]`). To encrypt the text, for each message, `m`, c=me mod n is calculated. To decrypt the text, the following procedure is needed: calculate `d` such that `ed=1 mod φ`, then for each encrypted message, `c`, calculate m=cd mod n. -There exist values of `e` and `m` such that me mod n = m. -We call messages `m` for which me mod n=m unconcealed messages. +There exist values of `e` and `m` such that me mod n = m. We call messages `m` for which me mod n=m unconcealed messages. -An issue when choosing `e` is that there should not be too many unconcealed messages. -For instance, let `p=19` and `q=37`. -Then `n=19*37=703` and `φ=18*36=648`. -If we choose `e=181`, then, although `gcd(181,648)=1` it turns out that all possible messages -m `(0≤m≤n-1)` are unconcealed when calculating me mod n. -For any valid choice of `e` there exist some unconcealed messages. -It's important that the number of unconcealed messages is at a minimum. +An issue when choosing `e` is that there should not be too many unconcealed messages. For instance, let `p=19` and `q=37`. Then `n=19*37=703` and `φ=18*36=648`. If we choose `e=181`, then, although `gcd(181,648)=1` it turns out that all possible messages m `(0≤m≤n-1)` are unconcealed when calculating me mod n. For any valid choice of `e` there exist some unconcealed messages. It's important that the number of unconcealed messages is at a minimum. For any given `p` and `q`, find the sum of all values of `e`, `1 < e < φ(p,q)` and `gcd(e,φ)=1`, so that the number of unconcealed messages for this value of `e` is at a minimum. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-199-iterative-circle-packing.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-199-iterative-circle-packing.md index 28479e80b7..0194bbb44d 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-199-iterative-circle-packing.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-199-iterative-circle-packing.md @@ -10,7 +10,7 @@ dashedName: problem-199-iterative-circle-packing Three circles of equal radius are placed inside a larger circle such that each pair of circles is tangent to one another and the inner circles do not overlap. There are four uncovered "gaps" which are to be filled iteratively with more tangent circles. -a diagram of non-overlapping concentric circles +a diagram of non-overlapping concentric circles At each iteration, a maximally sized circle is placed in each gap, which creates more gaps for the next iteration. After 3 iterations (pictured), there are 108 gaps and the fraction of the area which is not covered by circles is 0.06790342, rounded to eight decimal places. @@ -60,7 +60,7 @@ function iterativeCirclePacking(n) { a1 += 3 * getArea(k0, k1, k1, n); a1 += getArea(k1, k1, k1, n); let final = ((a0 - a1) / a0).toFixed(8); - + return parseFloat(final); function getArea(k1, k2, k3, depth) { if (depth == 0) return 0.0; diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-200-find-the-200th-prime-proof-sqube-containing-the-contiguous-sub-string-200.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-200-find-the-200th-prime-proof-sqube-containing-the-contiguous-sub-string-200.md index bacbb306a1..c6458059ce 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-200-find-the-200th-prime-proof-sqube-containing-the-contiguous-sub-string-200.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-200-find-the-200th-prime-proof-sqube-containing-the-contiguous-sub-string-200.md @@ -1,8 +1,7 @@ --- id: 5900f4351000cf542c50ff47 title: >- - Problem 200: Find the 200th prime-proof sqube containing the contiguous - sub-string "200" + Problem 200: Find the 200th prime-proof sqube containing the contiguous sub-string "200" challengeType: 5 forumTopicId: 301840 dashedName: >- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-268-counting-numbers-with-at-least-four-distinct-prime-factors-less-than-100.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-268-counting-numbers-with-at-least-four-distinct-prime-factors-less-than-100.md index c703c2b10f..d11cb99eef 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-268-counting-numbers-with-at-least-four-distinct-prime-factors-less-than-100.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-268-counting-numbers-with-at-least-four-distinct-prime-factors-less-than-100.md @@ -1,8 +1,7 @@ --- id: 5900f4791000cf542c50ff8b title: >- - Problem 268: Counting numbers with at least four distinct prime factors less - than 100 + Problem 268: Counting numbers with at least four distinct prime factors less than 100 challengeType: 5 forumTopicId: 301917 dashedName: >- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-283-integer-sided-triangles-for-which-the-area--perimeter-ratio-is-integral.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-283-integer-sided-triangles-for-which-the-area--perimeter-ratio-is-integral.md index 7073e7c431..e15776ec08 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-283-integer-sided-triangles-for-which-the-area--perimeter-ratio-is-integral.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-283-integer-sided-triangles-for-which-the-area--perimeter-ratio-is-integral.md @@ -1,8 +1,7 @@ --- id: 5900f4881000cf542c50ff9a title: >- - Problem 283: Integer sided triangles for which the area * perimeter ratio is - integral + Problem 283: Integer sided triangles for which the area * perimeter ratio is integral challengeType: 5 forumTopicId: 301934 dashedName: >- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-349-langtons-ant.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-349-langtons-ant.md index e73c284fff..239ba5a6a1 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-349-langtons-ant.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-349-langtons-ant.md @@ -16,7 +16,7 @@ The ant is always oriented in one of the cardinal directions (left, right, up or \- if it is on a white square, it flips the color of the square to black, rotates 90 degrees clockwise and moves forward one square. -Starting with a grid that is entirely white, how many squares are black after 1018 moves of the ant? +Starting with a grid that is entirely white, how many squares are black after 1018 moves of the ant? # --hints-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-35-circular-primes.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-35-circular-primes.md index 9abfdee8ae..d3d74989d6 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-35-circular-primes.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-35-circular-primes.md @@ -14,7 +14,7 @@ There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73 How many circular primes are there below `n`, whereas 100 ≤ `n` ≤ 1000000? -**Note:** +**Note:** Circular primes individual rotation can exceed `n`. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-38-pandigital-multiples.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-38-pandigital-multiples.md index e385d29d0f..1c3f0c56c6 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-38-pandigital-multiples.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-38-pandigital-multiples.md @@ -10,11 +10,7 @@ dashedName: problem-38-pandigital-multiples Take the number 192 and multiply it by each of 1, 2, and 3: -$$\begin{align} - 192 × 1 = 192\\\\ - 192 × 2 = 384\\\\ - 192 × 3 = 576\\\\ -\end{align}$$ +$$\begin{align} 192 × 1 = 192\\\\ 192 × 2 = 384\\\\ 192 × 3 = 576\\\\ \end{align}$$ By concatenating each product we get the 1 to 9 pandigital, 192384576. We will call 192384576 the concatenated product of 192 and (1, 2, 3). diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-428-necklace-of-circles.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-428-necklace-of-circles.md index e3b2460e6d..5919151606 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-428-necklace-of-circles.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-428-necklace-of-circles.md @@ -20,7 +20,7 @@ The triplet (`a`, `b`, `c`) is called a *necklace triplet* if you can place `k`
          • Ci has no common interior points with any Cj for 1 ≤ i, jk and ij,
          • Ci is tangent to both Cin and Cout for 1 ≤ ik,
          • Ci is tangent to Ci+1 for 1 ≤ i < k, and
          • Ck is tangent to C1.
          For example, (5, 5, 5) and (4, 3, 21) are necklace triplets, while it can be shown that (2, 2, 5) is not. -a visual representation of a necklace triplet +a visual representation of a necklace triplet Let T(`n`) be the number of necklace triplets (`a`, `b`, `c`) such that `a`, `b` and `c` are positive integers, and `b` ≤ `n`. For example, T(1) = 9, T(20) = 732 and T(3000) = 438106. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-461-almost-pi.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-461-almost-pi.md index 10a83e63f8..9903fbe010 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-461-almost-pi.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-461-almost-pi.md @@ -56,7 +56,7 @@ assert.strictEqual(almostPi(200), 64658); ```js function almostPi(n) { - + return true; } ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-51-prime-digit-replacements.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-51-prime-digit-replacements.md index 7190e580ae..d890d42133 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-51-prime-digit-replacements.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-51-prime-digit-replacements.md @@ -12,20 +12,32 @@ By replacing the 1st digit of the 2-digit number \*3, it turns out that six of t By replacing the 3rd and 4th digits of 56\*\*3 with the same digit, this 5-digit number is the first example having seven primes among the ten generated numbers, yielding the family: 56003, 56113, 56333, 56443, 56663, 56773, and 56993. Consequently 56003, being the first member of this family, is the smallest prime with this property. -Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an eight prime value family. +Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an `n` prime value family. # --hints-- -`primeDigitReplacements()` should return a number. +`primeDigitReplacements(6)` should return a number. ```js -assert(typeof primeDigitReplacements() === 'number'); +assert(typeof primeDigitReplacements(6) === 'number'); ``` -`primeDigitReplacements()` should return 121313. +`primeDigitReplacements(6)` should return `13`. ```js -assert.strictEqual(primeDigitReplacements(), 121313); +assert.strictEqual(primeDigitReplacements(6), 13); +``` + +`primeDigitReplacements(7)` should return `56003`. + +```js +assert.strictEqual(primeDigitReplacements(7), 56003); +``` + +`primeDigitReplacements(8)` should return `121313`. + +```js +assert.strictEqual(primeDigitReplacements(8), 121313); ``` # --seed-- @@ -33,16 +45,81 @@ assert.strictEqual(primeDigitReplacements(), 121313); ## --seed-contents-- ```js -function primeDigitReplacements() { +function primeDigitReplacements(n) { return true; } -primeDigitReplacements(); +primeDigitReplacements(6); ``` # --solutions-- ```js -// solution required +function primeDigitReplacements(n) { + function isNFamily(number, primesMap, n) { + const prime = number.toString(); + const lastDigit = prime[prime.length - 1]; + return ( + doesReplacingMakeFamily(prime, '0', primesMap, n) || + (lastDigit !== '1' && + doesReplacingMakeFamily(prime, '1', primesMap, n)) || + doesReplacingMakeFamily(prime, '2', primesMap, n) + ); + } + + function doesReplacingMakeFamily(prime, digitToReplace, primesMap, family) { + let count = 0; + const replaceWith = '0123456789'; + + for (let i = 0; i < replaceWith.length; i++) { + const nextNumber = parseInt( + prime.replace(new RegExp(digitToReplace, 'g'), replaceWith[i]), + 10 + ); + + if (isPartOfFamily(nextNumber, prime, primesMap)) { + count++; + } + } + return count === family; + } + + function isPartOfFamily(number, prime, primesMap) { + return ( + isPrime(number, primesMap) && number.toString().length === prime.length + ); + } + + function getSievePrimes(max) { + const primesMap = new Array(max).fill(true); + primesMap[0] = false; + primesMap[1] = false; + + for (let i = 2; i < max; i++) { + if (primesMap[i]) { + let j = i * i; + for (j; j < max; j += i) { + primesMap[j] = false; + } + } + } + return primesMap; + } + + function isPrime(num, primesMap) { + return primesMap[num]; + } + + const primesMap = getSievePrimes(1000000); + + for (let number = 1; number < 300000; number++) { + if (primesMap[number]) { + if (isNFamily(number, primesMap, n)) { + return number; + } + } + } + return -1; +} ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-54-poker-hands.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-54-poker-hands.md index 16e04a9885..fd260cddf9 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-54-poker-hands.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-54-poker-hands.md @@ -29,11 +29,11 @@ If two players have the same ranked hands then the rank made up of the highest v Consider the following five hands dealt to two players: -| Hand | Player 1 | Player 2 | Winner | -| ------------------ | --------------------------------------------------------- | ---------------------------------------------------------- | -------- | -| 1 | 5H 5C 6S 7S KD
          Pair of Fives | 2C 3S 8S 8D TD
          Pair of Eights | Player 2 | -| 2 | 5D 8C 9S JS AC
          Highest card Ace | 2C 5C 7D 8S QH
          Highest card Queen | Player 1 | -| 3 | 2D 9C AS AH AC
          Three Aces | 3D 6D 7D TD QD
          Flush with Diamonds | Player 2 | +| Hand | Player 1 | Player 2 | Winner | +| ------------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------- | -------- | +| 1 | 5H 5C 6S 7S KD
          Pair of Fives | 2C 3S 8S 8D TD
          Pair of Eights | Player 2 | +| 2 | 5D 8C 9S JS AC
          Highest card Ace | 2C 5C 7D 8S QH
          Highest card Queen | Player 1 | +| 3 | 2D 9C AS AH AC
          Three Aces | 3D 6D 7D TD QD
          Flush with Diamonds | Player 2 | | 4 | 4D 6S 9H QH QC
          Pair of Queens
          Highest card Nine | 3D 6D 7H QD QS
          Pair of Queens
          Highest card Seven | Player 1 | | 5 | 2H 2D 4C 4D 4S
          Full House
          with Three Fours | 3C 3D 3S 9S 9D
          Full House
          with Three Threes | Player 1 | diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-61-cyclical-figurate-numbers.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-61-cyclical-figurate-numbers.md index 3f1e157026..8989f4171c 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-61-cyclical-figurate-numbers.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-61-cyclical-figurate-numbers.md @@ -10,14 +10,14 @@ dashedName: problem-61-cyclical-figurate-numbers Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae: -| Type of Number | Formula | Sequence | -| -------------- | ---------------------------- | --------------------- | +| Type of Number | Formula | Sequence | +| -------------- | ----------------------------- | --------------------- | | Triangle | $P_3(n) = \frac{n(n+1)}{2}$ | 1, 3, 6, 10, 15, ... | -| Square | $P_4(n) = n^2$ | 1, 4, 9, 16, 25, ... | +| Square | $P_4(n) = n^2$ | 1, 4, 9, 16, 25, ... | | Pentagonal | $P_5(n) = \frac{n(3n−1)}2$ | 1, 5, 12, 22, 35, ... | -| Hexagonal | $P_6(n) = n(2n−1)$ | 1, 6, 15, 28, 45, ... | +| Hexagonal | $P_6(n) = n(2n−1)$ | 1, 6, 15, 28, 45, ... | | Heptagonal | $P_7(n) = \frac{n(5n−3)}{2}$ | 1, 7, 18, 34, 55, ... | -| Octagonal | $P_8(n) = n(3n−2)$ | 1, 8, 21, 40, 65, ... | +| Octagonal | $P_8(n) = n(3n−2)$ | 1, 8, 21, 40, 65, ... | The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-68-magic-5-gon-ring.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-68-magic-5-gon-ring.md index 1492709e24..1ae580513f 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-68-magic-5-gon-ring.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-68-magic-5-gon-ring.md @@ -10,7 +10,7 @@ dashedName: problem-68-magic-5-gon-ring Consider the following "magic" 3-gon ring, filled with the numbers 1 to 6, and each line adding to nine. -a completed example of a 3-gon ring +a completed example of a 3-gon ring Working **clockwise**, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above solution can be described by the set: 4,3,2; 6,2,1; 5,1,3. @@ -18,7 +18,7 @@ It is possible to complete the ring with four different totals: 9, 10, 11, and 1
          -|
          Total
          |
          Solution Set
          | +| !!crwdBlockTags_6_sgaTkcolBdwrc!! |!!crwdBlockTags_7_sgaTkcolBdwrc!! | | -------------------------------------- | --------------------------------------------- | | 9 | 4,2,3; 5,3,1; 6,1,2 | | 9 | 4,3,2; 6,2,1; 5,1,3 | @@ -35,7 +35,7 @@ By concatenating each group it is possible to form 9-digit strings; the maximum Using the numbers 1 to 10, and depending on arrangements, it is possible to form 16- and 17-digit strings. What is the maximum **16-digit** string for a "magic" 5-gon ring? -a blank diagram of a 5-gon ring +a blank diagram of a 5-gon ring # --hints-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-74-digit-factorial-chains.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-74-digit-factorial-chains.md index f8645892aa..eb9a6e9d13 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-74-digit-factorial-chains.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-74-digit-factorial-chains.md @@ -14,19 +14,11 @@ $$1! + 4! + 5! = 1 + 24 + 120 = 145$$ Perhaps less well known is 169, in that it produces the longest chain of numbers that link back to 169; it turns out that there are only three such loops that exist: -$$\begin{align} -&169 → 363601 → 1454 → 169\\\\ -&871 → 45361 → 871\\\\ -&872 → 45362 → 872\\\\ -\end{align}$$ +$$\begin{align} &169 → 363601 → 1454 → 169\\\\ &871 → 45361 → 871\\\\ &872 → 45362 → 872\\\\ \end{align}$$ It is not difficult to prove that EVERY starting number will eventually get stuck in a loop. For example, -$$\begin{align} -&69 → 363600 → 1454 → 169 → 363601\\ (→ 1454)\\\\ -&78 → 45360 → 871 → 45361\\ (→ 871)\\\\ -&540 → 145\\ (→ 145)\\\\ -\end{align}$$ +$$\begin{align} &69 → 363600 → 1454 → 169 → 363601\\ (→ 1454)\\\\ &78 → 45360 → 871 → 45361\\ (→ 871)\\\\ &540 → 145\\ (→ 145)\\\\ \end{align}$$ Starting with 69 produces a chain of five non-repeating terms, but the longest non-repeating chain with a starting number below one million is sixty terms. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-81-path-sum-two-ways.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-81-path-sum-two-ways.md index 1a34ca9936..542d6ce39a 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-81-path-sum-two-ways.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-81-path-sum-two-ways.md @@ -10,13 +10,7 @@ dashedName: problem-81-path-sum-two-ways In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by **only moving to the right and down**, is indicated in bold red and is equal to `2427`. - $$\begin{pmatrix} - \color{red}{131} & 673 & 234 & 103 & 18\\\\ - \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\ - 630 & 803 & \color{red}{746} & \color{red}{422} & 111\\\\ - 537 & 699 & 497 & \color{red}{121} & 956\\\\ - 805 & 732 & 524 & \color{red}{37} & \color{red}{331} - \end{pmatrix}$$ + $$\begin{pmatrix} \color{red}{131} & 673 & 234 & 103 & 18\\\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\ 630 & 803 & \color{red}{746} & \color{red}{422} & 111\\\\ 537 & 699 & 497 & \color{red}{121} & 956\\\\ 805 & 732 & 524 & \color{red}{37} & \color{red}{331} \end{pmatrix}$$ Find the minimal path sum from the top left to the bottom right by only moving right and down in `matrix`, a 2D array representing a matrix. The maximum matrix size used in the tests will be 80 by 80. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-82-path-sum-three-ways.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-82-path-sum-three-ways.md index 27e015ed2f..ec68b544e2 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-82-path-sum-three-ways.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-82-path-sum-three-ways.md @@ -12,13 +12,7 @@ dashedName: problem-82-path-sum-three-ways The minimal path sum in the 5 by 5 matrix below, by starting in any cell in the left column and finishing in any cell in the right column, and only moving up, down, and right, is indicated in red and bold; the sum is equal to `994`. - $$\begin{pmatrix} - 131 & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\ - \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\ - 630 & 803 & 746 & 422 & 111\\\\ - 537 & 699 & 497 & 121 & 956\\\\ - 805 & 732 & 524 & 37 & 331 - \end{pmatrix}$$ + $$\begin{pmatrix} 131 & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\ 630 & 803 & 746 & 422 & 111\\\\ 537 & 699 & 497 & 121 & 956\\\\ 805 & 732 & 524 & 37 & 331 \end{pmatrix}$$ Find the minimal path sum from the left column to the right column in `matrix`, a 2D array representing a matrix. The maximum matrix size used in tests will be 80 by 80. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-83-path-sum-four-ways.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-83-path-sum-four-ways.md index bd3b6f085a..ce957c019f 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-83-path-sum-four-ways.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-83-path-sum-four-ways.md @@ -12,13 +12,7 @@ dashedName: problem-83-path-sum-four-ways In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by moving left, right, up, and down, is indicated in bold red and is equal to `2297`. - $$\begin{pmatrix} - \color{red}{131} & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\ - \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & \color{red}{150}\\\\ - 630 & 803 & 746 & \color{red}{422} & \color{red}{111}\\\\ - 537 & 699 & 497 & \color{red}{121} & 956\\\\ - 805 & 732 & 524 & \color{red}{37} & \color{red}{331} - \end{pmatrix}$$ + $$\begin{pmatrix} \color{red}{131} & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & \color{red}{150}\\\\ 630 & 803 & 746 & \color{red}{422} & \color{red}{111}\\\\ 537 & 699 & 497 & \color{red}{121} & 956\\\\ 805 & 732 & 524 & \color{red}{37} & \color{red}{331} \end{pmatrix}$$ Find the minimal path sum from the top left to the bottom right by moving left, right, up, and down in `matrix`, a 2D array representing a matrix. The maximum matrix size used in tests will be 80 by 80. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-85-counting-rectangles.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-85-counting-rectangles.md index 5db9e13fec..c6d4c9c2c6 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-85-counting-rectangles.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-85-counting-rectangles.md @@ -10,7 +10,7 @@ dashedName: problem-85-counting-rectangles By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles: -a diagram of the different rectangles found within a 3 by 2 rectangular grid +a diagram of the different rectangles found within a 3 by 2 rectangular grid Although there may not exists a rectangular grid that contains exactly `n` rectangles, find the area of the grid with the nearest solution. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-86-cuboid-route.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-86-cuboid-route.md index caa496a114..bcd935b24d 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-86-cuboid-route.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-86-cuboid-route.md @@ -10,7 +10,7 @@ dashedName: problem-86-cuboid-route A spider, S, sits in one corner of a cuboid room, measuring 6 by 5 by 3, and a fly, F, sits in the opposite corner. By travelling on the surfaces of the room the shortest "straight line" distance from S to F is 10 and the path is shown on the diagram. -a diagram of a spider and fly's path from one corner of a cuboid room to the opposite corner +a diagram of a spider and fly's path from one corner of a cuboid room to the opposite corner However, there are up to three "shortest" path candidates for any given cuboid and the shortest route doesn't always have integer length. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-90-cube-digit-pairs.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-90-cube-digit-pairs.md index c07bf97f28..ef2182b215 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-90-cube-digit-pairs.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-90-cube-digit-pairs.md @@ -12,7 +12,7 @@ Each of the six faces on a cube has a different digit (0 to 9) written on it; th For example, the square number 64 could be formed: -two cubes, one with the number 6 and the other with number 4 +two cubes, one with the number 6 and the other with number 4 In fact, by carefully choosing the digits on both cubes it is possible to display all of the square numbers below one-hundred: 01, 04, 09, 16, 25, 36, 49, 64, and 81. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-91-right-triangles-with-integer-coordinates.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-91-right-triangles-with-integer-coordinates.md index b38a0eb1bc..b920e69678 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-91-right-triangles-with-integer-coordinates.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-91-right-triangles-with-integer-coordinates.md @@ -10,11 +10,11 @@ dashedName: problem-91-right-triangles-with-integer-coordinates The points ${P}(x_1, y_1)$ and ${Q}(x_2, y_2)$ are plotted at integer co-ordinates and are joined to the origin, ${O}(0, 0)$, to form ${\Delta}OPQ$. -a graph plotting points P (x_1, y_1) and Q(x_2, y_2) at integer coordinates that are joined to the origin O (0, 0) +a graph plotting points P (x_1, y_1) and Q(x_2, y_2) at integer coordinates that are joined to the origin O (0, 0) There are exactly fourteen triangles containing a right angle that can be formed when each co-ordinate lies between 0 and 2 inclusive; that is, $0 ≤ x_1, y_1, x_2, y_2 ≤ 2$. -a diagram showing the 14 triangles containing a right angle that can be formed when each coordinate is between 0 and 2 +a diagram showing the 14 triangles containing a right angle that can be formed when each coordinate is between 0 and 2 Given that $0 ≤ x_1, y_1, x_2, y_2 ≤ limit$, how many right triangles can be formed? diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-92-square-digit-chains.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-92-square-digit-chains.md index 065f0b748d..5f62bd9da7 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-92-square-digit-chains.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-92-square-digit-chains.md @@ -12,10 +12,7 @@ A number chain is created by continuously adding the square of the digits in a n For example, -$$\begin{align} - & 44 → 32 → 13 → 10 → \boldsymbol{1} → \boldsymbol{1}\\\\ - & 85 → \boldsymbol{89} → 145 → 42 → 20 → 4 → 16 → 37 → 58 → \boldsymbol{89}\\\\ -\end{align}$$ +$$\begin{align} & 44 → 32 → 13 → 10 → \boldsymbol{1} → \boldsymbol{1}\\\\ & 85 → \boldsymbol{89} → 145 → 42 → 20 → 4 → 16 → 37 → 58 → \boldsymbol{89}\\\\ \end{align}$$ Therefore any chain that arrives at 1 or 89 will become stuck in an endless loop. What is most amazing is that EVERY starting number will eventually arrive at 1 or 89. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-95-amicable-chains.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-95-amicable-chains.md index 9d42e7c6f5..19d2301062 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-95-amicable-chains.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-95-amicable-chains.md @@ -14,9 +14,7 @@ Interestingly the sum of the proper divisors of 220 is 284 and the sum of the pr Perhaps less well known are longer chains. For example, starting with 12496, we form a chain of five numbers: -$$ - 12496 → 14288 → 15472 → 14536 → 14264 \\,(→ 12496 → \cdots) -$$ +$$ 12496 → 14288 → 15472 → 14536 → 14264 \\,(→ 12496 → \cdots) $$ Since this chain returns to its starting point, it is called an amicable chain. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/24-game.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/24-game.md index 80b03ca6a5..7bf28fe4df 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/24-game.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/24-game.md @@ -24,10 +24,10 @@ Implement a function that takes a string of four digits as its argument, with ea
        • The order of the digits when given does not have to be preserved.
        -| Example input | Example output | -| ----------------------------- | ------------------------- | -| solve24("4878"); | (7-8/8)\*4 | -| solve24("1234"); | 3\*1\*4\*2 | +| Example input | Example output | +| ------------------------- | ------------------------- | +| solve24("4878"); | (7-8/8)\*4 | +| solve24("1234"); | 3\*1\*4\*2 | | solve24("6789"); | (6\*8)/(9-7) | | solve24("1127"); | (1+7)\*(2+1) | diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer.md index 66eecef2be..125236ca75 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer.md @@ -8,7 +8,7 @@ dashedName: 9-billion-names-of-god-the-integer # --description-- -This task is a variation of the [short story by Arthur C. Clarke]( "wp: The Nine Billion Names of God#Plot_summary"). +This task is a variation of the [short story by Arthur C. Clarke](https://en.wikipedia.org/wiki/The Nine Billion Names of God#Plot_summary "wp: The Nine Billion Names of God#Plot_summary"). (Solvers should be aware of the consequences of completing this task.) diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/align-columns.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/align-columns.md index 45ff5fa2f3..2b58a1e1d8 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/align-columns.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/align-columns.md @@ -8,35 +8,43 @@ dashedName: align-columns # --description-- -Given a text file of many lines, where fields within a line are delineated by a single `$` character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, or center justified within its column. +Given an array of many lines, where fields within a line are delineated by a single `$` character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, or center justified within its column. # --instructions-- Use the following text to test your programs: -
        -Given$a$text$file$of$many$lines
        -where$fields$within$a$line$
        -are$delineated$by$a$single$'dollar'$character
        -write$a$program
        -that$aligns$each$column$of$fields
        -by$ensuring$that$words$in$each$
        -column$are$separated$by$at$least$one$space.
        -Further,$allow$for$each$word$in$a$column$to$be$either$left$
        -justified,$right$justified
        -or$center$justified$within$its$column.
        -
        +```js +const testText = [ + 'Given$a$text$file$of$many$lines', + 'where$fields$within$a$line$', + 'are$delineated$by$a$single$"dollar"$character', + 'write$a$program', + 'that$aligns$each$column$of$fields', + 'by$ensuring$that$words$in$each$', + 'column$are$separated$by$at$least$one$space.', + 'Further,$allow$for$each$word$in$a$column$to$be$either$left$', + 'justified,$right$justified', + 'or$center$justified$within$its$column.' +]; +``` **Note that:** -
          -
        • The example input texts lines may, or may not, have trailing dollar characters.
        • -
        • All columns should share the same alignment.
        • -
        • Consecutive space characters produced adjacent to the end of lines are insignificant for the purposes of the task.
        • -
        • Output text will be viewed in a mono-spaced font on a plain text editor or basic terminal.
        • -
        • The minimum space between columns should be computed from the text and not hard-coded.
        • -
        • It is not a requirement to add separating characters between or around columns.
        • -
        +- The example input texts lines may, or may not, have trailing dollar characters. +- All columns should share the same alignment. +- Consecutive space characters produced adjacent to the end of lines are insignificant for the purposes of the task. +- Output text will be viewed in a mono-spaced font on a plain text editor or basic terminal. Lines in it should be joined using new line character (`\n`). +- The minimum space between columns should be computed from the text and not hard-coded. +- It is not a requirement to add separating characters between or around columns. + +For example, one of the lines from the `testText`, after jusitifing to the right, left and center respectivelly: + +```js +' column are separated by at least one space.\n' +'column are separated by at least one space.\n' +' column are separated by at least one space.\n' +``` # --hints-- @@ -46,22 +54,22 @@ or$center$justified$within$its$column. assert(typeof formatText === 'function'); ``` -`formatText` with the above input and "right" justification should produce the following: +`formatText(testText, 'right')` should produce text with columns justified to the right. ```js -assert.strictEqual(formatText(testInput, 'right'), rightAligned); +assert.strictEqual(formatText(_testText, 'right'), rightAligned); ``` -`formatText` with the above input and "left" justification should produce the following: +`formatText(testText, 'left')` should produce text with columns justified to the left. ```js -assert.strictEqual(formatText(testInput, 'left'), leftAligned); +assert.strictEqual(formatText(_testText, 'left'), leftAligned); ``` -`formatText` with the above input and "center" justification should produce the following: +`formatText(testText, 'center')` should produce text with columns justified to the center. ```js -assert.strictEqual(formatText(testInput, 'center'), centerAligned); +assert.strictEqual(formatText(_testText, 'center'), centerAligned); ``` # --seed-- @@ -69,10 +77,10 @@ assert.strictEqual(formatText(testInput, 'center'), centerAligned); ## --after-user-code-- ```js -const testInput = [ +const _testText = [ 'Given$a$text$file$of$many$lines', 'where$fields$within$a$line$', - 'are$delineated$by$a$single$\"dollar\"$character', + 'are$delineated$by$a$single$"dollar"$character', 'write$a$program', 'that$aligns$each$column$of$fields$', 'by$ensuring$that$words$in$each$', @@ -119,7 +127,11 @@ const centerAligned = ' Given a text file of many ## --seed-contents-- ```js -const testArr = [ +function formatText(input, justification) { + +} + +const testText = [ 'Given$a$text$file$of$many$lines', 'where$fields$within$a$line$', 'are$delineated$by$a$single$"dollar"$character', @@ -131,28 +143,11 @@ const testArr = [ 'justified,$right$justified', 'or$center$justified$within$its$column.' ]; - -function formatText(input, justification) { - -} ``` # --solutions-- ```js -const testArr = [ - 'Given$a$text$file$of$many$lines', - 'where$fields$within$a$line$', - 'are$delineated$by$a$single$"dollar"$character', - 'write$a$program', - 'that$aligns$each$column$of$fields$', - 'by$ensuring$that$words$in$each$', - 'column$are$separated$by$at$least$one$space.', - 'Further,$allow$for$each$word$in$a$column$to$be$either$left$', - 'justified,$right$justified', - 'or$center$justified$within$its$column.' -]; - String.prototype.repeat = function (n) { return new Array(1 + parseInt(n)).join(this); }; function formatText(input, justification) { diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/amicable-pairs.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/amicable-pairs.md index 3fe512a48f..207ab439f3 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/amicable-pairs.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/amicable-pairs.md @@ -8,7 +8,7 @@ dashedName: amicable-pairs # --description-- -Two integers $N$ and $M$ are said to be [amicable pairs]( "wp: Amicable numbers") if $N \\neq M$ and the sum of the [proper divisors]( "Proper divisors") of $N$ ($\\mathrm{sum}(\\mathrm{propDivs}(N))$) $= M$ as well as $\\mathrm{sum}(\\mathrm{propDivs}(M)) = N$. +Two integers $N$ and $M$ are said to be [amicable pairs](https://en.wikipedia.org/wiki/Amicable numbers "wp: Amicable numbers") if $N \\neq M$ and the sum of the [proper divisors](https://rosettacode.org/wiki/Proper divisors "Proper divisors") of $N$ ($\\mathrm{sum}(\\mathrm{propDivs}(N))$) $= M$ as well as $\\mathrm{sum}(\\mathrm{propDivs}(M)) = N$. **Example:** diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/averages-mode.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/averages-mode.md index e9f98a9187..166050bd51 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/averages-mode.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/averages-mode.md @@ -8,7 +8,7 @@ dashedName: averagesmode # --description-- -Write a program to find the [mode]( "wp: Mode (statistics)") value of a collection. +Write a program to find the [mode](https://en.wikipedia.org/wiki/Mode (statistics) "wp: Mode (statistics)") value of a collection. The case where the collection is empty may be ignored. Care must be taken to handle the case where the mode is non-unique. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/averages-pythagorean-means.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/averages-pythagorean-means.md index daac04f1a5..45425141e3 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/averages-pythagorean-means.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/averages-pythagorean-means.md @@ -8,7 +8,7 @@ dashedName: averagespythagorean-means # --description-- -Compute all three of the [Pythagorean means]( "wp: Pythagorean means") of the set of integers $1$ through $10$ (inclusive). +Compute all three of the [Pythagorean means](https://en.wikipedia.org/wiki/Pythagorean means "wp: Pythagorean means") of the set of integers $1$ through $10$ (inclusive). Show that $A(x_1,\\ldots,x_n) \\geq G(x_1,\\ldots,x_n) \\geq H(x_1,\\ldots,x_n)$ for this set of positive integers. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/averages-root-mean-square.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/averages-root-mean-square.md index 080f3e6eea..d7bb3ef969 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/averages-root-mean-square.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/averages-root-mean-square.md @@ -8,7 +8,7 @@ dashedName: averagesroot-mean-square # --description-- -Compute the [Root mean square]( "wp: Root mean square") of the numbers 1 through 10 inclusive. +Compute the [Root mean square](https://en.wikipedia.org/wiki/Root mean square "wp: Root mean square") of the numbers 1 through 10 inclusive. The *root mean square* is also known by its initials RMS (or rms), and as the **quadratic mean**. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/balanced-brackets.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/balanced-brackets.md index e32338e301..5045fbd2ca 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/balanced-brackets.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/balanced-brackets.md @@ -13,11 +13,11 @@ Determine whether a generated string of brackets is balanced; that is, whether i **Examples:** | Input | Output | | ------------------------- | ------ | -| \[] | true | -| ]\[ | false | -| [][] | true | -| ]\[] | false | -| \[]]\[\[] | false | +| \[] | true | +| ]\[ | false | +| [][] | true | +| ]\[] | false | +| \[]]\[\[] | false | | \[\[\[\[]]]] | true | # --hints-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration.md index 740d69b7b0..e050e0d7d2 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration.md @@ -19,10 +19,10 @@ Demonstrate that it passes the following three test-cases:
        Test Cases
        -| Input number | Output number | -| ------------ | ------------------------------------- | -| 7259 | 2 hr, 59 sec | -| 86400 | 1 d | +| Input number | Output number | +| ------------ | ------------------------- | +| 7259 | 2 hr, 59 sec | +| 86400 | 1 d | | 6000000 | 9 wk, 6 d, 10 hr, 40 min |
        Details
        @@ -32,11 +32,11 @@ Demonstrate that it passes the following three test-cases: | Unit | Suffix used in Output | Conversion | | ------ | --------------------- | --------------------- | -| week | wk | 1 week = 7 days | -| day | d | 1 day = 24 hours | -| hour | hr | 1 hour = 60 minutes | -| minute | min | 1 minute = 60 seconds | -| second | sec | --- | +| week |!!crwdBlockTags_18_sgaTkcolBdwrc!! | 1 week = 7 days | +| day |!!crwdBlockTags_19_sgaTkcolBdwrc!! | 1 day = 24 hours | +| hour |!!crwdBlockTags_20_sgaTkcolBdwrc!! | 1 hour = 60 minutes | +| minute |!!crwdBlockTags_21_sgaTkcolBdwrc!! | 1 minute = 60 seconds | +| second |!!crwdBlockTags_22_sgaTkcolBdwrc!! | --- |
      • diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/cramers-rule.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/cramers-rule.md index 9b49a3fac2..7580e28c50 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/cramers-rule.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/cramers-rule.md @@ -8,7 +8,7 @@ dashedName: cramers-rule # --description-- -In [linear algebra]( "wp: linear algebra"), [Cramer's rule]( "wp: Cramer's rule") is an explicit formula for the solution of a [system of linear equations]( "wp: system of linear equations") with as many equations as unknowns, valid whenever the system has a unique solution. It expresses the solution in terms of the determinants of the (square) coefficient matrix and of matrices obtained from it by replacing one column by the vector of right hand sides of the equations. +In [linear algebra](https://en.wikipedia.org/wiki/linear algebra "wp: linear algebra"), [Cramer's rule](https://en.wikipedia.org/wiki/Cramer's rule "wp: Cramer's rule") is an explicit formula for the solution of a [system of linear equations](https://en.wikipedia.org/wiki/system of linear equations "wp: system of linear equations") with as many equations as unknowns, valid whenever the system has a unique solution. It expresses the solution in terms of the determinants of the (square) coefficient matrix and of matrices obtained from it by replacing one column by the vector of right hand sides of the equations. Given diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/cumulative-standard-deviation.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/cumulative-standard-deviation.md index 4ca5496cb7..28aa14710d 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/cumulative-standard-deviation.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/cumulative-standard-deviation.md @@ -8,7 +8,7 @@ dashedName: cumulative-standard-deviation # --description-- -Write a function that takes an array of numbers as parameter and returns the [standard deviation]() of the series. +Write a function that takes an array of numbers as parameter and returns the [standard deviation](https://en.wikipedia.org/wiki/Standard Deviation) of the series. # --hints-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/deal-cards-for-freecell.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/deal-cards-for-freecell.md index e74d1883eb..f998915595 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/deal-cards-for-freecell.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/deal-cards-for-freecell.md @@ -12,7 +12,7 @@ dashedName: deal-cards-for-freecell As the game became popular, Jim Horne disclosed the algorithm, and other implementations of FreeCell began to reproduce the Microsoft deals. These deals are numbered from 1 to 32000. Newer versions from Microsoft have 1 million deals, numbered from 1 to 1000000; some implementations allow numbers outside that range. -The algorithm uses this [linear congruential generator]( "linear congruential generator") from Microsoft C: +The algorithm uses this [linear congruential generator](https://rosettacode.org/wiki/linear congruential generator "linear congruential generator") from Microsoft C:
        • $state_{n + 1} \equiv 214013 \times state_n + 2531011 \pmod{2^{31}}$
        • diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/discordian-date.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/discordian-date.md index 217c79db1c..811a3b867e 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/discordian-date.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/discordian-date.md @@ -8,7 +8,7 @@ dashedName: discordian-date # --description-- -Convert a given date from the [Gregorian calendar]( "wp: Gregorian calendar") to the [Discordian calendar]( "wp: Discordian calendar"). +Convert a given date from the [Gregorian calendar](https://en.wikipedia.org/wiki/Gregorian calendar "wp: Gregorian calendar") to the [Discordian calendar](https://en.wikipedia.org/wiki/Discordian calendar "wp: Discordian calendar"). # --hints-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/dot-product.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/dot-product.md index 5584a7e26a..c1c61d1b12 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/dot-product.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/dot-product.md @@ -8,7 +8,7 @@ dashedName: dot-product # --description-- -Create a function, to compute the **[dot product]()**, also known as the **scalar product** of two vectors. +Create a function, to compute the **[dot product](https://en.wikipedia.org/wiki/Dot product)**, also known as the **scalar product** of two vectors. # --hints-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/euler-method.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/euler-method.md index 86f2d9c75e..4a17c09a25 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/euler-method.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/euler-method.md @@ -8,7 +8,7 @@ dashedName: euler-method # --description-- -Euler's method numerically approximates solutions of first-order ordinary differential equations (ODEs) with a given initial value. It is an explicit method for solving initial value problems (IVPs), as described in [the wikipedia page]( "wp: Euler method"). +Euler's method numerically approximates solutions of first-order ordinary differential equations (ODEs) with a given initial value. It is an explicit method for solving initial value problems (IVPs), as described in [the wikipedia page](https://en.wikipedia.org/wiki/Euler method "wp: Euler method"). The ODE has to be provided in the following form: @@ -89,7 +89,7 @@ and compare with the analytical solution.
        • room temperature $T_R$ shall be 20 °C
        • cooling constant $k$ shall be 0.07
        • time interval to calculate shall be from 0 s to 100 s
        • -
        +
      First parameter to the function is initial time, second parameter is initial temperature, third parameter is elapsed time and fourth parameter is step size. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md index 5dffbaf6cb..cdc024dab4 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md @@ -8,7 +8,7 @@ dashedName: execute-a-markov-algorithm # --description-- -Create an interpreter for a [Markov Algorithm]( "wp: Markov algorithm"). +Create an interpreter for a [Markov Algorithm](https://en.wikipedia.org/wiki/Markov algorithm "wp: Markov algorithm"). Rules have the syntax: diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/execute-brain.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/execute-brain.md index a1dc29757d..7504589e58 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/execute-brain.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/execute-brain.md @@ -16,16 +16,16 @@ Below are links to each of the versions of RCBF. An implementation need only properly implement the following instructions: -| Command | Description | -| ----------------- | ---------------------------------------------------------------------------------- | -| > | Move the pointer to the right | -| < | Move the pointer to the left | -| + | Increment the memory cell under the pointer | -| - | Decrement the memory cell under the pointer | -| . | Output the character signified by the cell at the pointer | -| , | Input a character and store it in the cell at the pointer | -| \[ | Jump past the matching ] if the cell under the pointer is 0 | -| ] | Jump back to the matching \[ if the cell under the pointer is nonzero | +| Command | Description | +| ------------------------- | ------------------------------------------------------------------------------------------ | +| > | Move the pointer to the right | +| < | Move the pointer to the left | +| + | Increment the memory cell under the pointer | +| - | Decrement the memory cell under the pointer | +| . | Output the character signified by the cell at the pointer | +| , | Input a character and store it in the cell at the pointer | +| \[ | Jump past the matching ] if the cell under the pointer is 0 | +| ] | Jump back to the matching \[ if the cell under the pointer is nonzero | Any cell size is allowed, EOF (*E*nd-*O*-*F*ile) support is optional, as is whether you have bounded or unbounded memory. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md index 273062a0cf..0e5a414555 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md @@ -12,7 +12,7 @@ A Mersenne number is a number in the form of 2P-1. If `P` is prime, the Mersenne number may be a Mersenne prime. (If `P` is not prime, the Mersenne number is also not prime.) -In the search for Mersenne prime numbers it is advantageous to eliminate exponents by finding a small factor before starting a, potentially lengthy, [Lucas-Lehmer test]( "Lucas-Lehmer test"). +In the search for Mersenne prime numbers it is advantageous to eliminate exponents by finding a small factor before starting a, potentially lengthy, [Lucas-Lehmer test](https://rosettacode.org/wiki/Lucas-Lehmer test "Lucas-Lehmer test"). There are very efficient algorithms for determining if a number divides 2P-1 (or equivalently, if 2P mod (the number) = 1). @@ -48,7 +48,7 @@ Further properties of Mersenne numbers allow us to refine the process even more. Any factor `q` of 2P-1 must be of the form `2kP+1`, `k` being a positive integer or zero. Furthermore, `q` must be `1` or `7 mod 8`. -Finally any potential factor `q` must be [prime]( "Primality by Trial Division"). +Finally any potential factor `q` must be [prime](https://rosettacode.org/wiki/Primality by Trial Division "Primality by Trial Division"). As in other trial division algorithms, the algorithm stops when `2kP+1 > sqrt(N)`.These primarily tests only work on Mersenne numbers where `P` is prime. For example, M4=15 yields no factors using these techniques, but factors into 3 and 5, neither of which fit `2kP+1`. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/farey-sequence.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/farey-sequence.md index 8e508d134c..59b4edc9a5 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/farey-sequence.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/farey-sequence.md @@ -8,7 +8,7 @@ dashedName: farey-sequence # --description-- -The [Farey sequence]( "wp: Farey sequence") Fn of order `n` is the sequence of completely reduced fractions between `0` and `1` which, when in lowest terms, have denominators less than or equal to `n`, arranged in order of increasing size. +The [Farey sequence](https://en.wikipedia.org/wiki/Farey sequence "wp: Farey sequence") Fn of order `n` is the sequence of completely reduced fractions between `0` and `1` which, when in lowest terms, have denominators less than or equal to `n`, arranged in order of increasing size. The *Farey sequence* is sometimes incorrectly called a *Farey series*. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences.md index 6791320f73..456b87de79 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences.md @@ -8,7 +8,7 @@ dashedName: fibonacci-n-step-number-sequences # --description-- -These number series are an expansion of the ordinary [Fibonacci sequence]( "Fibonacci sequence") where: +These number series are an expansion of the ordinary [Fibonacci sequence](https://rosettacode.org/wiki/Fibonacci sequence "Fibonacci sequence") where:
      1. For $n = 2$ we have the Fibonacci sequence; with initial values $[1, 1]$ and $F_k^2 = F_{k-1}^2 + F_{k-2}^2$
      2. @@ -17,7 +17,7 @@ These number series are an expansion of the ordinary [Fibonacci sequence](For general $n>2$ we have the Fibonacci $n$-step sequence - $F_k^n$; with initial values of the first $n$ values of the $(n-1)$'th Fibonacci $n$-step sequence $F_k^{n-1}$; and $k$'th value of this $n$'th sequence being $F_k^n = \sum_{i=1}^{(n)} {F_{k-i}^{(n)}}$
      -For small values of $n$, [Greek numeric prefixes]( "wp: Number prefix#Greek_series") are sometimes used to individually name each series. +For small values of $n$, [Greek numeric prefixes](https://en.wikipedia.org/wiki/Number prefix#Greek_series "wp: Number prefix#Greek_series") are sometimes used to individually name each series. Fibonacci $n$-step sequences: @@ -33,7 +33,7 @@ Fibonacci $n$-step sequences: | 9 | nonanacci | 1 1 2 4 8 16 32 64 128 256 511 1021 2040 4076 8144 ... | | 10 | decanacci | 1 1 2 4 8 16 32 64 128 256 512 1023 2045 4088 8172 ... | -Allied sequences can be generated where the initial values are changed: The [Lucas series]( "wp: Lucas number") sums the two preceding values like the fibonacci series for $n=2$ but uses $\[2, 1]$ as its initial values. +Allied sequences can be generated where the initial values are changed: The [Lucas series](https://en.wikipedia.org/wiki/Lucas number "wp: Lucas number") sums the two preceding values like the fibonacci series for $n=2$ but uses $\[2, 1]$ as its initial values. # --instructions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/fractran.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/fractran.md index e8e4d35925..0bcda09bde 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/fractran.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/fractran.md @@ -8,7 +8,7 @@ dashedName: fractran # --description-- -[FRACTRAN](https://en.wikipedia.org/wiki/FRACTRAN "wp: FRACTRAN") is a Turing-complete esoteric programming language invented by the mathematician [John Horton Conway]( "wp: John Horton Conway"). +[FRACTRAN](https://en.wikipedia.org/wiki/FRACTRAN "wp: FRACTRAN") is a Turing-complete esoteric programming language invented by the mathematician [John Horton Conway](https://en.wikipedia.org/wiki/John Horton Conway "wp: John Horton Conway"). A FRACTRAN program is an ordered list of positive fractions $P = (f_1, f_2, \\ldots, f_m)$, together with an initial positive integer input $n$. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/gamma-function.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/gamma-function.md index d764232158..f105a0a1bd 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/gamma-function.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/gamma-function.md @@ -8,7 +8,7 @@ dashedName: gamma-function # --description-- -Implement one algorithm (or more) to compute the [Gamma]() ($\\Gamma$) function (in the real field only). +Implement one algorithm (or more) to compute the [Gamma](https://en.wikipedia.org/wiki/Gamma function) ($\\Gamma$) function (in the real field only). The Gamma function can be defined as: diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/gray-code.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/gray-code.md index 4e5c523737..f46350f0be 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/gray-code.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/gray-code.md @@ -8,11 +8,11 @@ dashedName: gray-code # --description-- -[Gray code]() is a form of binary encoding where transitions between consecutive numbers differ by only one bit. +[Gray code](https://en.wikipedia.org/wiki/Gray code) is a form of binary encoding where transitions between consecutive numbers differ by only one bit. This is a useful encoding for reducing hardware data hazards with values that change rapidly and/or connect to slower hardware as inputs. -It is also useful for generating inputs for [Karnaugh maps]() in order from left to right or top to bottom. +It is also useful for generating inputs for [Karnaugh maps](https://en.wikipedia.org/wiki/Karnaugh map) in order from left to right or top to bottom. # --instructions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/hash-join.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/hash-join.md index d2d5cabf4f..7dc6b729cb 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/hash-join.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/hash-join.md @@ -8,7 +8,7 @@ dashedName: hash-join # --description-- -An [inner join](https://en.wikipedia.org/wiki/Join_(SQL)#Inner_join "wp: Join\_(SQL)#Inner_join") is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the [nested loop join]( "wp: Nested loop join") algorithm, but a more scalable alternative is the [hash join]( "wp: hash join") algorithm. +An [inner join](https://en.wikipedia.org/wiki/Join_(SQL)#Inner_join "wp: Join\_(SQL)#Inner_join") is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the [nested loop join](https://en.wikipedia.org/wiki/Nested loop join "wp: Nested loop join") algorithm, but a more scalable alternative is the [hash join](https://en.wikipedia.org/wiki/hash join "wp: hash join") algorithm. The "hash join" algorithm consists of two steps: diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/heronian-triangles.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/heronian-triangles.md index 7cfd2e6caa..2162dc57eb 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/heronian-triangles.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/heronian-triangles.md @@ -8,7 +8,7 @@ dashedName: heronian-triangles # --description-- -[Hero's formula]( "wp: Heron's formula") for the area of a triangle given the length of its three sides `a`, `b`, and `c` is given by: +[Hero's formula](https://en.wikipedia.org/wiki/Heron's formula "wp: Heron's formula") for the area of a triangle given the length of its three sides `a`, `b`, and `c` is given by: $A = \\sqrt{s(s-a)(s-b)(s-c)},$ diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/hofstadter-q-sequence.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/hofstadter-q-sequence.md index 06d4fb69b2..c8ab7d438c 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/hofstadter-q-sequence.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/hofstadter-q-sequence.md @@ -12,7 +12,7 @@ The [Hofstadter Q sequence](https://en.wikipedia.org/wiki/Hofstadter_sequence#Ho $Q(1)=Q(2)=1, \\\\ Q(n)=Q\\big(n-Q(n-1)\\big)+Q\\big(n-Q(n-2)), \\quad n>2.$ -It is defined like the [Fibonacci sequence]( "Fibonacci sequence"), but whereas the next term in the Fibonacci sequence is the sum of the previous two terms, in the Q sequence the previous two terms tell you how far to go back in the Q sequence to find the two numbers to sum to make the next term of the sequence. +It is defined like the [Fibonacci sequence](https://rosettacode.org/wiki/Fibonacci sequence "Fibonacci sequence"), but whereas the next term in the Fibonacci sequence is the sum of the previous two terms, in the Q sequence the previous two terms tell you how far to go back in the Q sequence to find the two numbers to sum to make the next term of the sequence. # --instructions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/i-before-e-except-after-c.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/i-before-e-except-after-c.md index 9fd1d6f6f6..afac6dc512 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/i-before-e-except-after-c.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/i-before-e-except-after-c.md @@ -8,7 +8,7 @@ dashedName: i-before-e-except-after-c # --description-- -The phrase ["I before E, except after C"]() is a widely known mnemonic which is supposed to help when spelling English words. +The phrase ["I before E, except after C"](https://en.wikipedia.org/wiki/I before E except after C) is a widely known mnemonic which is supposed to help when spelling English words. Using the words provided, check if the two sub-clauses of the phrase are plausible individually: diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/josephus-problem.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/josephus-problem.md index 245b3ed352..6e8314e204 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/josephus-problem.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/josephus-problem.md @@ -8,7 +8,7 @@ dashedName: josephus-problem # --description-- -[Josephus problem]() is a math puzzle with a grim description: $n$ prisoners are standing on a circle, sequentially numbered from $0$ to $n-1$. +[Josephus problem](https://en.wikipedia.org/wiki/Josephus problem) is a math puzzle with a grim description: $n$ prisoners are standing on a circle, sequentially numbered from $0$ to $n-1$. An executioner walks along the circle, starting from prisoner $0$, removing every $k$-th prisoner and killing him. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/kaprekar-numbers.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/kaprekar-numbers.md index 59e368bc52..7b2530f4c6 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/kaprekar-numbers.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/kaprekar-numbers.md @@ -8,7 +8,7 @@ dashedName: kaprekar-numbers # --description-- -A positive integer is a [Kaprekar number]() if: +A positive integer is a [Kaprekar number](https://en.wikipedia.org/wiki/Kaprekar number) if:
      • It is 1, or,
      • diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/least-common-multiple.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/least-common-multiple.md index 403e448d2f..aa27446cbe 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/least-common-multiple.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/least-common-multiple.md @@ -8,7 +8,7 @@ dashedName: least-common-multiple # --description-- -The least common multiple of 12 and 18 is 36, because 12 is a factor (12 × 3 = 36), and 18 is a factor (18 × 2 = 36), and there is no positive integer less than 36 that has both factors. As a special case, if either *m* or *n* is zero, then the least common multiple is zero. One way to calculate the least common multiple is to iterate all the multiples of *m*, until you find one that is also a multiple of *n*. If you already have *gcd* for [greatest common divisor](), then this formula calculates *lcm*. ( \\operatorname{lcm}(m, n) = \\frac{|m \\times n|}{\\operatorname{gcd}(m, n)} ) +The least common multiple of 12 and 18 is 36, because 12 is a factor (12 × 3 = 36), and 18 is a factor (18 × 2 = 36), and there is no positive integer less than 36 that has both factors. As a special case, if either *m* or *n* is zero, then the least common multiple is zero. One way to calculate the least common multiple is to iterate all the multiples of *m*, until you find one that is also a multiple of *n*. If you already have *gcd* for [greatest common divisor](https://rosettacode.org/wiki/greatest common divisor), then this formula calculates *lcm*. ( \\operatorname{lcm}(m, n) = \\frac{|m \\times n|}{\\operatorname{gcd}(m, n)} ) # --instructions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/levenshtein-distance.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/levenshtein-distance.md index 104543d9d0..2737ad5436 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/levenshtein-distance.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/levenshtein-distance.md @@ -8,7 +8,7 @@ dashedName: levenshtein-distance # --description-- -In information theory and computer science, the **Levenshtein distance** is a [metric]() for measuring the amount of difference between two sequences (i.e. an [edit distance]()). The Levenshtein distance between two strings is defined as the minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character. +In information theory and computer science, the **Levenshtein distance** is a [metric](https://en.wikipedia.org/wiki/string metric) for measuring the amount of difference between two sequences (i.e. an [edit distance](https://en.wikipedia.org/wiki/edit distance)). The Levenshtein distance between two strings is defined as the minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character. Example: diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/linear-congruential-generator.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/linear-congruential-generator.md index 96bf1cf079..0448399ccb 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/linear-congruential-generator.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/linear-congruential-generator.md @@ -8,7 +8,7 @@ dashedName: linear-congruential-generator # --description-- -The [linear congruential generator]() is a very simple example of a [random number generator](). All linear congruential generators use this formula: +The [linear congruential generator](https://en.wikipedia.org/wiki/linear congruential generator) is a very simple example of a [random number generator](http://rosettacode.org/wiki/random number generator). All linear congruential generators use this formula: $$r_{n + 1} = (a \times r_n + c) \bmod m$$ @@ -22,7 +22,7 @@ Where: If one chooses the values of $a$, $c$ and $m$ with care, then the generator produces a uniform distribution of integers from $0$ to $m - 1$. -LCG numbers have poor quality. $r_n$ and $r\_{n + 1}$ are not independent, as true random numbers would be. Anyone who knows $r_n$ can predict $r\_{n + 1}$, therefore LCG is not cryptographically secure. The LCG is still good enough for simple tasks like [Miller-Rabin primality test](), or [FreeCell deals](). Among the benefits of the LCG, one can easily reproduce a sequence of numbers, from the same $r_0$. One can also reproduce such sequence with a different programming language, because the formula is so simple. +LCG numbers have poor quality. $r_n$ and $r\_{n + 1}$ are not independent, as true random numbers would be. Anyone who knows $r_n$ can predict $r\_{n + 1}$, therefore LCG is not cryptographically secure. The LCG is still good enough for simple tasks like [Miller-Rabin primality test](http://rosettacode.org/wiki/Miller-Rabin primality test), or [FreeCell deals](http://rosettacode.org/wiki/deal cards for FreeCell). Among the benefits of the LCG, one can easily reproduce a sequence of numbers, from the same $r_0$. One can also reproduce such sequence with a different programming language, because the formula is so simple. # --instructions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/long-multiplication.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/long-multiplication.md index 431f88eeb8..fb4e2456cf 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/long-multiplication.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/long-multiplication.md @@ -8,7 +8,7 @@ dashedName: long-multiplication # --description-- -Explicitly implement [long multiplication](). +Explicitly implement [long multiplication](https://en.wikipedia.org/wiki/long multiplication). This is one possible approach to arbitrary-precision integer algebra. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/longest-increasing-subsequence.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/longest-increasing-subsequence.md index 4de5521d55..0ba5661f6c 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/longest-increasing-subsequence.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/longest-increasing-subsequence.md @@ -18,7 +18,7 @@ Longest increasing sequence is: $\\{3, 10, 20\\}$ -For more information on this problem please see [Wikipedia](). +For more information on this problem please see [Wikipedia](https://en.wikipedia.org/wiki/Longest increasing subsequence). # --instructions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/look-and-say-sequence.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/look-and-say-sequence.md index 073e41920d..ed09269a09 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/look-and-say-sequence.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/look-and-say-sequence.md @@ -8,7 +8,7 @@ dashedName: look-and-say-sequence # --description-- -The [Look and say sequence]() is a recursively defined sequence of numbers. +The [Look and say sequence](https://en.wikipedia.org/wiki/Look and say sequence) is a recursively defined sequence of numbers. Sequence Definition diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/lu-decomposition.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/lu-decomposition.md index f7a900174e..1b2442f305 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/lu-decomposition.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/lu-decomposition.md @@ -8,13 +8,13 @@ dashedName: lu-decomposition # --description-- -Every square matrix $A$ can be decomposed into a product of a lower triangular matrix $L$ and a upper triangular matrix $U$, as described in [LU decomposition](). +Every square matrix $A$ can be decomposed into a product of a lower triangular matrix $L$ and a upper triangular matrix $U$, as described in [LU decomposition](https://en.wikipedia.org/wiki/LU decomposition). $A = LU$ It is a modified form of Gaussian elimination. -While the [Cholesky decomposition]() only works for symmetric, positive definite matrices, the more general LU decomposition works for any square matrix. +While the [Cholesky decomposition](http://rosettacode.org/wiki/Cholesky decomposition) only works for symmetric, positive definite matrices, the more general LU decomposition works for any square matrix. There are several algorithms for calculating $L$ and $U$. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/luhn-test-of-credit-card-numbers.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/luhn-test-of-credit-card-numbers.md index 0a44e1da79..4fcc90502a 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/luhn-test-of-credit-card-numbers.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/luhn-test-of-credit-card-numbers.md @@ -8,7 +8,7 @@ dashedName: luhn-test-of-credit-card-numbers # --description-- -The [Luhn test]() is used by some credit card companies to distinguish valid credit card numbers from what could be a random selection of digits. +The [Luhn test](https://en.wikipedia.org/wiki/Luhn algorithm) is used by some credit card companies to distinguish valid credit card numbers from what could be a random selection of digits. Those companies using credit card numbers that can be validated by the Luhn test have numbers that pass the following test: diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/self-describing-numbers.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/self-describing-numbers.md index 5ff2f5c992..df2a88508f 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/self-describing-numbers.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/self-describing-numbers.md @@ -89,7 +89,7 @@ function isSelfDescribing(n) { if (digits.length != count.length) { return false; } - + for (let i=0; i< digits.length; i++){ if (digits[i] !== count[i]) { return false; diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/self-referential-sequence.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/self-referential-sequence.md index 0cc45a42ff..11beda8ba0 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/self-referential-sequence.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/self-referential-sequence.md @@ -8,7 +8,7 @@ dashedName: self-referential-sequence # --description-- -There are several ways to generate a self-referential sequence. One very common one (the [Look-and-say sequence]()) is to start with a positive integer, then generate the next term by concatenating enumerated groups of adjacent alike digits: +There are several ways to generate a self-referential sequence. One very common one (the [Look-and-say sequence](https://rosettacode.org/wiki/Look-and-say sequence)) is to start with a positive integer, then generate the next term by concatenating enumerated groups of adjacent alike digits:
        0, 10, 1110, 3110, 132110, 1113122110, 311311222110 ...
        diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sha-256.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sha-256.md index ba3af1f527..9ce0ca4260 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sha-256.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sha-256.md @@ -8,8 +8,7 @@ dashedName: sha-256 # --description-- -The `SHA-2` family is a stronger alternative to `SHA-1`. The main difference between them is the length of the hash. -Meaning `SHA-1` provides a shorter code with fewer possibilities for unique combinations. `SHA-2` or `SHA-256` creates a longer and thus more complex hash with more possibilities. +The `SHA-2` family is a stronger alternative to `SHA-1`. The main difference between them is the length of the hash. Meaning `SHA-1` provides a shorter code with fewer possibilities for unique combinations. `SHA-2` or `SHA-256` creates a longer and thus more complex hash with more possibilities. # --instructions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md index 86aeeda4c8..f4c1b63f68 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md @@ -8,7 +8,7 @@ dashedName: sorting-algorithmscocktail-sort # --description-- -The cocktail shaker sort is an improvement on the [Bubble Sort](). The improvement is basically that values "bubble" both directions through the array, because on each iteration the cocktail shaker sort bubble sorts once forwards and once backwards. Pseudocode for the algorithm (from [wikipedia]()): +The cocktail shaker sort is an improvement on the [Bubble Sort](https://rosettacode.org/wiki/Bubble Sort). The improvement is basically that values "bubble" both directions through the array, because on each iteration the cocktail shaker sort bubble sorts once forwards and once backwards. Pseudocode for the algorithm (from [wikipedia](https://en.wikipedia.org/wiki/Cocktail sort)):
        function cocktailSort( A : list of sortable items )
           do
        diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-comb-sort.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-comb-sort.md
        index 2b31fb98db..472ce20af5 100644
        --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-comb-sort.md
        +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-comb-sort.md
        @@ -10,9 +10,9 @@ dashedName: sorting-algorithmscomb-sort
         
         Implement a *comb sort*.
         
        -The **Comb Sort** is a variant of the [Bubble Sort]().
        +The **Comb Sort** is a variant of the [Bubble Sort](https://rosettacode.org/wiki/Bubble Sort).
         
        -Like the [Shell sort](), the Comb Sort increases the gap used in comparisons and exchanges.
        +Like the [Shell sort](https://rosettacode.org/wiki/Shell sort), the Comb Sort increases the gap used in comparisons and exchanges.
         
         Dividing the gap by $(1-e^{-\\varphi})^{-1} \\approx 1.247330950103979$ works best, but 1.3 may be more practical.
         
        diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md
        index 4aebdd0fe8..e3162404d9 100644
        --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md
        +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md
        @@ -8,7 +8,7 @@ dashedName: sorting-algorithmsgnome-sort
         
         # --description--
         
        -Gnome sort is a sorting algorithm which is similar to [Insertion sort](), except that moving an element to its proper place is accomplished by a series of swaps, as in [Bubble Sort]().
        +Gnome sort is a sorting algorithm which is similar to [Insertion sort](https://rosettacode.org/wiki/Insertion sort), except that moving an element to its proper place is accomplished by a series of swaps, as in [Bubble Sort](https://rosettacode.org/wiki/Bubble Sort).
         
         The pseudocode for the algorithm is:
         
        diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md
        index 1a4a28928c..f107df7b79 100644
        --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md
        +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md
        @@ -8,7 +8,7 @@ dashedName: sorting-algorithmspancake-sort
         
         # --description--
         
        -Write a function to sort an array of integers (of any convenient size) into ascending order using [Pancake sorting](). The function should return the sorted array.
        +Write a function to sort an array of integers (of any convenient size) into ascending order using [Pancake sorting](https://en.wikipedia.org/wiki/Pancake sorting). The function should return the sorted array.
         
         In short, instead of individual elements being sorted, the only operation allowed is to "flip" one end of the list, like so:
         
        diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md
        index 3d69051f4d..0940344732 100644
        --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md
        +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md
        @@ -8,7 +8,7 @@ dashedName: sorting-algorithmsshell-sort
         
         # --description--
         
        -Write a function to sort an array of elements using the [Shell sort]() algorithm, a diminishing increment sort. The function should return the sorted array.
        +Write a function to sort an array of elements using the [Shell sort](https://en.wikipedia.org/wiki/Shell sort) algorithm, a diminishing increment sort. The function should return the sorted array.
         
         The Shell sort (also known as Shellsort or Shell's method) is named after its inventor, Donald Shell, who published the algorithm in 1959.
         
        diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md
        index 04dee734ea..ec108886c1 100644
        --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md
        +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md
        @@ -8,7 +8,7 @@ dashedName: sorting-algorithmsstooge-sort
         
         # --description--
         
        -Write a function to perform [Stooge Sort]() on an array of integers. The function should return a sorted array.
        +Write a function to perform [Stooge Sort](https://en.wikipedia.org/wiki/Stooge sort) on an array of integers. The function should return a sorted array.
         
         The Stooge Sort algorithm is as follows:
         
        diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md
        index a603bbab95..d8408782db 100644
        --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md
        +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md
        @@ -8,7 +8,7 @@ dashedName: sorting-algorithmsstrand-sort
         
         # --description--
         
        -Write a function to sort an array using the [Strand sort](). The function should return the sorted array.
        +Write a function to sort an array using the [Strand sort](https://en.wikipedia.org/wiki/Strand sort). The function should return the sorted array.
         
         This is a way of sorting numbers by extracting shorter sequences of already sorted numbers from an unsorted list.
         
        diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md
        index 219db4002c..5558082298 100644
        --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md
        +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md
        @@ -8,7 +8,7 @@ dashedName: stern-brocot-sequence
         
         # --description--
         
        -For this task, the Stern-Brocot sequence is to be generated by an algorithm similar to that employed in generating the [Fibonacci sequence]().
        +For this task, the Stern-Brocot sequence is to be generated by an algorithm similar to that employed in generating the [Fibonacci sequence](https://rosettacode.org/wiki/Fibonacci sequence).
         
         
        1. The first and second members of the sequence are both 1:
        2. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sum-of-a-series.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sum-of-a-series.md index 3e7e0b4e4f..6ffa6d152f 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sum-of-a-series.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sum-of-a-series.md @@ -8,7 +8,7 @@ dashedName: sum-of-a-series # --description-- -Compute the **n**th term of a [series](), i.e. the sum of the **n** first terms of the corresponding [sequence](https://en.wikipedia.org/wiki/sequence). Informally this value, or its limit when **n** tends to infinity, is also called the *sum of the series*, thus the title of this task. For this task, use: $S_n = \displaystyle\sum_{k=1}^n \frac{1}{k^2}$. +Compute the **n**th term of a [series](https://en.wikipedia.org/wiki/Series (mathematics)), i.e. the sum of the **n** first terms of the corresponding [sequence](https://en.wikipedia.org/wiki/sequence). Informally this value, or its limit when **n** tends to infinity, is also called the *sum of the series*, thus the title of this task. For this task, use: $S_n = \displaystyle\sum_{k=1}^n \frac{1}{k^2}$. # --instructions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sutherland-hodgman-polygon-clipping.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sutherland-hodgman-polygon-clipping.md index c3b671bf5a..50fe64ed63 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sutherland-hodgman-polygon-clipping.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/sutherland-hodgman-polygon-clipping.md @@ -8,7 +8,7 @@ dashedName: sutherland-hodgman-polygon-clipping # --description-- -The [Sutherland-Hodgman clipping algorithm]() finds the polygon that is the intersection between an arbitrary polygon (the "subject polygon") and a convex polygon (the "clip polygon"). It is used in computer graphics (especially 2D graphics) to reduce the complexity of a scene being displayed by eliminating parts of a polygon that do not need to be displayed. Take the closed polygon defined by the points: +The [Sutherland-Hodgman clipping algorithm](https://en.wikipedia.org/wiki/Sutherland-Hodgman clipping algorithm) finds the polygon that is the intersection between an arbitrary polygon (the "subject polygon") and a convex polygon (the "clip polygon"). It is used in computer graphics (especially 2D graphics) to reduce the complexity of a scene being displayed by eliminating parts of a polygon that do not need to be displayed. Take the closed polygon defined by the points:
          [(50, 150), (200, 50), (350, 150), (350, 300), (250, 300), (200, 250), (150, 350), (100, 250), (100, 200)]
          diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/symmetric-difference.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/symmetric-difference.md index 422cb77cc2..7009bce461 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/symmetric-difference.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/symmetric-difference.md @@ -8,7 +8,7 @@ dashedName: symmetric-difference # --description-- -Given two [set](https://rosettacode.org/wiki/set)s *A* and *B*, compute $(A \\setminus B) \\cup (B \\setminus A).$ That is, enumerate the items that are in *A* or *B* but not both. This set is called the [symmetric difference]() of *A* and *B*. In other words: $(A \\cup B) \\setminus (A \\cap B)$ (the set of items that are in at least one of *A* or *B* minus the set of items that are in both *A* and *B*). +Given two [set](https://rosettacode.org/wiki/set)s *A* and *B*, compute $(A \\setminus B) \\cup (B \\setminus A).$ That is, enumerate the items that are in *A* or *B* but not both. This set is called the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric difference) of *A* and *B*. In other words: $(A \\cup B) \\setminus (A \\cap B)$ (the set of items that are in at least one of *A* or *B* minus the set of items that are in both *A* and *B*). # --instructions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/taxicab-numbers.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/taxicab-numbers.md index 54a2aa0e7f..895b46ef05 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/taxicab-numbers.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/taxicab-numbers.md @@ -8,7 +8,7 @@ dashedName: taxicab-numbers # --description-- -A [taxicab number]( "wp: Hardy–Ramanujan number") (the definition that is being used here) is a positive integer that can be expressed as the sum of two positive cubes in more than one way. +A [taxicab number](https://en.wikipedia.org/wiki/Hardy–Ramanujan number "wp: Hardy–Ramanujan number") (the definition that is being used here) is a positive integer that can be expressed as the sum of two positive cubes in more than one way. The first taxicab number is `1729`, which is: diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/y-combinator.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/y-combinator.md index 690e647586..f76ab91e3c 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/y-combinator.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/y-combinator.md @@ -8,7 +8,7 @@ dashedName: y-combinator # --description-- -In strict [functional programming]( "wp: functional programming") and the [lambda calculus]( "wp: lambda calculus"), functions (lambda expressions) don't have state and are only allowed to refer to arguments of enclosing functions. This rules out the usual definition of a recursive function wherein a function is associated with the state of a variable and this variable's state is used in the body of the function. The [Y combinator](https://mvanier.livejournal.com/2897.html) is itself a stateless function that, when applied to another stateless function, returns a recursive version of the function. The Y combinator is the simplest of the class of such functions, called [fixed-point combinators]( "wp: fixed-point combinator"). +In strict [functional programming](https://en.wikipedia.org/wiki/Functional programming "wp: functional programming") and the [lambda calculus](https://en.wikipedia.org/wiki/lambda calculus "wp: lambda calculus"), functions (lambda expressions) don't have state and are only allowed to refer to arguments of enclosing functions. This rules out the usual definition of a recursive function wherein a function is associated with the state of a variable and this variable's state is used in the body of the function. The [Y combinator](https://mvanier.livejournal.com/2897.html) is itself a stateless function that, when applied to another stateless function, returns a recursive version of the function. The Y combinator is the simplest of the class of such functions, called [fixed-point combinators](https://en.wikipedia.org/wiki/Fixed-point combinator "wp: fixed-point combinator"). # --instructions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md index 64d4e8b5d4..d3970f2f72 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md @@ -10,77 +10,56 @@ dashedName: zhang-suen-thinning-algorithm This is an algorithm used to thin a black and white i.e. one bit per pixel images. For example, with an input image of: - - -
          - #################                   #############
          - ##################               ################
          - ###################            ##################
          - ########     #######          ###################
          -   ######     #######         #######       ######
          -   ######     #######        #######
          -   #################         #######
          -   ################          #######
          -   #################         #######
          -   ######     #######        #######
          -   ######     #######        #######
          -   ######     #######         #######       ######
          - ########     #######          ###################
          - ########     ####### ######    ################## ######
          - ########     ####### ######      ################ ######
          - ########     ####### ######         ############# ######
          -
          +```js +const testImage1 = [ + ' ', + '######### ######## ', + '### #### #### #### ', + '### ### ### ### ', + '### #### ### ', + '######### ### ', + '### #### ### ### ', + '### #### ### #### #### ### ', + '### #### ### ######## ### ', + ' ' +]; +``` It produces the thinned output: -
          +```js
          +[ '                               ',
          +  '########         ######        ',
          +  '#      #        ##             ',
          +  '#       #       #              ',
          +  '#      #        #              ',
          +  '###### #        #              ',
          +  '#     ##        #              ',
          +  '#      #    #   ##    ##   #   ',
          +  '#       #         ####         ',
          +  '                               ' ];
          +```
           
          -    # ##########                       #######
          -     ##        #                   ####       #
          -     #          #                 ##
          -     #          #                #
          -     #          #                #
          -     #          #                #
          -     ############               #
          -     #          #               #
          -     #          #                #
          -     #          #                #
          -     #          #                #
          -     #                            ##
          -     #                             ############
          -                       ###                          ###
          -
          -
          - -

          Algorithm

          +## Algorithm Assume black pixels are one and white pixels zero, and that the input image is a rectangular N by M array of ones and zeroes. The algorithm operates on all black pixels P1 that can have eight neighbours. The neighbours are, in order, arranged as: - - - - -
          P9P2P3
          P8P1P4
          P7P6P5
          +$$\begin{array}{|c|c|c|} \\hline P9 & P2 & P3\\\\ \\hline P8 & \boldsymbol{P1} & P4\\\\ \\hline P7 & P6 & P5\\\\ \\hline \end{array}$$ Obviously the boundary pixels of the image cannot have the full eight neighbours. -
            -
          • Define $A(P1)$ = the number of transitions from white to black, (0 -> 1) in the sequence P2, P3, P4, P5, P6, P7, P8, P9, P2. (Note the extra P2 at the end - it is circular).
          • -
          • Define $B(P1)$ = the number of black pixel neighbours of P1. ( = sum(P2 .. P9) )
          • -
          +- Define $A(P1)$ = the number of transitions from white to black, ($0 \to 1$) in the sequence P2, P3, P4, P5, P6, P7, P8, P9, P2. (Note the extra P2 at the end - it is circular). +- Define $B(P1)$ = the number of black pixel neighbours of P1. ($= \\sum(P2 \ldots P9)$) **Step 1:** All pixels are tested and pixels satisfying all the following conditions (simultaneously) are just noted at this stage. -
            -
          1. The pixel is black and has eight neighbours
          2. -
          3. $2 <= B(P1) <= 6$
          4. -
          5. $A(P1) = 1$
          6. -
          7. At least one of P2, P4 and P6 is white
          8. -
          9. At least one of P4, P6 and P8 is white
          10. -
          +1. The pixel is black and has eight neighbours +2. $2 \le B(P1) \le 6$ +3. $A(P1) = 1$ +4. At least one of $P2$, $P4$ and $P6$ is white +5. At least one of $P4$, $P6$ and $P8$ is white After iterating over the image and collecting all the pixels satisfying all step 1 conditions, all these condition satisfying pixels are set to white. @@ -88,14 +67,12 @@ After iterating over the image and collecting all the pixels satisfying all step All pixels are again tested and pixels satisfying all the following conditions are just noted at this stage. -
            -
          1. The pixel is black and has eight neighbours
          2. -
          3. $2 <= B(P1) <= 6$
          4. -
          5. $A(P1) = 1$
          6. -
          7. At least one of P2, P4 and P8 is white
          8. -
          9. At least one of P2, P6 and P8 is white
          10. -
          - +1. The pixel is black and has eight neighbours +2. $2 \le B(P1) \le 6$ +3. $A(P1) = 1$ +4. At least one of $P2$, $P4$ and $P8$ is white +5. At least one of $P2$, $P6$ and $P8$ is white + After iterating over the image and collecting all the pixels satisfying all step 2 conditions, all these condition satisfying pixels are again set to white. **Iteration:** @@ -104,7 +81,7 @@ If any pixels were set in this round of either step 1 or step 2 then all steps a # --instructions-- -Write a routine to perform Zhang-Suen thinning on the provided image matrix. +Write a routine to perform Zhang-Suen thinning on the provided `image`, an array of strings, where each string represents single line of the image. In the string, `#` represents black pixel, and whitespace represents white pixel. Function should return thinned image, using the same representation. # --hints-- @@ -117,19 +94,25 @@ assert.equal(typeof thinImage, 'function'); `thinImage` should return an array. ```js -assert(Array.isArray(result)); +assert(Array.isArray(thinImage(_testImage1))); ``` `thinImage` should return an array of strings. ```js -assert.equal(typeof result[0], 'string'); +assert.equal(typeof thinImage(_testImage1)[0], 'string'); ``` -`thinImage` should return an array of strings. +`thinImage(testImage1)` should return a thinned image as in the example. ```js -assert.deepEqual(result, expected); +assert.deepEqual(thinImage(_testImage1), expected1); +``` + +`thinImage(testImage2)` should return a thinned image. + +```js +assert.deepEqual(thinImage(_testImage2), expected2); ``` # --seed-- @@ -137,7 +120,31 @@ assert.deepEqual(result, expected); ## --after-user-code-- ```js -const imageForTests = [ +const _testImage1 = [ + ' ', + '######### ######## ', + '### #### #### #### ', + '### ### ### ### ', + '### #### ### ', + '######### ### ', + '### #### ### ### ', + '### #### ### #### #### ### ', + '### #### ### ######## ### ', + ' ' +]; +const expected1 = [ + ' ', + '######## ###### ', + '# # ## ', + '# # # ', + '# # # ', + '###### # # ', + '# ## # ', + '# # # ## ## # ', + '# # #### ', + ' ' +]; +const _testImage2 = [ ' ', ' ################# ############# ', ' ################## ################ ', @@ -156,7 +163,7 @@ const imageForTests = [ ' ######## ####### ###### ################ ###### ', ' ######## ####### ###### ############# ###### ', ' ']; -const expected = [ +const expected2 = [ ' ', ' ', ' # ########## ####### ', @@ -176,35 +183,27 @@ const expected = [ ' ', ' ' ]; -const result = thinImage(imageForTests); ``` ## --seed-contents-- ```js -const testImage = [ - ' ', - ' ################# ############# ', - ' ################## ################ ', - ' ################### ################## ', - ' ######## ####### ################### ', - ' ###### ####### ####### ###### ', - ' ###### ####### ####### ', - ' ################# ####### ', - ' ################ ####### ', - ' ################# ####### ', - ' ###### ####### ####### ', - ' ###### ####### ####### ', - ' ###### ####### ####### ###### ', - ' ######## ####### ################### ', - ' ######## ####### ###### ################## ###### ', - ' ######## ####### ###### ################ ###### ', - ' ######## ####### ###### ############# ###### ', - ' ']; - function thinImage(image) { } + +const testImage1 = [ + ' ', + '######### ######## ', + '### #### #### #### ', + '### ### ### ### ', + '### #### ### ', + '######### ### ', + '### #### ### ### ', + '### #### ### #### #### ### ', + '### #### ### ######## ### ', + ' ' +]; ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/take-home-projects/build-a-simon-game.md b/curriculum/challenges/portuguese/10-coding-interview-prep/take-home-projects/build-a-simon-game.md index 9de29f1566..5bc458abb1 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/take-home-projects/build-a-simon-game.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/take-home-projects/build-a-simon-game.md @@ -8,7 +8,7 @@ dashedName: build-a-simon-game # --description-- -**Objective:** Build a [CodePen.io](https://codepen.io) app that is functionally similar to this: [https://codepen.io/freeCodeCamp/full/obYBjE](https://codepen.io/Em-Ant/full/QbRyqq/). +**Objective:** Build a [CodePen.io](https://codepen.io) app that is functionally similar to this: [https://codepen.io/freeCodeCamp/full/obYBjE](https://codepen.io/freeCodeCamp/full/obYBjE). Fulfill the below [user stories](https://en.wikipedia.org/wiki/User_story). Use whichever libraries or APIs you need. Give it your own personal style. diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/take-home-projects/build-the-game-of-life.md b/curriculum/challenges/portuguese/10-coding-interview-prep/take-home-projects/build-the-game-of-life.md index 10998f981d..498b2a027a 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/take-home-projects/build-the-game-of-life.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/take-home-projects/build-the-game-of-life.md @@ -26,7 +26,7 @@ Fulfill the below [user stories](https://en.wikipedia.org/wiki/User_story). Use **Hint:** Here's an explanation of Conway's Game of Life from John Conway himself: -**Hint:** Here's an overview of Conway's Game of Life with rules for your reference: +**Hint:** Here's an overview of Conway's Game of Life with rules for your reference: [https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) When you are finished, include a link to your project on CodePen and click the "I've completed this challenge" button. diff --git a/curriculum/challenges/portuguese/12-certificates/apis-and-microservices-certificate/apis-and-microservices-certificate.yml b/curriculum/challenges/portuguese/12-certificates/apis-and-microservices-certificate/apis-and-microservices-certificate.yml index ab4cdbb46e..b691e98afa 100644 --- a/curriculum/challenges/portuguese/12-certificates/apis-and-microservices-certificate/apis-and-microservices-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/apis-and-microservices-certificate/apis-and-microservices-certificate.yml @@ -1,15 +1,21 @@ +--- id: 561add10cb82ac38a17523bc title: APIs and Microservices Certificate challengeType: 7 isPrivate: true tests: - - id: bd7158d8c443edefaeb5bdef + - + id: bd7158d8c443edefaeb5bdef title: Timestamp Microservice - - id: bd7158d8c443edefaeb5bdff + - + id: bd7158d8c443edefaeb5bdff title: Request Header Parser Microservice - - id: bd7158d8c443edefaeb5bd0e + - + id: bd7158d8c443edefaeb5bd0e title: URL Shortener Microservice - - id: 5a8b073d06fa14fcfde687aa + - + id: 5a8b073d06fa14fcfde687aa title: Exercise Tracker - - id: bd7158d8c443edefaeb5bd0f + - + id: bd7158d8c443edefaeb5bd0f title: File Metadata Microservice diff --git a/curriculum/challenges/portuguese/12-certificates/data-analysis-with-python-certificate/data-analysis-with-python-certificate.yml b/curriculum/challenges/portuguese/12-certificates/data-analysis-with-python-certificate/data-analysis-with-python-certificate.yml index 43f9a87fce..238899200c 100644 --- a/curriculum/challenges/portuguese/12-certificates/data-analysis-with-python-certificate/data-analysis-with-python-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/data-analysis-with-python-certificate/data-analysis-with-python-certificate.yml @@ -1,16 +1,22 @@ +--- id: 5e46fc95ac417301a38fb934 title: Data Analysis with Python Certificate challengeType: 7 isPrivate: true tests: - - id: 5e46f7e5ac417301a38fb928 + - + id: 5e46f7e5ac417301a38fb928 title: Mean-Variance-Standard Deviation Calculator - - id: 5e46f7e5ac417301a38fb929 + - + id: 5e46f7e5ac417301a38fb929 title: Demographic Data Analyzer - - id: 5e46f7f8ac417301a38fb92a + - + id: 5e46f7f8ac417301a38fb92a title: Medical Data Visualizer - - id: 5e46f802ac417301a38fb92b + - + id: 5e46f802ac417301a38fb92b title: Page View Time Series Visualizer - - id: 5e4f5c4b570f7e3a4949899f + - + id: 5e4f5c4b570f7e3a4949899f title: Sea Level Predictor diff --git a/curriculum/challenges/portuguese/12-certificates/data-visualization-certificate/data-visualization-certificate.yml b/curriculum/challenges/portuguese/12-certificates/data-visualization-certificate/data-visualization-certificate.yml index 800f59f079..589eebe67f 100644 --- a/curriculum/challenges/portuguese/12-certificates/data-visualization-certificate/data-visualization-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/data-visualization-certificate/data-visualization-certificate.yml @@ -1,15 +1,21 @@ +--- id: 5a553ca864b52e1d8bceea14 title: Data Visualization Certificate challengeType: 7 isPrivate: true tests: - - id: bd7168d8c242eddfaeb5bd13 + - + id: bd7168d8c242eddfaeb5bd13 title: Visualize Data with a Bar Chart - - id: bd7178d8c242eddfaeb5bd13 + - + id: bd7178d8c242eddfaeb5bd13 title: Visualize Data with a Scatterplot Graph - - id: bd7188d8c242eddfaeb5bd13 + - + id: bd7188d8c242eddfaeb5bd13 title: Visualize Data with a Heat Map - - id: 587d7fa6367417b2b2512bbf + - + id: 587d7fa6367417b2b2512bbf title: Visualize Data with a Choropleth Map - - id: 587d7fa6367417b2b2512bc0 + - + id: 587d7fa6367417b2b2512bc0 title: Visualize Data with a Treemap Diagram diff --git a/curriculum/challenges/portuguese/12-certificates/front-end-libraries-certificate/front-end-libraries-certificate.yml b/curriculum/challenges/portuguese/12-certificates/front-end-libraries-certificate/front-end-libraries-certificate.yml index e46cb47106..1f0a8f2689 100644 --- a/curriculum/challenges/portuguese/12-certificates/front-end-libraries-certificate/front-end-libraries-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/front-end-libraries-certificate/front-end-libraries-certificate.yml @@ -1,15 +1,21 @@ +--- id: 561acd10cb82ac38a17513bc title: Front End Libraries Certificate challengeType: 7 isPrivate: true tests: - - id: bd7158d8c442eddfaeb5bd13 + - + id: bd7158d8c442eddfaeb5bd13 title: Build a Random Quote Machine - - id: bd7157d8c242eddfaeb5bd13 + - + id: bd7157d8c242eddfaeb5bd13 title: Build a Markdown Previewer - - id: 587d7dbc367417b2b2512bae + - + id: 587d7dbc367417b2b2512bae title: Build a Drum Machine - - id: bd7158d8c442eddfaeb5bd17 + - + id: bd7158d8c442eddfaeb5bd17 title: Build a JavaScript Calculator - - id: bd7158d8c442eddfaeb5bd0f + - + id: bd7158d8c442eddfaeb5bd0f title: Build a 25 + 5 Clock diff --git a/curriculum/challenges/portuguese/12-certificates/information-security-certificate/information-security-certificate.yml b/curriculum/challenges/portuguese/12-certificates/information-security-certificate/information-security-certificate.yml index e2e589dac5..a6339cfb86 100644 --- a/curriculum/challenges/portuguese/12-certificates/information-security-certificate/information-security-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/information-security-certificate/information-security-certificate.yml @@ -1,15 +1,21 @@ +--- id: 5e6021435ac9d0ecd8b94b00 title: Information Security Certificate challengeType: 7 isPrivate: true tests: - - id: 587d824a367417b2b2512c44 + - + id: 587d824a367417b2b2512c44 title: Stock Price Checker - - id: 587d824a367417b2b2512c45 + - + id: 587d824a367417b2b2512c45 title: Anonymous Message Board - - id: 5e46f979ac417301a38fb932 + - + id: 5e46f979ac417301a38fb932 title: Port Scanner - - id: 5e46f983ac417301a38fb933 + - + id: 5e46f983ac417301a38fb933 title: SHA-1 Password Cracker - - id: 5e601c775ac9d0ecd8b94aff + - + id: 5e601c775ac9d0ecd8b94aff title: Secure Real Time Multiplayer Game diff --git a/curriculum/challenges/portuguese/12-certificates/javascript-algorithms-and-data-structures-certificate/javascript-algorithms-and-data-structures-certificate.yml b/curriculum/challenges/portuguese/12-certificates/javascript-algorithms-and-data-structures-certificate/javascript-algorithms-and-data-structures-certificate.yml index ae8984cbb1..aebebf678c 100644 --- a/curriculum/challenges/portuguese/12-certificates/javascript-algorithms-and-data-structures-certificate/javascript-algorithms-and-data-structures-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/javascript-algorithms-and-data-structures-certificate/javascript-algorithms-and-data-structures-certificate.yml @@ -1,15 +1,21 @@ +--- id: 561abd10cb81ac38a17513bc title: JavaScript Algorithms and Data Structures Certificate challengeType: 7 isPrivate: true tests: - - id: aaa48de84e1ecc7c742e1124 + - + id: aaa48de84e1ecc7c742e1124 title: Palindrome Checker - - id: a7f4d8f2483413a6ce226cac + - + id: a7f4d8f2483413a6ce226cac title: Roman Numeral Converter - - id: 56533eb9ac21ba0edf2244e2 + - + id: 56533eb9ac21ba0edf2244e2 title: Caesars Cipher - - id: aff0395860f5d3034dc0bfc9 + - + id: aff0395860f5d3034dc0bfc9 title: Telephone Number Validator - - id: aa2e6f85cab2ab736c9a9b24 + - + id: aa2e6f85cab2ab736c9a9b24 title: Cash Register diff --git a/curriculum/challenges/portuguese/12-certificates/legacy-back-end-certificate/legacy-back-end-certificate.yml b/curriculum/challenges/portuguese/12-certificates/legacy-back-end-certificate/legacy-back-end-certificate.yml index 30bbc54567..d48ecd7921 100644 --- a/curriculum/challenges/portuguese/12-certificates/legacy-back-end-certificate/legacy-back-end-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/legacy-back-end-certificate/legacy-back-end-certificate.yml @@ -1,25 +1,36 @@ +--- id: 660add10cb82ac38a17513be title: Legacy Back End Certificate challengeType: 7 isPrivate: true tests: - - id: bd7158d8c443edefaeb5bdef + - + id: bd7158d8c443edefaeb5bdef title: Timestamp Microservice - - id: bd7158d8c443edefaeb5bdff + - + id: bd7158d8c443edefaeb5bdff title: Request Header Parser Microservice - - id: bd7158d8c443edefaeb5bd0e + - + id: bd7158d8c443edefaeb5bd0e title: URL Shortener Microservice - - id: bd7158d8c443edefaeb5bdee + - + id: bd7158d8c443edefaeb5bdee title: Image Search Abstraction Layer - - id: bd7158d8c443edefaeb5bd0f + - + id: bd7158d8c443edefaeb5bd0f title: File Metadata Microservice - - id: bd7158d8c443eddfaeb5bdef + - + id: bd7158d8c443eddfaeb5bdef title: Build a Voting App - - id: bd7158d8c443eddfaeb5bdff + - + id: bd7158d8c443eddfaeb5bdff title: Build a Nightlife Coordination App - - id: bd7158d8c443eddfaeb5bd0e + - + id: bd7158d8c443eddfaeb5bd0e title: Chart the Stock Market - - id: bd7158d8c443eddfaeb5bd0f + - + id: bd7158d8c443eddfaeb5bd0f title: Manage a Book Trading Club - - id: bd7158d8c443eddfaeb5bdee + - + id: bd7158d8c443eddfaeb5bdee title: Build a Pinterest Clone diff --git a/curriculum/challenges/portuguese/12-certificates/legacy-data-visualization-certificate/legacy-data-visualization-certificate.yml b/curriculum/challenges/portuguese/12-certificates/legacy-data-visualization-certificate/legacy-data-visualization-certificate.yml index 47878fc563..1508cf30d8 100644 --- a/curriculum/challenges/portuguese/12-certificates/legacy-data-visualization-certificate/legacy-data-visualization-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/legacy-data-visualization-certificate/legacy-data-visualization-certificate.yml @@ -1,25 +1,36 @@ +--- id: 561add10cb82ac39a17513bc title: Legacy Data Visualization Certificate challengeType: 7 isPrivate: true tests: - - id: bd7157d8c242eddfaeb5bd13 + - + id: bd7157d8c242eddfaeb5bd13 title: Build a Markdown Previewer - - id: bd7156d8c242eddfaeb5bd13 + - + id: bd7156d8c242eddfaeb5bd13 title: Build a Camper Leaderboard - - id: bd7155d8c242eddfaeb5bd13 + - + id: bd7155d8c242eddfaeb5bd13 title: Build a Recipe Box - - id: bd7154d8c242eddfaeb5bd13 + - + id: bd7154d8c242eddfaeb5bd13 title: Build the Game of Life - - id: bd7153d8c242eddfaeb5bd13 + - + id: bd7153d8c242eddfaeb5bd13 title: Build a Roguelike Dungeon Crawler Game - - id: bd7168d8c242eddfaeb5bd13 + - + id: bd7168d8c242eddfaeb5bd13 title: Visualize Data with a Bar Chart - - id: bd7178d8c242eddfaeb5bd13 + - + id: bd7178d8c242eddfaeb5bd13 title: Visualize Data with a Scatterplot Graph - - id: bd7188d8c242eddfaeb5bd13 + - + id: bd7188d8c242eddfaeb5bd13 title: Visualize Data with a Heat Map - - id: bd7198d8c242eddfaeb5bd13 + - + id: bd7198d8c242eddfaeb5bd13 title: Show National Contiguity with a Force Directed Graph - - id: bd7108d8c242eddfaeb5bd13 + - + id: bd7108d8c242eddfaeb5bd13 title: Map Data Across the Globe diff --git a/curriculum/challenges/portuguese/12-certificates/legacy-front-end-certificate/legacy-front-end-certificate.yml b/curriculum/challenges/portuguese/12-certificates/legacy-front-end-certificate/legacy-front-end-certificate.yml index 22c46cdfcc..93d72c9b7f 100644 --- a/curriculum/challenges/portuguese/12-certificates/legacy-front-end-certificate/legacy-front-end-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/legacy-front-end-certificate/legacy-front-end-certificate.yml @@ -1,25 +1,36 @@ +--- id: 561add10cb82ac38a17513be title: Legacy Front End Certificate challengeType: 7 isPrivate: true tests: - - id: bd7158d8c242eddfaeb5bd13 + - + id: bd7158d8c242eddfaeb5bd13 title: Build a Personal Portfolio Webpage - - id: bd7158d8c442eddfaeb5bd13 + - + id: bd7158d8c442eddfaeb5bd13 title: Build a Random Quote Machine - - id: bd7158d8c442eddfaeb5bd0f + - + id: bd7158d8c442eddfaeb5bd0f title: Build a 25 + 5 Clock - - id: bd7158d8c442eddfaeb5bd17 + - + id: bd7158d8c442eddfaeb5bd17 title: Build a JavaScript Calculator - - id: bd7158d8c442eddfaeb5bd10 + - + id: bd7158d8c442eddfaeb5bd10 title: Show the Local Weather - - id: bd7158d8c442eddfaeb5bd1f + - + id: bd7158d8c442eddfaeb5bd1f title: Use the Twitch JSON API - - id: bd7158d8c442eddfaeb5bd18 + - + id: bd7158d8c442eddfaeb5bd18 title: Stylize Stories on Camper News - - id: bd7158d8c442eddfaeb5bd19 + - + id: bd7158d8c442eddfaeb5bd19 title: Build a Wikipedia Viewer - - id: bd7158d8c442eedfaeb5bd1c + - + id: bd7158d8c442eedfaeb5bd1c title: Build a Tic Tac Toe Game - - id: bd7158d8c442eddfaeb5bd1c + - + id: bd7158d8c442eddfaeb5bd1c title: Build a Simon Game diff --git a/curriculum/challenges/portuguese/12-certificates/legacy-full-stack-certificate/legacy-full-stack-certificate.yml b/curriculum/challenges/portuguese/12-certificates/legacy-full-stack-certificate/legacy-full-stack-certificate.yml index 0864f87cd0..97e2fcfc9d 100644 --- a/curriculum/challenges/portuguese/12-certificates/legacy-full-stack-certificate/legacy-full-stack-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/legacy-full-stack-certificate/legacy-full-stack-certificate.yml @@ -1,17 +1,24 @@ +--- id: 561add10cb82ac38a17213bd title: Legacy Full Stack Certificate challengeType: 7 isPrivate: true tests: - - id: 561add10cb82ac38a17513bc + - + id: 561add10cb82ac38a17513bc title: Responsive Web Design Certificate - - id: 561abd10cb81ac38a17513bc + - + id: 561abd10cb81ac38a17513bc title: JavaScript Algorithms and Data Structures Certificate - - id: 561acd10cb82ac38a17513bc + - + id: 561acd10cb82ac38a17513bc title: Front End Libraries Certificate - - id: 5a553ca864b52e1d8bceea14 + - + id: 5a553ca864b52e1d8bceea14 title: Data Visualization Certificate - - id: 561add10cb82ac38a17523bc + - + id: 561add10cb82ac38a17523bc title: API's and Microservices Certificate - - id: 561add10cb82ac38a17213bc + - + id: 561add10cb82ac38a17213bc title: Legacy Information Security and Quality Assurance Certificate diff --git a/curriculum/challenges/portuguese/12-certificates/legacy-information-security-and-quality-assurance-certificate/legacy-information-security-and-quality-assurance-certificate.yml b/curriculum/challenges/portuguese/12-certificates/legacy-information-security-and-quality-assurance-certificate/legacy-information-security-and-quality-assurance-certificate.yml index 6a5be51175..1990a343ed 100644 --- a/curriculum/challenges/portuguese/12-certificates/legacy-information-security-and-quality-assurance-certificate/legacy-information-security-and-quality-assurance-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/legacy-information-security-and-quality-assurance-certificate/legacy-information-security-and-quality-assurance-certificate.yml @@ -1,15 +1,21 @@ +--- id: 561add10cb82ac38a17213bc title: Legacy Information Security and Quality Assurance Certificate challengeType: 7 isPrivate: true tests: - - id: 587d8249367417b2b2512c41 + - + id: 587d8249367417b2b2512c41 title: Metric-Imperial Converter - - id: 587d8249367417b2b2512c42 + - + id: 587d8249367417b2b2512c42 title: Issue Tracker - - id: 587d824a367417b2b2512c43 + - + id: 587d824a367417b2b2512c43 title: Personal Library - - id: 587d824a367417b2b2512c44 + - + id: 587d824a367417b2b2512c44 title: Stock Price Checker - - id: 587d824a367417b2b2512c45 + - + id: 587d824a367417b2b2512c45 title: Anonymous Message Board diff --git a/curriculum/challenges/portuguese/12-certificates/machine-learning-with-python-certificate/machine-learning-with-python-certificate.yml b/curriculum/challenges/portuguese/12-certificates/machine-learning-with-python-certificate/machine-learning-with-python-certificate.yml index dab0dc2a74..266eb63948 100644 --- a/curriculum/challenges/portuguese/12-certificates/machine-learning-with-python-certificate/machine-learning-with-python-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/machine-learning-with-python-certificate/machine-learning-with-python-certificate.yml @@ -1,16 +1,22 @@ +--- id: 5e46fc95ac417301a38fb935 title: Machine Learning with Python Certificate challengeType: 7 isPrivate: true tests: - - id: 5e46f8d6ac417301a38fb92d + - + id: 5e46f8d6ac417301a38fb92d title: Rock Paper Scissors - - id: 5e46f8dcac417301a38fb92e + - + id: 5e46f8dcac417301a38fb92e title: Cat and Dog Image Classifier - - id: 5e46f8e3ac417301a38fb92f + - + id: 5e46f8e3ac417301a38fb92f title: Book Recommendation Engine using KNN - - id: 5e46f8edac417301a38fb930 + - + id: 5e46f8edac417301a38fb930 title: Linear Regression Health Costs Calculator - - id: 5e46f8edac417301a38fb931 + - + id: 5e46f8edac417301a38fb931 title: Neural Network SMS Text Classifier diff --git a/curriculum/challenges/portuguese/12-certificates/quality-assurance-certificate/quality-assurance-certificate.yml b/curriculum/challenges/portuguese/12-certificates/quality-assurance-certificate/quality-assurance-certificate.yml index aae674311d..5e229ba55c 100644 --- a/curriculum/challenges/portuguese/12-certificates/quality-assurance-certificate/quality-assurance-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/quality-assurance-certificate/quality-assurance-certificate.yml @@ -1,16 +1,22 @@ +--- id: 5e611829481575a52dc59c0e title: Quality Assurance Certificate challengeType: 7 isPrivate: true tests: - - id: 587d8249367417b2b2512c41 + - + id: 587d8249367417b2b2512c41 title: Metric-Imperial Converter - - id: 587d8249367417b2b2512c42 + - + id: 587d8249367417b2b2512c42 title: Issue Tracker - - id: 587d824a367417b2b2512c43 + - + id: 587d824a367417b2b2512c43 title: Personal Library - - id: 5e601bf95ac9d0ecd8b94afd + - + id: 5e601bf95ac9d0ecd8b94afd title: Sudoku Solver - - id: 5e601c0d5ac9d0ecd8b94afe + - + id: 5e601c0d5ac9d0ecd8b94afe title: American British Translator diff --git a/curriculum/challenges/portuguese/12-certificates/relational-databases-certificate/relational-databases-certificate.yml b/curriculum/challenges/portuguese/12-certificates/relational-databases-certificate/relational-databases-certificate.yml new file mode 100644 index 0000000000..1d01bf91d9 --- /dev/null +++ b/curriculum/challenges/portuguese/12-certificates/relational-databases-certificate/relational-databases-certificate.yml @@ -0,0 +1,21 @@ +--- +id: 606243f50267e718b1e755f4 +title: Relational Databases Certificate +challengeType: 7 +isPrivate: true +tests: + - + id: 5f1a4ef5d5d6b5ab580fc6ae + title: Celestial Bodies Database + - + id: 5f9771307d4d22b9d2b75a94 + title: World Cup Database + - + id: 5f87ac112ae598023a42df1a + title: Salon Appointment Scheduler + - + id: 602d9ff222201c65d2a019f2 + title: Periodic Table Database + - + id: 602da04c22201c65d2a019f4 + title: Final Boss diff --git a/curriculum/challenges/portuguese/12-certificates/responsive-web-design-certificate/responsive-web-design-certificate.yml b/curriculum/challenges/portuguese/12-certificates/responsive-web-design-certificate/responsive-web-design-certificate.yml index 9b29ab8b89..0148e6c39f 100644 --- a/curriculum/challenges/portuguese/12-certificates/responsive-web-design-certificate/responsive-web-design-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/responsive-web-design-certificate/responsive-web-design-certificate.yml @@ -1,15 +1,21 @@ +--- id: 561add10cb82ac38a17513bc title: Responsive Web Design Certificate challengeType: 7 isPrivate: true tests: - - id: bd7158d8c442eddfaeb5bd18 + - + id: bd7158d8c442eddfaeb5bd18 title: Build a Tribute Page - - id: 587d78af367417b2b2512b03 + - + id: 587d78af367417b2b2512b03 title: Build a Survey Form - - id: 587d78af367417b2b2512b04 + - + id: 587d78af367417b2b2512b04 title: Build a Product Landing Page - - id: 587d78b0367417b2b2512b05 + - + id: 587d78b0367417b2b2512b05 title: Build a Technical Documentation Page - - id: bd7158d8c242eddfaeb5bd13 + - + id: bd7158d8c242eddfaeb5bd13 title: Build a Personal Portfolio Webpage diff --git a/curriculum/challenges/portuguese/12-certificates/scientific-computing-with-python-certificate/scientific-computing-with-python-certificate.yml b/curriculum/challenges/portuguese/12-certificates/scientific-computing-with-python-certificate/scientific-computing-with-python-certificate.yml index 416a36f8f0..1f2f103e94 100644 --- a/curriculum/challenges/portuguese/12-certificates/scientific-computing-with-python-certificate/scientific-computing-with-python-certificate.yml +++ b/curriculum/challenges/portuguese/12-certificates/scientific-computing-with-python-certificate/scientific-computing-with-python-certificate.yml @@ -1,15 +1,21 @@ +--- id: 5e44431b903586ffb414c951 title: Scientific Computing with Python Certificate challengeType: 7 isPrivate: true tests: - - id: 5e44412c903586ffb414c94c + - + id: 5e44412c903586ffb414c94c title: Arithmetic Formatter - - id: 5e444136903586ffb414c94d + - + id: 5e444136903586ffb414c94d title: Time Calculator - - id: 5e44413e903586ffb414c94e + - + id: 5e44413e903586ffb414c94e title: Budget App - - id: 5e444147903586ffb414c94f + - + id: 5e444147903586ffb414c94f title: Polygon Area Calculator - - id: 5e44414f903586ffb414c950 + - + id: 5e44414f903586ffb414c950 title: Probability Calculator diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/celestial-bodies-database.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/celestial-bodies-database.md new file mode 100644 index 0000000000..3dd7c343d3 --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/celestial-bodies-database.md @@ -0,0 +1,18 @@ +--- +id: 5f1a4ef5d5d6b5ab580fc6ae +title: Celestial Bodies Database +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.celestial-bodies-database +dashedName: celestial-bodies-database +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/final-boss.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/final-boss.md new file mode 100644 index 0000000000..2ba55685f4 --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/final-boss.md @@ -0,0 +1,18 @@ +--- +id: 602da04c22201c65d2a019f4 +title: Final Boss +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.final-boss +dashedName: final-boss +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-advanced-bash-by-building.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-advanced-bash-by-building.md new file mode 100644 index 0000000000..9fd49d4f15 --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-advanced-bash-by-building.md @@ -0,0 +1,18 @@ +--- +id: 602da0de22201c65d2a019f6 +title: Learn Advanced Bash by Building +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-advanced-bash-by-building +dashedName: learn-advanced-bash-by-building +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-bash-and-sql-by-building-a-bike-rental-shop.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-bash-and-sql-by-building-a-bike-rental-shop.md new file mode 100644 index 0000000000..76f6ff4eea --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-bash-and-sql-by-building-a-bike-rental-shop.md @@ -0,0 +1,17 @@ +--- +id: 5f5b969a05380d2179fe6e18 +title: Learn Bash and SQL by Building a Bike Rental Shop +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-bash-and-sql-by-building-a-bike-rental-shop +dashedName: learn-bash-and-sql-by-building-a-bike-rental-shop +--- + + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-bash-by-building-a-boilerplate.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-bash-by-building-a-boilerplate.md new file mode 100644 index 0000000000..e1d2873609 --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-bash-by-building-a-boilerplate.md @@ -0,0 +1,18 @@ +--- +id: 5ea8adfab628f68d805bfc5e +title: Learn Bash by Building a Boilerplate +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/freeCodeCamp/.learn-bash-by-building-a-boilerplate +dashedName: learn-bash-by-building-a-boilerplate +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-bash-scripting-by-building-five-programs.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-bash-scripting-by-building-five-programs.md new file mode 100644 index 0000000000..af55d50738 --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-bash-scripting-by-building-five-programs.md @@ -0,0 +1,18 @@ +--- +id: 5f5904ac738bc2fa9efecf5a +title: Learn Bash Scripting by Building Five Programs +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-bash-scripting-by-building-five-programs +dashedName: learn-bash-scripting-by-building-five-programs +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-git-by-building-an-sql-reference-object.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-git-by-building-an-sql-reference-object.md new file mode 100644 index 0000000000..c2b735a923 --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-git-by-building-an-sql-reference-object.md @@ -0,0 +1,18 @@ +--- +id: 5fa323cdaf6a73463d590659 +title: Learn Git by Building an SQL Reference Object +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-git-by-building-an-sql-reference-object +dashedName: learn-git-by-building-an-sql-reference-object +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-github-by-building-a-list-of-inspirational-quotes.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-github-by-building-a-list-of-inspirational-quotes.md new file mode 100644 index 0000000000..f98a0b9293 --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-github-by-building-a-list-of-inspirational-quotes.md @@ -0,0 +1,18 @@ +--- +id: 602da04222201c65d2a019f3 +title: Learn GitHub by Building a List of Inspirational Quotes +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-github-by-building-a-list-of-inspirational-quotes +dashedName: learn-github-by-building-a-list-of-inspirational-quotes +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-nano-by-building-a-castle.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-nano-by-building-a-castle.md new file mode 100644 index 0000000000..b6f9e4ad71 --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-nano-by-building-a-castle.md @@ -0,0 +1,18 @@ +--- +id: 5f32db63eb37f7e17323f459 +title: Learn Nano by Building a Castle +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-nano-by-building-a-castle +dashedName: learn-nano-by-building-a-castle +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-relational-databases-by-building-a-mario-database.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-relational-databases-by-building-a-mario-database.md new file mode 100644 index 0000000000..189dcc68b7 --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-relational-databases-by-building-a-mario-database.md @@ -0,0 +1,18 @@ +--- +id: 5f2c289f164c29556da632fd +title: Learn Relational Databases by Building a Mario Database +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-relational-databases-by-building-a-mario-database +dashedName: learn-relational-databases-by-building-a-mario-database +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-sql-by-building-a-student-database.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-sql-by-building-a-student-database.md new file mode 100644 index 0000000000..7b95cbca4b --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/learn-sql-by-building-a-student-database.md @@ -0,0 +1,18 @@ +--- +id: 602da0c222201c65d2a019f5 +title: Learn SQL by Building a Student Database +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.learn-sql-by-building-a-student-database +dashedName: learn-sql-by-building-a-student-database +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/periodic-table-database.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/periodic-table-database.md new file mode 100644 index 0000000000..05c18517d1 --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/periodic-table-database.md @@ -0,0 +1,18 @@ +--- +id: 602d9ff222201c65d2a019f2 +title: Periodic Table Database +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.periodic-table-database +dashedName: periodic-table-database +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/salon-appointment-scheduler.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/salon-appointment-scheduler.md new file mode 100644 index 0000000000..26fdda731e --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/salon-appointment-scheduler.md @@ -0,0 +1,18 @@ +--- +id: 5f87ac112ae598023a42df1a +title: Salon Appointment Scheduler +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.salon-appointment-scheduler +dashedName: salon-appointment-scheduler +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/world-cup-database.md b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/world-cup-database.md new file mode 100644 index 0000000000..196a965de7 --- /dev/null +++ b/curriculum/challenges/portuguese/13-relational-databases/learn-relational-databases/world-cup-database.md @@ -0,0 +1,18 @@ +--- +id: 5f9771307d4d22b9d2b75a94 +title: World Cup Database +challengeType: 12 +helpCategory: Relational Databases +url: https://github.com/moT01/.world-cup-database +dashedName: world-cup-database +--- + +# --description-- + +# --instructions-- + +# --hints-- + +# --seed-- + +# --solutions-- diff --git a/curriculum/dictionaries/portuguese/comments.json b/curriculum/dictionaries/portuguese/comments.json new file mode 100644 index 0000000000..4330bb636c --- /dev/null +++ b/curriculum/dictionaries/portuguese/comments.json @@ -0,0 +1,110 @@ +{ + "hyek8f": "24.44 in Celsius", + "rscjup": "26 in Celsius", + "am2xch": "A list of strings representing tasks to do:", + "6rztdg": "Add a record here", + "to1vwe": "Add handleChange() and submitMessage() methods here", + "31b7ey": "Add your code above this line", + "c24by8": "Add your code below this line", + "jbrt8k": "Adds the m-th row into newArray", + "zkh12d": "After passing the challenge experiment with myString and see how the grouping works", + "mobihi": "Assign 5 to oopsGlobal Here", + "v3ups9": "Call scale with an argument here", + "iw4a3a": "Case 1: Target has no children", + "463xp8": "Case 2: Target has one child", + "u3inrm": "Case 3: Target has two children", + "axnbgg": "Change code above this line", + "i2kck7": "Change code below this line", + "dlbobn": "Change this line", + "v127zb": "Check the two consoles to see the difference. The freeCodeCamp console should have printed the variable twice, once for each test of this challenge. The browser console should only print the variable once because you cleared it first.", + "ejm0ql": "Close third tab in video window, and join", + "iwch6t": "Complete the method below and implement the others similarly", + "hihhyz": "Complete the return statement:", + "sdxti5": "Count the children of the target to delete", + "wfw6sc": "Create an x and y scale", + "sjw6f4": "Create the scale here", + "nupsh2": "Creates a 2-D array with m rows and n columns of zeroes", + "xfjb3s": "Declare the myGlobal variable below this line", + "htpjk7": "Define a constant for decrement action types", + "tfzdsp": "Define a constant for increment action types", + "zh20mi": "Define ADD, addMessage(), messageReducer(), and store here:", + "43qs4c": "Define an action creator for decrementing", + "nen3qo": "Define an action creator for incrementing", + "0cwyam": "Define an action creator here:", + "fq0wsg": "Define an action here:", + "tegkqa": "Define the Container component here:", + "b5oihn": "Define the counter reducer which will increment or decrement the state based on the action it receives", + "91y4pd": "Define the Redux store here, passing in your reducers", + "eie1vk": "Define the root reducer here", + "5s7nnl": "Define the store here:", + "34qe2q": "Dictionary will hold the items of our set", + "2c1wra": "Dispatch received data action here", + "923cpg": "Dispatch request action here", + "picsyf": "Dispatch the action here:", + "ysjr1s": "Display code", + "kjd1am": "Don't mutate state here or the tests will fail", + "5tx4ow": "Entertainment sites", + "9yu58b": "Example inventory lists", + "ciddtb": "Find the target value and its parent", + "ixx548": "Fix the code below so that it evaluates to true", + "6mbhjj": "For example: Redux.createStore()", + "jshtzq": "Function that returns a string representing a cup of black tea", + "cw1ghf": "Function that returns a string representing a cup of green tea", + "iuccln": "Generate a randomly filled array", + "bm2mop": "Get the tabs after the tab", + "kchz5k": "Get the tabs before the tab", + "bfd23c": "Given a function (representing the tea type) and number of cups needed, the\nfollowing function returns an array of strings (each representing a cup of\na specific type of tea).", + "ead98i": "Global count variable:", + "7zf0i2": "Join them together", + "5j2l88": "Let's create three browser windows", + "e843r9": "Let's open a new tab for now", + "5fvehh": "myVar is not defined outside of myLocalScope", + "qn720a": "Now, add console.clear() before your console.log() to clear the browser console, and pass the tests.", + "j86mef": "Now perform the tab opening, closing, and other operations", + "mk7rvy": "Now remove the console log line to pass the test", + "n7vm1s": "Only change code above this line", + "cvh4x7": "Only change code below this line", + "lvmnm7": "Open a new tab for cat memes", + "avpx79": "Open your browser console.", + "0b5ps6": "Padding between the SVG canvas boundary and the plot", + "uemoej": "Pushes n zeroes into the current row to create the columns", + "lm86nf": "Pushes the current row, which now has n zeroes in it, to the array", + "qscelx": "Redux methods are available from a Redux object", + "atqiig": "Render an input, button, and ul below this line", + "yq81wg": "Render the Provider below this line", + "kxio9j": "responseFromServer is set to false to represent an unsuccessful response from a server", + "alh6pw": "responseFromServer is set to true to represent a successful response from a server", + "1cfidd": "responseFromServer represents a response from a server", + "96tntk": "Returns 30", + "58a5g7": "Run and check the console", + "71bus9": "Run the tests to see the difference between the two consoles.", + "7wp46n": "Setting in Fahrenheit scale", + "oefvg5": "Setup", + "mnt4d3": "Should display 'carrot'", + "fhe9m4": "Social sites", + "za434b": "Stacked bar chart of weekly training", + "7c1fv9": "Stacked bar chart will go here", + "r44ovx": "tabs is an array of titles of each site open within the window", + "cl8peb": "test array:", + "1xi3cv": "The global variable", + "3gc01a": "The main.scss file", + "14kfog": "This is our intersection method", + "d1shtt": "This is our union method", + "pqq6sy": "This method will add an element to the set", + "nd2oxy": "This method will check for the presence of an element and return true or false", + "ocm81t": "This method will remove an element from a set", + "or9p5p": "This method will return all the values in the set", + "g1608f": "This method will return the size of the set", + "bheu99": "This will hold the set", + "x1djjr": "Use console.clear() on the next line to clear the browser console.", + "22ta95": "Use console.log() to print the output variable.", + "w43c7l": "Using s = [2, 5, 7] would be invalid", + "pgckoj": "Variable assignments", + "2xiqvv": "Variable declarations", + "2sx8zg": "We keep a record of the array inside the object", + "xmjfd8": "When you close a tab", + "es69h6": "When you join two windows into one window", + "fho5t5": "When you open a new tab at the end", + "00kcrm": "yields true", + "sxpg2a": "Your mailbox, drive, and other work sites" +} From 5bd0e3ff7101fd2f78555270c5268ed096003154 Mon Sep 17 00:00:00 2001 From: alirezaghey <26653424+alirezaghey@users.noreply.github.com> Date: Sat, 10 Jul 2021 08:05:50 +0200 Subject: [PATCH 148/344] fix: correct test commands in contributor docs (#42813) --- docs/how-to-setup-freecodecamp-locally.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/how-to-setup-freecodecamp-locally.md b/docs/how-to-setup-freecodecamp-locally.md index b5e151b8bd..359458f422 100644 --- a/docs/how-to-setup-freecodecamp-locally.md +++ b/docs/how-to-setup-freecodecamp-locally.md @@ -471,12 +471,12 @@ A quick reference to the commands that you will need when working locally. | `npm run develop` | Starts the freeCodeCamp API Server and Client Applications. | | `npm run storybook` | Starts Storybook for component library development. | | `npm test` | Run all JS tests in the system, including client, server, lint and challenge tests. | -| `npm run test:client` | Run the client test suite. | +| `npm run test-client` | Run the client test suite. | | `npm run test:curriculum` | Run the curriculum test suite. | | `npm run test:curriculum --block='Basic HTML and HTML5'` | Test a specific Block. | | `npm run test:curriculum --superblock='responsive-web-design'` | Test a specific SuperBlock. | | `npm run test-curriculum-full-output` | Run the curriculum test suite, without bailing after the first error | -| `npm run test:server` | Run the server test suite. | +| `npm run test-server` | Run the server test suite. | | `npm run e2e` | Run the Cypress end to end tests. | | `npm run clean` | Uninstalls all dependencies and cleans up caches. | From ba24087c54246e7d165ea98074a8339a59a45689 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 10 Jul 2021 11:34:45 +0000 Subject: [PATCH 149/344] chore(deps): update dependency autoprefixer to v10.3.0 --- client/package-lock.json | 30 ++++----------------------- client/package.json | 2 +- tools/ui-components/package-lock.json | 14 ++++++------- tools/ui-components/package.json | 2 +- 4 files changed, 13 insertions(+), 35 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 412e4decae..e8d02777d3 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -5272,44 +5272,22 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" }, "autoprefixer": { - "version": "10.2.6", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.2.6.tgz", - "integrity": "sha512-8lChSmdU6dCNMCQopIf4Pe5kipkAGj/fvTMslCsih0uHpOrXOPUEVOmYMMqmw3cekQkSD7EhIeuYl5y0BLdKqg==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.3.0.tgz", + "integrity": "sha512-BzVzdjs47nT3MphTddr8eSsPVEIUCF96X6iC8V5iEB8RtxrU+ybtdhHV5rsqRqOsoyh/acQaYs7YupHPUECgmg==", "requires": { "browserslist": "^4.16.6", - "caniuse-lite": "^1.0.30001230", + "caniuse-lite": "^1.0.30001243", "colorette": "^1.2.2", "fraction.js": "^4.1.1", "normalize-range": "^0.1.2", "postcss-value-parser": "^4.1.0" }, "dependencies": { - "browserslist": { - "version": "4.16.6", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz", - "integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==", - "requires": { - "caniuse-lite": "^1.0.30001219", - "colorette": "^1.2.2", - "electron-to-chromium": "^1.3.723", - "escalade": "^3.1.1", - "node-releases": "^1.1.71" - } - }, - "caniuse-lite": { - "version": "1.0.30001230", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001230.tgz", - "integrity": "sha512-5yBd5nWCBS+jWKTcHOzXwo5xzcj4ePE/yjtkZyUV1BTUmrBaA9MRGC+e7mxnqXSA90CmCA8L3eKLaSUkt099IQ==" - }, "colorette": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==" - }, - "electron-to-chromium": { - "version": "1.3.739", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.739.tgz", - "integrity": "sha512-+LPJVRsN7hGZ9EIUUiWCpO7l4E3qBYHNadazlucBfsXBbccDFNKUBAgzE68FnkWGJPwD/AfKhSzL+G+Iqb8A4A==" } } }, diff --git a/client/package.json b/client/package.json index c3be88621c..9a23934990 100644 --- a/client/package.json +++ b/client/package.json @@ -149,7 +149,7 @@ "@types/sanitize-html": "2.3.2", "@types/store": "2.0.2", "@types/validator": "13.6.3", - "autoprefixer": "10.2.6", + "autoprefixer": "10.3.0", "babel-plugin-transform-imports": "2.0.0", "chokidar": "3.5.2", "copy-webpack-plugin": "9.0.1", diff --git a/tools/ui-components/package-lock.json b/tools/ui-components/package-lock.json index 76596cc62e..0fe8fdf41c 100644 --- a/tools/ui-components/package-lock.json +++ b/tools/ui-components/package-lock.json @@ -8013,13 +8013,13 @@ "dev": true }, "autoprefixer": { - "version": "10.2.6", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.2.6.tgz", - "integrity": "sha512-8lChSmdU6dCNMCQopIf4Pe5kipkAGj/fvTMslCsih0uHpOrXOPUEVOmYMMqmw3cekQkSD7EhIeuYl5y0BLdKqg==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.3.0.tgz", + "integrity": "sha512-BzVzdjs47nT3MphTddr8eSsPVEIUCF96X6iC8V5iEB8RtxrU+ybtdhHV5rsqRqOsoyh/acQaYs7YupHPUECgmg==", "dev": true, "requires": { "browserslist": "^4.16.6", - "caniuse-lite": "^1.0.30001230", + "caniuse-lite": "^1.0.30001243", "colorette": "^1.2.2", "fraction.js": "^4.1.1", "normalize-range": "^0.1.2", @@ -8027,9 +8027,9 @@ }, "dependencies": { "caniuse-lite": { - "version": "1.0.30001230", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001230.tgz", - "integrity": "sha512-5yBd5nWCBS+jWKTcHOzXwo5xzcj4ePE/yjtkZyUV1BTUmrBaA9MRGC+e7mxnqXSA90CmCA8L3eKLaSUkt099IQ==", + "version": "1.0.30001243", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001243.tgz", + "integrity": "sha512-vNxw9mkTBtkmLFnJRv/2rhs1yufpDfCkBZexG3Y0xdOH2Z/eE/85E4Dl5j1YUN34nZVsSp6vVRFQRrez9wJMRA==", "dev": true } } diff --git a/tools/ui-components/package.json b/tools/ui-components/package.json index 9d9faa11ef..e7380fd9ab 100644 --- a/tools/ui-components/package.json +++ b/tools/ui-components/package.json @@ -34,7 +34,7 @@ "@storybook/addon-postcss": "2.0.0", "@storybook/react": "6.3.4", "@testing-library/react": "12.0.0", - "autoprefixer": "10.2.6", + "autoprefixer": "10.3.0", "babel-loader": "8.2.2", "babel-plugin-transform-react-remove-prop-types": "0.4.24", "cross-env": "7.0.3", From 52b61c736d5ee9cd9fd06e2b74fae292ab4a164a Mon Sep 17 00:00:00 2001 From: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> Date: Sun, 11 Jul 2021 03:06:47 +0700 Subject: [PATCH 150/344] chore(eslint): use recommended configs for jsx-a11y (#42818) --- .eslintrc-base.json | 34 ---------------------------------- .eslintrc.json | 40 +++++++++++++++++++++++----------------- 2 files changed, 23 insertions(+), 51 deletions(-) diff --git a/.eslintrc-base.json b/.eslintrc-base.json index e789c8863d..e1590fe8cf 100644 --- a/.eslintrc-base.json +++ b/.eslintrc-base.json @@ -35,40 +35,6 @@ "import/unambiguous": 2, "import/no-anonymous-default-export": 2, "jsx-quotes": [2, "prefer-single"], - "jsx-a11y/accessible-emoji": "error", - "jsx-a11y/alt-text": "error", - "jsx-a11y/anchor-has-content": "error", - "jsx-a11y/anchor-is-valid": "error", - "jsx-a11y/aria-activedescendant-has-tabindex": "error", - "jsx-a11y/aria-props": "error", - "jsx-a11y/aria-proptypes": "error", - "jsx-a11y/aria-role": "error", - "jsx-a11y/aria-unsupported-elements": "error", - "jsx-a11y/control-has-associated-label": "error", - "jsx-a11y/click-events-have-key-events": "error", - "jsx-a11y/heading-has-content": "error", - "jsx-a11y/html-has-lang": "error", - "jsx-a11y/iframe-has-title": "error", - "jsx-a11y/img-redundant-alt": "error", - "jsx-a11y/interactive-supports-focus": "error", - "jsx-a11y/label-has-associated-control": "error", - "jsx-a11y/lang": "error", - "jsx-a11y/media-has-caption": "error", - "jsx-a11y/mouse-events-have-key-events": "error", - "jsx-a11y/no-access-key": "error", - "jsx-a11y/no-autofocus": "error", - "jsx-a11y/no-distracting-elements": "error", - "jsx-a11y/no-interactive-element-to-noninteractive-role": "error", - "jsx-a11y/no-noninteractive-element-interactions": "error", - "jsx-a11y/no-noninteractive-element-to-interactive-role": "error", - "jsx-a11y/no-noninteractive-tabindex": "error", - "jsx-a11y/no-onchange": "error", - "jsx-a11y/no-redundant-roles": "error", - "jsx-a11y/no-static-element-interactions": "error", - "jsx-a11y/role-has-required-aria-props": "error", - "jsx-a11y/role-supports-aria-props": "error", - "jsx-a11y/scope": "error", - "jsx-a11y/tabindex-no-positive": "error", "key-spacing": [2, { "beforeColon": false, "afterColon": true }], "keyword-spacing": [2], "max-depth": 0, diff --git a/.eslintrc.json b/.eslintrc.json index 6f566f3beb..387135f7fe 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -11,7 +11,8 @@ "extends": [ "./.eslintrc-base.json", "plugin:prettier/recommended", - "plugin:import/typescript" + "plugin:import/typescript", + "plugin:jsx-a11y/recommended" ], "plugins": [ "react", @@ -39,20 +40,25 @@ }, "import/ignore": ["node_modules"] }, - "overrides": [{ - "files": ["**/*.ts?(x)"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": ["./client/tsconfig.json", "./tools/challenge-helper-scripts/tsconfig.json"] - }, - "extends": [ - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking" - ], - "plugins": ["@typescript-eslint"] - }, - { - "files": ["./tools/ui-components/**/*.test.[jt]s?(x)"], - "extends": ["plugin:testing-library/react", "plugin:jest-dom/recommended"] - }] + "overrides": [ + { + "files": ["**/*.ts?(x)"], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": [ + "./client/tsconfig.json", + "./tools/challenge-helper-scripts/tsconfig.json" + ] + }, + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ], + "plugins": ["@typescript-eslint"] + }, + { + "files": ["./tools/ui-components/**/*.test.[jt]s?(x)"], + "extends": ["plugin:testing-library/react", "plugin:jest-dom/recommended"] + } + ] } From d475b850bc8a0a8910b4a5389382ad4d9401616c Mon Sep 17 00:00:00 2001 From: camperbot Date: Sun, 11 Jul 2021 04:40:31 +0530 Subject: [PATCH 151/344] chore(i18n,docs): update translations (#42816) --- .../how-to-setup-freecodecamp-locally.md | 4 +- .../how-to-setup-freecodecamp-locally.md | 4 +- docs/i18n/italian/_sidebar.md | 2 +- docs/i18n/italian/codebase-best-practices.md | 52 ++++++++--------- .../italian/how-to-open-a-pull-request.md | 2 +- .../how-to-setup-freecodecamp-locally.md | 56 +++++++++---------- .../how-to-setup-freecodecamp-locally.md | 4 +- 7 files changed, 62 insertions(+), 62 deletions(-) diff --git a/docs/i18n/chinese/how-to-setup-freecodecamp-locally.md b/docs/i18n/chinese/how-to-setup-freecodecamp-locally.md index dd6f4eea16..eff5fb8aff 100644 --- a/docs/i18n/chinese/how-to-setup-freecodecamp-locally.md +++ b/docs/i18n/chinese/how-to-setup-freecodecamp-locally.md @@ -459,12 +459,12 @@ A quick reference to the commands that you will need when working locally. | `npm run develop` | Starts the freeCodeCamp API Server and Client Applications. | | `npm run storybook` | Starts Storybook for component library development. | | `npm test` | Run all JS tests in the system, including client, server, lint and challenge tests. | -| `npm run test:client` | Run the client test suite. | +| `npm run test-client` | Run the client test suite. | | `npm run test:curriculum` | Run the curriculum test suite. | | `npm run test:curriculum --block='Basic HTML and HTML5'` | Test a specific Block. | | `npm run test:curriculum --superblock='responsive-web-design'` | Test a specific SuperBlock. | | `npm run test-curriculum-full-output` | Run the curriculum test suite, without bailing after the first error | -| `npm run test:server` | Run the server test suite. | +| `npm run test-server` | Run the server test suite. | | `npm run e2e` | Run the Cypress end to end tests. | | `npm run clean` | Uninstalls all dependencies and cleans up caches. | diff --git a/docs/i18n/espanol/how-to-setup-freecodecamp-locally.md b/docs/i18n/espanol/how-to-setup-freecodecamp-locally.md index af0e442aa5..770ba0c105 100644 --- a/docs/i18n/espanol/how-to-setup-freecodecamp-locally.md +++ b/docs/i18n/espanol/how-to-setup-freecodecamp-locally.md @@ -459,12 +459,12 @@ A quick reference to the commands that you will need when working locally. | `npm run develop` | Inicia el servidor freeCodeCamp API y las aplicaciones de cliente. | | `npm run storybook` | Starts Storybook for component library development. | | `npm test` | Run all JS tests in the system, including client, server, lint and challenge tests. | -| `npm run test:client` | Run the client test suite. | +| `npm run test-client` | Run the client test suite. | | `npm run test:curriculum` | Run the curriculum test suite. | | `npm run test:curriculum --block='Basic HTML and HTML5'` | Test a specific Block. | | `npm run test:curriculum --superblock='responsive-web-design'` | Test a specific SuperBlock. | | `npm run test-curriculum-full-output` | Run the curriculum test suite, without bailing after the first error | -| `npm run test:server` | Run the server test suite. | +| `npm run test-server` | Run the server test suite. | | `npm run e2e` | Run the Cypress end to end tests. | | `npm run clean` | Uninstalls all dependencies and cleans up caches. | diff --git a/docs/i18n/italian/_sidebar.md b/docs/i18n/italian/_sidebar.md index beaeb06ce6..843b0873b2 100644 --- a/docs/i18n/italian/_sidebar.md +++ b/docs/i18n/italian/_sidebar.md @@ -3,7 +3,7 @@ - [Domande frequenti](FAQ.md) - **Contribuire al codice** - [Imposta freeCodeCamp localmente](how-to-setup-freecodecamp-locally.md) - - [Codebase best practices](codebase-best-practices.md) + - [Buone pratiche per il codebase](codebase-best-practices.md) - [Aprire una pull request](how-to-open-a-pull-request.md) - [Lavorare sulle sfide di programmazione](how-to-work-on-coding-challenges.md) - [Lavorare sulle sfide video](how-to-help-with-video-challenges.md) diff --git a/docs/i18n/italian/codebase-best-practices.md b/docs/i18n/italian/codebase-best-practices.md index 0653a85904..90a02d63bb 100644 --- a/docs/i18n/italian/codebase-best-practices.md +++ b/docs/i18n/italian/codebase-best-practices.md @@ -1,34 +1,34 @@ -# Codebase Best Practices +# Buone pratiche per il codebase -## General JavaScript +## JavaScript generale -In most cases, our [linter](how-to-setup-freecodecamp-locally?id=follow-these-steps-to-get-your-development-environment-ready) will warn of any formatting which goes against this codebase's preferred practice. +Nella maggior parte dei casi, il nostro [linter](how-to-setup-freecodecamp-locally?id=follow-these-steps-to-get-your-development-environment-ready) darà un avvertimento nel caso di un format che va contro le preferenze del nostro codebase. -It is encouraged to use functional components over class-based components. +Si incoraggia l'utilizzo di componenti funzionali invece di componenti basati su classi. -## Specific TypeScript +## TypeScript specifico -### Migrating a JavaScript File to TypeScript +### Migrare un file da JavaScript a TypeScript -#### Retaining Git File History +#### Mantenere la cronologia del file con Git -Sometimes changing the file from `.js` to `.ts` (or `.tsx`) causes the original file to be deleted, and a new one created, and other times the filename just changes - in terms of Git. Ideally, we want the file history to be preserved. +A volte cambiare il file da `.js` a `.ts` (o `.tsx`) causa che il file originale viene cancellato e uno nuovo viene creato, altre volte è solo il nome del file a cambiare - per quanto riguarda Git. Idealmente, vogliamo che la storia del file sia conservata. -The best bet at achieving this is to: +Il modo migliore per assicurarsene è: -1. Rename the file -2. Commit with the flag `--no-verify` to prevent Husky from complaining about the lint errors -3. Refactor to TypeScript for migration, in a separate commit +1. Rinominare il file +2. Fare un commit con il flag `--no-verify` per prevenire gli avvertimenti di Husky per errori di lint +3. Fare il refactoring per la migrazione a TypeScript in un commit separato -> [!NOTE] Editors like VSCode are still likely to show you the file has been deleted and a new one created. If you use the CLI to `git add .`, then VSCode will show the file as renamed in stage +> [!NOTE] Un editor come VSCode ha buona probabilità di mostrare comunque che un file è stato eliminato e uno nuovo è stato creato. Se usi la CLI (Command Line Interface) per eseguire `git add .`, allora VSCode mostrerà che il file è stato rinominato -### Naming Conventions +### Convenzioni per i nomi -#### Interfaces and Types +#### Interfacce e Tipi -For the most part, it is encouraged to use interface declarations over type declarations. +Per la maggior parte, incoraggiamo l'uso di dichiarazioni di interfaccia piuttosto che di tipo. -React Component Props - suffix with `Props` +Props di componenti React - suffissi con `Props` ```typescript interface MyComponentProps {} @@ -36,7 +36,7 @@ interface MyComponentProps {} const MyComponent = (props: MyComponentProps) => {}; ``` -React Stateful Components - suffix with `State` +Componenti React stateful - suffissi con `State` ```typescript interface MyComponentState {} @@ -44,7 +44,7 @@ interface MyComponentState {} class MyComponent extends Component {} ``` -Default - object name in PascalCase +Default - nomi di oggetti in PascalCase ```typescript interface MyObject {} @@ -58,7 +58,7 @@ const myObject: MyObject = {}; ## Redux -### Action Definitions +### Definizione di azioni ```typescript enum AppActionTypes = { @@ -73,7 +73,7 @@ export const actionFunction = ( }); ``` -### How to Reduce +### Come usare Reducer ```typescript // Base reducer action without payload @@ -100,9 +100,9 @@ export const reducer = ( }; ``` -### How to Dispatch +### Come fare il dispatch -Within a component, import the actions and selectors needed. +Dentro un componente, importa le azioni e i selettori necessari. ```tsx // Add type definition @@ -128,7 +128,7 @@ export default connect(null, mapDispatchToProps)(MyComponent); -## Further Literature +## Letture aggiuntive -- [TypeScript Docs](https://www.typescriptlang.org/docs/) -- [TypeScript with React CheatSheet](https://github.com/typescript-cheatsheets/react#readme) +- [Documentazione di TypeScript](https://www.typescriptlang.org/docs/) +- [CheatSheet di TypeScript con React](https://github.com/typescript-cheatsheets/react#readme) diff --git a/docs/i18n/italian/how-to-open-a-pull-request.md b/docs/i18n/italian/how-to-open-a-pull-request.md index eeec108ad4..9b2f668e43 100644 --- a/docs/i18n/italian/how-to-open-a-pull-request.md +++ b/docs/i18n/italian/how-to-open-a-pull-request.md @@ -2,7 +2,7 @@ Una pull request (PR) consente di inviare modifiche dal tuo fork su GitHub al repository principale di freeCodeCamp.org. Una volta che hai fatto delle modifiche al codice, puoi seguire queste linee guida per aprire una PR. -> [!NOTE] La tua PR dovrebbe essere in inglese. See [here](https://contribute.freecodecamp.org/#/index?id=translations) for how to contribute translations. +> [!NOTE] La tua PR dovrebbe essere in inglese. Vedi [qui](https://contribute.freecodecamp.org/#/index?id=translations) per come contribuire alla traduzione. ## Preparare un buon titolo PR diff --git a/docs/i18n/italian/how-to-setup-freecodecamp-locally.md b/docs/i18n/italian/how-to-setup-freecodecamp-locally.md index 920895c6cb..45afbebfaf 100644 --- a/docs/i18n/italian/how-to-setup-freecodecamp-locally.md +++ b/docs/i18n/italian/how-to-setup-freecodecamp-locally.md @@ -28,7 +28,7 @@ Alcuni membri della comunità sviluppano anche su Windows 10 nativamente con Git > [!ATTENTION] Se hai una versione diversa, per favore installa la versione raccomandata. Possiamo supportare solo i problemi di installazione per le versioni consigliate. Vedi [risoluzione dei problemi](#troubleshooting) per i dettagli. -If Node.js is already installed on your machine, run the following commands to validate the versions: +Se Node.js è già installato sulla macchina, esegui i seguenti comandi per convalidare le versioni: ```console node -v @@ -57,7 +57,7 @@ Una volta che avrai installato i prerequisiti, dovrai preparare il tuo ambiente ## Esegui il fork del repository su GitHub -[Forking](https://help.github.com/articles/about-forks/) is a step where you get your own copy of freeCodeCamp's main repository (a.k.a _repo_) on GitHub. +Il [Forking](https://help.github.com/articles/about-forks/) è un passaggio nel quale fai una copia del repository principale di freeCodeCamp (noto anche come _repo_) su GitHub. Questo è essenziale, in quanto consente di lavorare sulla propria copia di freeCodeCamp su GitHub, o di scaricare (clonare) il tuo repository per lavorare localmente. Più tardi, potrai richiedere che le tue modifiche siano integrate (pull) nel repository principale dal tuo fork tramite una pull request (PR). @@ -79,7 +79,7 @@ Questo è essenziale, in quanto consente di lavorare sulla propria copia di free
          - How to fork freeCodeCamp on GitHub + Come fare il fork di freeCodeCamp su GitHub ## Clona il tuo fork da GitHub @@ -110,7 +110,7 @@ Nota: `--depth=1` crea un clone superficiale del fork, con la sola cronologia de Ora che hai scaricato una copia del fork, dovrai configurare un remote `upstream` che punti al repository genitore. -[As mentioned earlier](#fork-the-repository-on-github), the main repository is referred `upstream` repository. Your fork referred to as the `origin` repository. +[Come accennato poc'anzi](#fork-the-repository-on-github), il repository principale è chiamato repository `upstream`. Il tuo fork è chiamato repository `origin`. Hai bisogno di un riferimento dal tuo clone locale al repository `upstream` oltre che al repository `origin`. In questo modo potrai sincronizzare le modifiche dal repository principale senza bisogno di fare ripetuti fork e clonazioni. @@ -248,14 +248,14 @@ Basta cliccare sul pulsante **"Preview Custom 404 Page"** per passare alla pagin
          - How to sign in when working locally + Come accedere quando si lavora localmente ## Apportare modifiche a livello locale -You can now make changes to files and commit your changes to your local clone of your fork. +Ora puoi apportare modifiche ai file e inviare le modifiche al clone locale del tuo fork. -Follow these steps: +Segui questi passaggi: 1. Controlla di essere sul ramo `main`: @@ -446,11 +446,11 @@ Follow these steps: ## Proporre una Pull Request (PR) -After you've committed your changes, check here for [how to open a Pull Request](how-to-open-a-pull-request.md). +Dopo aver effettuato le modifiche, controlla qui [come aprire una Pull Request](how-to-open-a-pull-request.md). ## Comandi rapidi -A quick reference to the commands that you will need when working locally. +Un rapido riferimento ai comandi di cui avrai bisogno quando lavorerai localmente. | comando | descrizione | | -------------------------------------------------------------- | ----------------------------------------------------------------------------------- | @@ -459,12 +459,12 @@ A quick reference to the commands that you will need when working locally. | `npm run develop` | Avvia il server API freeCodeCamp e le applicazioni client. | | `npm run storybook` | Esegui Storybook per sviluppo dei componenti di library. | | `npm test` | Esegui tutti i test JS del sistema inclusi client, server, link e test delle sfide. | -| `npm run test:client` | Esegui la test suite del client. | +| `npm run test-client` | Esegui la test suite del client. | | `npm run test:curriculum` | Esegui la test suite del curriculum. | | `npm run test:curriculum --block='Basic HTML and HTML5'` | Esegui i test di uno specifico blocco. | | `npm run test:curriculum --superblock='responsive-web-design'` | Esegui i test di uno specifico superblocco. | | `npm run test-curriculum-full-output` | Esegui la suite di test del curriculum, senza arrestarsi dopo il primo errore | -| `npm run test:server` | Esegui la suite di test del server. | +| `npm run test-server` | Esegui la suite di test del server. | | `npm run e2e` | Esegui i test di Cypress end to end. | | `npm run clean` | Disistalla tutte le dipendenze e pulisce la cache. | @@ -472,11 +472,11 @@ A quick reference to the commands that you will need when working locally. ### Problemi con l'installazione dei prerequisiti raccomandati -We regularly develop on the latest or most popular operating systems like macOS 10.15 or later, Ubuntu 18.04 or later, and Windows 10 (with WSL2). +Sviluppiamo regolarmente sui sistemi operativi più recenti o più popolari come macOS 10.15 o successivi, Ubuntu 18.04, e Windows 10 con WSL2. -It is recommended to research your specific issue on resources such as Google, Stack Overflow, and Stack Exchange. There is a good chance that someone has faced the same issue and there is already an answer to your specific query. +Ti raccomandiamo di fare ricerche sui tuoi problemi specifici usando risorse come Google, Stack Overflow, e Stack Exchange. C'è una buona probabilità che qualcuno abbia incontrato lo stesso problema e ci sia già una risposta alla tua domanda specifica. -If you are on a different OS and/or are still running into issues, see [getting help](#getting-help). +Se sei su un sistema operativo diverso e/o continui ad avere dei problemi, visita [ottenere aiuto](#getting-help). > [!WARNING] > @@ -484,7 +484,7 @@ If you are on a different OS and/or are still running into issues, see [getting ### Problemi con UI, Font, errori di build, ecc. -If you face issues with the UI, Fonts or see builds errors a cleanup can be useful: +Se incontri problemi con l'interfaccia utente, i caratteri o vedi errori di compilazione, potrebbe essere utile una pulizia: ```console npm run clean @@ -493,17 +493,17 @@ npm run seed npm run develop ``` -OR +O -Use the shortcut +Usa il collegamento ``` npm run clean-and-develop ``` -If you continue to face issues with the build, cleaning up the workspace is recommend. +Se continui ad incontrare problemi con la compilazione, ti consigliamo di ripulire lo spazio di lavoro. -Use `git clean` in interactive mode: +Usa `git clean` in modalità interattiva: ``` git clean -ifdX @@ -511,18 +511,18 @@ git clean -ifdX
          - How to clean git untracked files (screenshot) + Come pulire i file git non tracciati (screenshot)
          - How to clean git untracked files + Come pulire i file git non tracciati
          ### Problemi con API, logic, invio delle sfide, ecc. -If you can't sign in, and instead you see a banner with an error message that it will be reported to freeCodeCamp, please double-check that your local port `3000` is not in use by a different program. +Se non riesci ad accedere e invece vedi un banner con un messaggio di errore che il problema sarà segnalato a freeCodeCamp, ti preghiamo di controllare che la porta locale `3000` non sia usata da un programma diverso. -**On Linux / macOS / WSL on Windows - From Terminal:** +**Su Linux / macOS / WSL su Windows - dal terminale:** ```console netstat -a | grep "3000" @@ -530,7 +530,7 @@ netstat -a | grep "3000" tcp4 0 0 0.0.0.0:3000 DESKTOP LISTEN ``` -**On Windows - From Elevated PowerShell:** +**Su Windows - da PowerShell con privilegi elevati:** ```powershell netstat -ab | Select-String "3000" @@ -540,12 +540,12 @@ TCP 0.0.0.0:3000 DESKTOP LISTENING ### Problemi nell'installazione delle dipendenze -If you get errors while installing the dependencies, please make sure that you are not in a restricted network or your firewall settings do not prevent you from accessing resources. +Se incontri degli errori durante l'installazione delle dipendenze, assicurati di non essere in una rete ristretta o che le impostazioni del tuo firewall non ti impediscono di accedere alle risorse. -The first time setup can take a while depending on your network bandwidth. Be patient, and if you are still stuck we recommend using GitPod instead of an offline setup. +La prima configurazione può richiedere un po' di tempo a seconda della larghezza di banda della rete. Sii paziente, e se continui a rimanere bloccato ti raccomandiamo di usare GitPod invece di un setup offline. ## Ottenere Aiuto -If you are stuck and need help, feel free to ask questions on the ['Contributors' category on our forum](https://forum.freecodecamp.org/c/contributors) or [the contributors chat room](https://chat.freecodecamp.org/channel/contributors). +Se sei bloccato e hai bisogno di aiuto, poni liberamente le tue domande nella [categoria 'Contributors' sul nostro forum](https://forum.freecodecamp.org/c/contributors) o [nella chat room per i contributori](https://chat.freecodecamp.org/channel/contributors). -There might be an error in the console of your browser or in Bash / Terminal / Command Line that will help identify the problem. Provide this error message in your problem description so others can more easily identify the issue and help you find a resolution. +Potrebbe esserci un errore nella console del browser o in Bash / Terminal / Linea di comando che ti aiuterà a identificare il problema. Fornisci questo messaggio di errore nella descrizione del problema in modo che gli altri possano identificalo più facilmente e aiutarti a risolverlo. diff --git a/docs/i18n/portuguese/how-to-setup-freecodecamp-locally.md b/docs/i18n/portuguese/how-to-setup-freecodecamp-locally.md index dd6f4eea16..eff5fb8aff 100644 --- a/docs/i18n/portuguese/how-to-setup-freecodecamp-locally.md +++ b/docs/i18n/portuguese/how-to-setup-freecodecamp-locally.md @@ -459,12 +459,12 @@ A quick reference to the commands that you will need when working locally. | `npm run develop` | Starts the freeCodeCamp API Server and Client Applications. | | `npm run storybook` | Starts Storybook for component library development. | | `npm test` | Run all JS tests in the system, including client, server, lint and challenge tests. | -| `npm run test:client` | Run the client test suite. | +| `npm run test-client` | Run the client test suite. | | `npm run test:curriculum` | Run the curriculum test suite. | | `npm run test:curriculum --block='Basic HTML and HTML5'` | Test a specific Block. | | `npm run test:curriculum --superblock='responsive-web-design'` | Test a specific SuperBlock. | | `npm run test-curriculum-full-output` | Run the curriculum test suite, without bailing after the first error | -| `npm run test:server` | Run the server test suite. | +| `npm run test-server` | Run the server test suite. | | `npm run e2e` | Run the Cypress end to end tests. | | `npm run clean` | Uninstalls all dependencies and cleans up caches. | From 4152cacd7cb47c222333989da4ffa0df958e7243 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 11 Jul 2021 06:33:37 +0000 Subject: [PATCH 152/344] chore(deps): update dependency joi to v17.4.1 --- curriculum/package-lock.json | 18 +++++++++--------- curriculum/package.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/curriculum/package-lock.json b/curriculum/package-lock.json index 8d6f5e4286..34d5dfbd1b 100644 --- a/curriculum/package-lock.json +++ b/curriculum/package-lock.json @@ -1601,18 +1601,18 @@ "dev": true }, "@hapi/topo": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.0.0.tgz", - "integrity": "sha512-tFJlT47db0kMqVm3H4nQYgn6Pwg10GTZHb1pwmSiv1K4ks6drQOtfEF5ZnPjkvC+y4/bUPHK+bc87QvLcL+WMw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", "dev": true, "requires": { "@hapi/hoek": "^9.0.0" } }, "@sideway/address": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.1.tgz", - "integrity": "sha512-+I5aaQr3m0OAmMr7RQ3fR9zx55sejEYR2BFJaxL+zT3VM2611X0SHvPWIbAUBZVTn/YzYKbV8gJ2oT/QELknfQ==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz", + "integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==", "dev": true, "requires": { "@hapi/hoek": "^9.0.0" @@ -5375,9 +5375,9 @@ "dev": true }, "joi": { - "version": "17.4.0", - "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.0.tgz", - "integrity": "sha512-F4WiW2xaV6wc1jxete70Rw4V/VuMd6IN+a5ilZsxG4uYtUXWu2kq9W5P2dz30e7Gmw8RCbY/u/uk+dMPma9tAg==", + "version": "17.4.1", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.1.tgz", + "integrity": "sha512-gDPOwQ5sr+BUxXuPDGrC1pSNcVR/yGGcTI0aCnjYxZEa3za60K/iCQ+OFIkEHWZGVCUcUlXlFKvMmrlmxrG6UQ==", "dev": true, "requires": { "@hapi/hoek": "^9.0.0", diff --git a/curriculum/package.json b/curriculum/package.json index 320390b2bc..b0ad476852 100644 --- a/curriculum/package.json +++ b/curriculum/package.json @@ -48,7 +48,7 @@ "css": "3.0.0", "gulp": "4.0.2", "invariant": "2.2.4", - "joi": "17.4.0", + "joi": "17.4.1", "joi-objectid": "3.0.1", "js-yaml": "4.0.0", "jsdom": "16.6.0", From 67ef1238e578283cc06a52c58a4d1bd91ef9eb7f Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 11 Jul 2021 07:58:10 +0000 Subject: [PATCH 153/344] chore(deps): update dependency rollup to v2.53.1 --- tools/ui-components/package-lock.json | 6 +++--- tools/ui-components/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/ui-components/package-lock.json b/tools/ui-components/package-lock.json index 0fe8fdf41c..08078d57b0 100644 --- a/tools/ui-components/package-lock.json +++ b/tools/ui-components/package-lock.json @@ -17843,9 +17843,9 @@ } }, "rollup": { - "version": "2.53.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.53.0.tgz", - "integrity": "sha512-spgrY78Toh+m0+zaOoeaayJKuzFuWy6o1PdFIBMVwRcuxT0xCOX9A5rChyKe+2ruL4lePKWUMImS4mMW1QAkmQ==", + "version": "2.53.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.53.1.tgz", + "integrity": "sha512-yiTCvcYXZEulNWNlEONOQVlhXA/hgxjelFSjNcrwAAIfYx/xqjSHwqg/cCaWOyFRKr+IQBaXwt723m8tCaIUiw==", "dev": true, "requires": { "fsevents": "~2.3.2" diff --git a/tools/ui-components/package.json b/tools/ui-components/package.json index e7380fd9ab..b59b8f1105 100644 --- a/tools/ui-components/package.json +++ b/tools/ui-components/package.json @@ -42,7 +42,7 @@ "postcss-import": "14.0.2", "tailwindcss": "2.2.4", "rimraf": "3.0.2", - "rollup": "2.53.0", + "rollup": "2.53.1", "rollup-plugin-postcss": "4.0.0", "rollup-plugin-terser": "7.0.2" }, From 1e26dc1529cb9274c3a3edc2599d39c6cb84f714 Mon Sep 17 00:00:00 2001 From: Anirudh Modi Date: Sun, 11 Jul 2021 19:36:57 +0530 Subject: [PATCH 154/344] fix(curriculum): updates `body-parser` with explanation for `extended` config (#42740) * fix: better explaination for body-parser extened config * text readability by introducing line break * grammer fixes * fix: typo Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> --- .../use-body-parser-to-parse-post-requests.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/curriculum/challenges/english/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md b/curriculum/challenges/english/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md index 9e0c3a879b..a662c49c4b 100644 --- a/curriculum/challenges/english/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md +++ b/curriculum/challenges/english/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md @@ -26,9 +26,11 @@ As you can see, the body is encoded like the query string. This is the default f # --instructions-- -Install the `body-parser` module in your `package.json`. Then, `require` it at the top of the file. Store it in a variable named `bodyParser`. The middleware to handle urlencoded data is returned by `bodyParser.urlencoded({extended: false})`. Pass to `app.use()` the function returned by the previous method call. As usual, the middleware must be mounted before all the routes which need it. +Install the `body-parser` module in your `package.json`. Then, `require` it at the top of the file. Store it in a variable named `bodyParser`. The middleware to handle urlencoded data is returned by `bodyParser.urlencoded({extended: false})`. Pass the function returned by the previous method call to `app.use()`. As usual, the middleware must be mounted before all the routes that depend on it. -**Note:** `extended=false` is a configuration option that tells the parser to use the classic encoding. When using it, values can be only strings or arrays. The extended version allows more data flexibility, but it is outmatched by JSON. +**Note:** `extended` is a configuration option that tells `body-parser` which parsing needs to be used. When `extended=false` it uses the classic encoding `querystring` library. When `extended=true` it uses `qs` library for parsing. + +When using `extended=false`, values can be only strings or arrays. The object returned when using `querystring` does not prototypically inherit from the default JavaScript `Object`, which means functions like `hasOwnProperty`, `toString` will not be available. The extended version allows more data flexibility, but it is outmatched by JSON. # --hints-- From 8dfd98183d705f1b59464cc3506ef1cc6bf4b949 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 12 Jul 2021 01:54:55 +0000 Subject: [PATCH 155/344] chore(deps): update dependency redux-saga-test-plan to v4.0.2 --- client/package-lock.json | 68 +++------------------------------------- client/package.json | 2 +- 2 files changed, 5 insertions(+), 65 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index e8d02777d3..17c44afc3a 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -5102,18 +5102,6 @@ "resolved": "https://registry.npmjs.org/array-iterate/-/array-iterate-1.1.4.tgz", "integrity": "sha512-sNRaPGh9nnmdC8Zf+pT3UqP8rnWj5Hf9wiFGsX3wUQ2yVSIhO2ShFwCoceIPpB41QF6i2OEmrHmCo36xronCVA==" }, - "array-map": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", - "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", - "dev": true - }, - "array-reduce": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", - "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", - "dev": true - }, "array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", @@ -12479,12 +12467,6 @@ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==" }, - "indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", - "dev": true - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -17264,17 +17246,16 @@ } }, "redux-saga-test-plan": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/redux-saga-test-plan/-/redux-saga-test-plan-4.0.1.tgz", - "integrity": "sha512-UBtb6l8ETKfE/sHZisTIa60t/CdDH7o8epobW6JEFkOqp9hXNgicBdMxWl97i1144eZun8OudbMsL2nvrdnoWA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/redux-saga-test-plan/-/redux-saga-test-plan-4.0.2.tgz", + "integrity": "sha512-UGQq1IXhl+D/mOBqV7eEt9qlAswBvtfaHZ0GKQwumElIkFiglzKK670QISg8AbvEpsyPE3BnLkuikOK17zZFhg==", "dev": true, "requires": { "core-js": "^2.4.1", "fsm-iterator": "^1.1.0", "lodash.isequal": "^4.5.0", "lodash.ismatch": "^4.4.0", - "object-assign": "^4.1.0", - "util-inspect": "^0.1.8" + "object-assign": "^4.1.0" } }, "redux-thunk": { @@ -20165,47 +20146,6 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, - "util-inspect": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/util-inspect/-/util-inspect-0.1.8.tgz", - "integrity": "sha1-KznbzS2SHy2EMJI8r/QPS1zqXbE=", - "dev": true, - "requires": { - "array-map": "0.0.0", - "array-reduce": "0.0.0", - "foreach": "2.0.4", - "indexof": "0.0.1", - "isarray": "0.0.1", - "json3": "3.3.0", - "object-keys": "0.5.0" - }, - "dependencies": { - "foreach": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.4.tgz", - "integrity": "sha1-zF0NiuHUbMmlVcJoL5EJd4WZNd8=", - "dev": true - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "json3": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.0.tgz", - "integrity": "sha1-Dp5/bF0nC3WJKa9Nb+/chL1m4lk=", - "dev": true - }, - "object-keys": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.5.0.tgz", - "integrity": "sha1-CeIR8+ADGK/E9ZLjbnzcENmtcpM=", - "dev": true - } - } - }, "util.promisify": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.1.1.tgz", diff --git a/client/package.json b/client/package.json index 9a23934990..7e11600b9b 100644 --- a/client/package.json +++ b/client/package.json @@ -157,7 +157,7 @@ "jest-json-schema-extended": "1.0.0", "monaco-editor-webpack-plugin": "4.0.0", "react-test-renderer": "16.14.0", - "redux-saga-test-plan": "4.0.1", + "redux-saga-test-plan": "4.0.2", "webpack": "5.44.0", "webpack-cli": "4.7.2" } From a8e2aff073d68f13ba2c6f050f7085d8c9458b1f Mon Sep 17 00:00:00 2001 From: gikf <60067306+gikf@users.noreply.github.com> Date: Mon, 12 Jul 2021 05:50:07 +0200 Subject: [PATCH 156/344] feat(client): add hotkey 'r' to focus on instructions panel (#42503) --- client/src/templates/Challenges/classic/Show.tsx | 4 ++++ client/src/templates/Challenges/components/Hotkeys.tsx | 8 ++++++++ client/src/templates/Challenges/components/Side-Panel.js | 9 ++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/client/src/templates/Challenges/classic/Show.tsx b/client/src/templates/Challenges/classic/Show.tsx index e261320f0f..94ffdea78b 100644 --- a/client/src/templates/Challenges/classic/Show.tsx +++ b/client/src/templates/Challenges/classic/Show.tsx @@ -119,6 +119,7 @@ class ShowClassic extends Component { static displayName: string; containerRef: React.RefObject; editorRef: React.RefObject; + instructionsPanelRef: React.RefObject; resizeProps: ResizePropsType; // eslint-disable-next-line @typescript-eslint/no-explicit-any layoutState: any; @@ -137,6 +138,7 @@ class ShowClassic extends Component { this.containerRef = React.createRef(); this.editorRef = React.createRef(); + this.instructionsPanelRef = React.createRef(); // Holds the information of the panes sizes for desktop view this.layoutState = this.getLayoutState(); } @@ -278,6 +280,7 @@ class ShowClassic extends Component { description={description} guideUrl={getGuideUrl({ forumTopicId, title })} instructions={instructions} + instructionsPanelRef={this.instructionsPanelRef} showToolPanel={showToolPanel} superBlock={superBlock} title={title} @@ -356,6 +359,7 @@ class ShowClassic extends Component { editorRef={this.editorRef} executeChallenge={executeChallenge} innerRef={this.containerRef} + instructionsPanelRef={this.instructionsPanelRef} nextChallengePath={nextChallengePath} prevChallengePath={prevChallengePath} > diff --git a/client/src/templates/Challenges/components/Hotkeys.tsx b/client/src/templates/Challenges/components/Hotkeys.tsx index fa30b4e6e2..4f1a357e84 100644 --- a/client/src/templates/Challenges/components/Hotkeys.tsx +++ b/client/src/templates/Challenges/components/Hotkeys.tsx @@ -22,6 +22,7 @@ const keyMap = { NAVIGATION_MODE: 'escape', EXECUTE_CHALLENGE: ['ctrl+enter', 'command+enter'], FOCUS_EDITOR: 'e', + FOCUS_INSTRUCTIONS_PANEL: 'r', NAVIGATE_PREV: ['p'], NAVIGATE_NEXT: ['n'] }; @@ -33,6 +34,7 @@ interface HotkeysProps { editorRef?: React.Ref | any; executeChallenge?: () => void; innerRef: React.Ref | unknown; + instructionsPanelRef?: React.RefObject; nextChallengePath: string; prevChallengePath: string; setEditorFocusability: (arg0: boolean) => void; @@ -41,6 +43,7 @@ interface HotkeysProps { function Hotkeys({ canFocusEditor, children, + instructionsPanelRef, editorRef, executeChallenge, innerRef, @@ -63,6 +66,11 @@ function Hotkeys({ editorRef.current.getWrappedInstance().editor.focus(); } }, + FOCUS_INSTRUCTIONS_PANEL: () => { + if (instructionsPanelRef && instructionsPanelRef.current) { + instructionsPanelRef.current.focus(); + } + }, NAVIGATION_MODE: () => setEditorFocusability(false), NAVIGATE_PREV: () => { if (!canFocusEditor) void navigate(prevChallengePath); diff --git a/client/src/templates/Challenges/components/Side-Panel.js b/client/src/templates/Challenges/components/Side-Panel.js index 32f2244de8..05f7c52f59 100644 --- a/client/src/templates/Challenges/components/Side-Panel.js +++ b/client/src/templates/Challenges/components/Side-Panel.js @@ -26,6 +26,7 @@ const propTypes = { description: PropTypes.string, guideUrl: PropTypes.string, instructions: PropTypes.string, + instructionsPanelRef: PropTypes.any.isRequired, isChallengeCompleted: PropTypes.bool, showToolPanel: PropTypes.bool, superBlock: PropTypes.string, @@ -72,6 +73,7 @@ export class SidePanel extends Component { title, description, instructions, + instructionsPanelRef, isChallengeCompleted, guideUrl, tests, @@ -81,7 +83,12 @@ export class SidePanel extends Component { videoUrl } = this.props; return ( -
          +
          Date: Mon, 12 Jul 2021 13:45:31 +0700 Subject: [PATCH 157/344] docs: mention Repl instead of Glitch (#42828) --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1503168480..e72d51508e 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ freeCodeCamp.org offers several free developer certifications. Each of these cer Each of these 50 projects in the freeCodeCamp.org curriculum has its own agile user stories and automated tests. These help you build up your project incrementally and ensure you've fulfilled all the user stories before you submit it. -You can pull in these test suites through [freeCodeCamp's CDN](https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js). This means you can build these projects on websites like CodePen and Glitch - or even on your local computer's development environment. +You can pull in these test suites through [freeCodeCamp's CDN](https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js). This means you can build these projects on websites like CodePen and Replit - or even on your local computer's development environment. Once you’ve earned a certification, you will always have it. You will always be able to link to it from your LinkedIn or résumé. And when your prospective employers or freelance clients click that link, they’ll see a verified certification specific to you. @@ -74,7 +74,7 @@ Here are our ten core certifications: - [React and Redux](https://www.freecodecamp.org/learn/front-end-libraries/)

          - **Projects**: [Random Quote Machine](https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-random-quote-machine), [Markdown Previewer](https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-markdown-previewer), [Drum Machine](https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-drum-machine), [JavaScript Calculator](https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-javascript-calculator), [25 + 5 Clock](https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-25--5-clock) + **Projects**: [Random Quote Machine](https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-random-quote-machine), [Markdown Previewer](https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-markdown-previewer), [Drum Machine](https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-drum-machine), [JavaScript Calculator](https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-javascript-calculator), [25 + 5 Clock](https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-25--5-clock) #### 4. Data Visualization Certification @@ -82,7 +82,7 @@ Here are our ten core certifications: - [JSON APIs and Ajax](https://www.freecodecamp.org/learn/data-visualization/)

          - **Projects**: [Bar Chart](https://www.freecodecamp.org/learn/data-visualization/data-visualization-projects/visualize-data-with-a-bar-chart), [Scatterplot Graph](https://www.freecodecamp.org/learn/data-visualization/data-visualization-projects/visualize-data-with-a-scatterplot-graph), [Heat Map](https://www.freecodecamp.org/learn/data-visualization/data-visualization-projects/visualize-data-with-a-heat-map), [Choropleth Map](https://www.freecodecamp.org/learn/data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map), [Treemap Diagram](https://www.freecodecamp.org/learn/data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram) + **Projects**: [Bar Chart](https://www.freecodecamp.org/learn/data-visualization/data-visualization-projects/visualize-data-with-a-bar-chart), [Scatterplot Graph](https://www.freecodecamp.org/learn/data-visualization/data-visualization-projects/visualize-data-with-a-scatterplot-graph), [Heat Map](https://www.freecodecamp.org/learn/data-visualization/data-visualization-projects/visualize-data-with-a-heat-map), [Choropleth Map](https://www.freecodecamp.org/learn/data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map), [Treemap Diagram](https://www.freecodecamp.org/learn/data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram) #### 5. APIs and Microservices Certification @@ -99,7 +99,7 @@ Here are our ten core certifications: - [Advanced Node and Express](https://www.freecodecamp.org/learn/quality-assurance/)

          - **Projects**: [Metric-Imperial Converter](https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-projects/metric-imperial-converter), [Issue Tracker](https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-projects/issue-tracker), [Personal Library](https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-projects/personal-library), [Sudoku Solver](https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-projects/sudoku-solver), [American British Translator](https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-projects/american-british-translator) + **Projects**: [Metric-Imperial Converter](https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-projects/metric-imperial-converter), [Issue Tracker](https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-projects/issue-tracker), [Personal Library](https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-projects/personal-library), [Sudoku Solver](https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-projects/sudoku-solver), [American British Translator](https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-projects/american-british-translator) #### 7. Scientific Computing with Python Certification @@ -122,7 +122,7 @@ Here are our ten core certifications: - [Python for Penetration Testing](https://www.freecodecamp.org/learn/information-security/)

          - **Projects**: [Stock Price Checker](https://www.freecodecamp.org/learn/information-security/information-security-projects/stock-price-checker), [Anonymous Message Board](https://www.freecodecamp.org/learn/information-security/information-security-projects/anonymous-message-board), [Port Scanner](https://www.freecodecamp.org/learn/information-security/information-security-projects/port-scanner), [SHA-1 Password Cracker](https://www.freecodecamp.org/learn/information-security/information-security-projects/sha-1-password-cracker), [Secure Real Time Multiplayer Game ](https://www.freecodecamp.org/learn/information-security/information-security-projects/secure-real-time-multiplayer-game) + **Projects**: [Stock Price Checker](https://www.freecodecamp.org/learn/information-security/information-security-projects/stock-price-checker), [Anonymous Message Board](https://www.freecodecamp.org/learn/information-security/information-security-projects/anonymous-message-board), [Port Scanner](https://www.freecodecamp.org/learn/information-security/information-security-projects/port-scanner), [SHA-1 Password Cracker](https://www.freecodecamp.org/learn/information-security/information-security-projects/sha-1-password-cracker), [Secure Real Time Multiplayer Game ](https://www.freecodecamp.org/learn/information-security/information-security-projects/secure-real-time-multiplayer-game) #### 10. Machine Learning with Python Certification From e2ca65c803e77cf8261d5b75c7b0e23456163028 Mon Sep 17 00:00:00 2001 From: ABHINAV SHARMA Date: Mon, 12 Jul 2021 12:35:01 +0530 Subject: [PATCH 158/344] feat(client): ts-migrate layoutSelector component (#42748) --- client/gatsby-browser.js | 2 +- client/gatsby-ssr.js | 2 +- ...{layoutSelector.js => layout-selector.tsx} | 24 ++++++++++++------- client/utils/gatsby/layoutSelector.test.js | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) rename client/utils/gatsby/{layoutSelector.js => layout-selector.tsx} (77%) diff --git a/client/gatsby-browser.js b/client/gatsby-browser.js index 31bc7efb59..54614f12dd 100644 --- a/client/gatsby-browser.js +++ b/client/gatsby-browser.js @@ -6,7 +6,7 @@ import { I18nextProvider } from 'react-i18next'; import i18n from './i18n/config'; import { createStore } from './src/redux/createStore'; import AppMountNotifier from './src/components/app-mount-notifier'; -import layoutSelector from './utils/gatsby/layoutSelector'; +import layoutSelector from './utils/gatsby/layout-selector'; const store = createStore(); diff --git a/client/gatsby-ssr.js b/client/gatsby-ssr.js index 86df37baea..b488ead6ab 100644 --- a/client/gatsby-ssr.js +++ b/client/gatsby-ssr.js @@ -5,7 +5,7 @@ import { I18nextProvider } from 'react-i18next'; import i18n from './i18n/config'; import { createStore } from './src/redux/createStore'; -import layoutSelector from './utils/gatsby/layoutSelector'; +import layoutSelector from './utils/gatsby/layout-selector'; import { getheadTagComponents, getPostBodyComponents } from './utils/tags'; const store = createStore(); diff --git a/client/utils/gatsby/layoutSelector.js b/client/utils/gatsby/layout-selector.tsx similarity index 77% rename from client/utils/gatsby/layoutSelector.js rename to client/utils/gatsby/layout-selector.tsx index 32c4c2dd8b..3d0858b4e9 100644 --- a/client/utils/gatsby/layoutSelector.js +++ b/client/utils/gatsby/layout-selector.tsx @@ -1,6 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; - import { CertificationLayout, DefaultLayout @@ -8,7 +6,21 @@ import { import FourOhFourPage from '../../src/pages/404'; import { isChallenge } from '../../src/utils/path-parsers'; -export default function layoutSelector({ element, props }) { +interface Location { + pathname: string; +} + +interface LayoutSelectorProps { + props: { + location: Location; + }; + element: React.ReactElement; +} + +export default function layoutSelector({ + element, + props +}: LayoutSelectorProps): React.ReactElement { const { location: { pathname } } = props; @@ -37,9 +49,3 @@ export default function layoutSelector({ element, props }) { ); } } - -layoutSelector.propTypes = { - element: PropTypes.any, - location: PropTypes.objectOf({ pathname: PropTypes.string }), - props: PropTypes.any -}; diff --git a/client/utils/gatsby/layoutSelector.test.js b/client/utils/gatsby/layoutSelector.test.js index f2aa336571..728feca9ab 100644 --- a/client/utils/gatsby/layoutSelector.test.js +++ b/client/utils/gatsby/layoutSelector.test.js @@ -2,7 +2,7 @@ import React from 'react'; import { Provider } from 'react-redux'; import ShallowRenderer from 'react-test-renderer/shallow'; -import layoutSelector from './layoutSelector'; +import layoutSelector from './layout-selector'; import { createStore } from '../../src/redux/createStore'; import FourOhFourPage from '../../src/pages/404'; import Learn from '../../src/pages/learn'; From 92d7ae172596317da64cb93c32cc3c8641e54668 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Mon, 12 Jul 2021 10:24:54 +0200 Subject: [PATCH 159/344] fix(client): remove extra slash when redirecting to client (#42588) Co-authored-by: Nicholas Carrigan (he/him) --- api-server/src/server/boot/challenge.js | 6 +++--- api-server/src/server/component-passport.js | 24 +++++++++++++++------ api-server/src/server/utils/redirection.js | 11 ++++------ cypress/support/commands.js | 1 + 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/api-server/src/server/boot/challenge.js b/api-server/src/server/boot/challenge.js index 544c2ce395..98c3a0f64c 100644 --- a/api-server/src/server/boot/challenge.js +++ b/api-server/src/server/boot/challenge.js @@ -17,8 +17,8 @@ import { fixCompletedChallengeItem } from '../../common/utils'; import { getChallenges } from '../utils/get-curriculum'; import { getRedirectParams, - getRedirectBase, - normalizeParams + normalizeParams, + getPrefixedLandingPath } from '../utils/redirection'; const log = debug('fcc:boot:challenges'); @@ -341,7 +341,7 @@ export function createRedirectToCurrentChallenge( const { user } = req; const { origin, pathPrefix } = getRedirectParams(req, normalizeParams); - const redirectBase = getRedirectBase(origin, pathPrefix); + const redirectBase = getPrefixedLandingPath(origin, pathPrefix); if (!user) { return res.redirect(redirectBase + '/learn'); } diff --git a/api-server/src/server/component-passport.js b/api-server/src/server/component-passport.js index 6f894d4b07..568387d638 100644 --- a/api-server/src/server/component-passport.js +++ b/api-server/src/server/component-passport.js @@ -11,9 +11,9 @@ import passportProviders from './passport-providers'; import { setAccessTokenToResponse } from './utils/getSetAccessToken'; import { getReturnTo, - getRedirectBase, + getPrefixedLandingPath, getRedirectParams, - isRootPath + haveSamePath } from './utils/redirection'; import { jwtSecret } from '../../../config/secrets'; import { availableLangs } from '../../../config/i18n/all-langs'; @@ -100,9 +100,14 @@ export const devLoginRedirect = () => { }; } ); - returnTo += isRootPath(getRedirectBase(origin, pathPrefix), returnTo) - ? '/learn' - : ''; + + // if returnTo has a trailing slash, we need to remove it before comparing + // it to the prefixed landing path + if (returnTo.slice(-1) === '/') { + returnTo = returnTo.slice(0, -1); + } + const redirectBase = getPrefixedLandingPath(origin, pathPrefix); + returnTo += haveSamePath(redirectBase, returnTo) ? '/learn' : ''; return res.redirect(returnTo); }; }; @@ -142,7 +147,7 @@ we recommend using your email address: ${user.email} to sign in instead. const state = req && req.query && req.query.state; // returnTo, origin and pathPrefix are audited by getReturnTo let { returnTo, origin, pathPrefix } = getReturnTo(state, jwtSecret); - const redirectBase = getRedirectBase(origin, pathPrefix); + const redirectBase = getPrefixedLandingPath(origin, pathPrefix); // TODO: getReturnTo could return a success flag to show a flash message, // but currently it immediately gets overwritten by a second message. We @@ -150,7 +155,12 @@ we recommend using your email address: ${user.email} to sign in instead. // multiple messages to appear at once. if (user.acceptedPrivacyTerms) { - returnTo += isRootPath(redirectBase, returnTo) ? '/learn' : ''; + // if returnTo has a trailing slash, we need to remove it before comparing + // it to the prefixed landing path + if (returnTo.slice(-1) === '/') { + returnTo = returnTo.slice(0, -1); + } + returnTo += haveSamePath(redirectBase, returnTo) ? '/learn' : ''; return res.redirectWithFlash(returnTo); } else { return res.redirectWithFlash(`${redirectBase}/email-sign-up`); diff --git a/api-server/src/server/utils/redirection.js b/api-server/src/server/utils/redirection.js index 4c7fb7d74b..de441ee625 100644 --- a/api-server/src/server/utils/redirection.js +++ b/api-server/src/server/utils/redirection.js @@ -50,10 +50,7 @@ function normalizeParams( return { returnTo, origin, pathPrefix }; } -// TODO: tests! -// TODO: ensure origin and pathPrefix validation happens first -// (it needs a dedicated function that can be called from here and getReturnTo) -function getRedirectBase(origin, pathPrefix) { +function getPrefixedLandingPath(origin, pathPrefix) { const redirectPathSegment = pathPrefix ? `/${pathPrefix}` : ''; return `${origin}${redirectPathSegment}`; } @@ -70,14 +67,14 @@ function getRedirectParams(req, _normalizeParams = normalizeParams) { return _normalizeParams({ returnTo: returnUrl.href, origin, pathPrefix }); } -function isRootPath(redirectBase, returnUrl) { +function haveSamePath(redirectBase, returnUrl) { const base = new URL(redirectBase); const url = new URL(returnUrl); return base.pathname === url.pathname; } module.exports.getReturnTo = getReturnTo; -module.exports.getRedirectBase = getRedirectBase; +module.exports.getPrefixedLandingPath = getPrefixedLandingPath; module.exports.normalizeParams = normalizeParams; module.exports.getRedirectParams = getRedirectParams; -module.exports.isRootPath = isRootPath; +module.exports.haveSamePath = haveSamePath; diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 11d357c1ec..1f7113b743 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -36,6 +36,7 @@ Cypress.Commands.add('login', () => { cy.visit('/'); cy.contains("Get started (it's free)").click(); + cy.url().should('eq', Cypress.config().baseUrl + '/learn/'); cy.contains('Welcome back'); }); From e1d8f4be3a3b2e360e6405970a266568ce4ca507 Mon Sep 17 00:00:00 2001 From: awu43 <46470763+awu43@users.noreply.github.com> Date: Mon, 12 Jul 2021 02:17:58 -0700 Subject: [PATCH 160/344] feat(client): ts-migrate client/src/utils (#42666) * rename js files to ts * start migrating ajax * finish migrating ajax * migrate algolia-locale-setup * migrate format * migrate format.test * migrate get-words * install axios for types in handled-error * migrate handled-error * migrate handled-error.test * migrate report-error * migrate script-loaders * migrate to-learn-path * correct renamed imports * remove unnecessary type assertions in searchBar * remove unnecessary global comment * remove unnecessary max-len enable/disable * change axios imports to type imports * revert to .then() from await * use UserType from redux/prop-types * replace assertion with generic type * revert format to JS * remove unused getArticleById() * update putUpdateUserFlag() to use Record * remove unnecessary envData cast * update algolia-locale-setup types * remove invalid key property --- client/package.json | 1 + .../client-only-routes/show-certification.tsx | 4 +- .../Donation/PayPalButtonScriptLoader.js | 2 +- .../search/searchBar/search-bar-optimized.tsx | 2 +- .../search/searchBar/search-bar.tsx | 2 +- .../search/searchBar/search-hits.tsx | 2 +- client/src/redux/error-saga.js | 2 +- .../src/redux/settings/update-email-saga.js | 2 +- .../Challenges/components/Side-Panel.js | 2 +- client/src/utils/ajax.js | 118 ------------- client/src/utils/ajax.ts | 160 ++++++++++++++++++ ...ocale-setup.js => algolia-locale-setup.ts} | 4 +- ...ers.test.js => curriculum-helpers.test.ts} | 2 - .../utils/{format.test.js => format.test.ts} | 7 +- .../src/utils/{get-words.js => get-words.ts} | 20 ++- client/src/utils/handled-error.js | 82 --------- ...ed-error.test.js => handled-error.test.ts} | 29 ++-- client/src/utils/handled-error.ts | 109 ++++++++++++ client/src/utils/{index.js => index.ts} | 0 ...h-parsers.test.js => path-parsers.test.ts} | 2 - ...ssage.js => really-weird-error-message.ts} | 0 client/src/utils/report-error.js | 4 - client/src/utils/report-error.ts | 7 + ...orMessage.js => reported-error-message.ts} | 0 .../{scriptLoaders.js => script-loaders.ts} | 23 ++- ...orMessage.js => standard-error-message.ts} | 0 .../{to-learn-path.js => to-learn-path.ts} | 11 +- 27 files changed, 346 insertions(+), 251 deletions(-) delete mode 100644 client/src/utils/ajax.js create mode 100644 client/src/utils/ajax.ts rename client/src/utils/{algolia-locale-setup.js => algolia-locale-setup.ts} (91%) rename client/src/utils/{curriculum-helpers.test.js => curriculum-helpers.test.ts} (97%) rename client/src/utils/{format.test.js => format.test.ts} (91%) rename client/src/utils/{get-words.js => get-words.ts} (63%) delete mode 100644 client/src/utils/handled-error.js rename client/src/utils/{handled-error.test.js => handled-error.test.ts} (86%) create mode 100644 client/src/utils/handled-error.ts rename client/src/utils/{index.js => index.ts} (100%) rename client/src/utils/{path-parsers.test.js => path-parsers.test.ts} (98%) rename client/src/utils/{reallyWeirdErrorMessage.js => really-weird-error-message.ts} (100%) delete mode 100644 client/src/utils/report-error.js create mode 100644 client/src/utils/report-error.ts rename client/src/utils/{reportedErrorMessage.js => reported-error-message.ts} (100%) rename client/src/utils/{scriptLoaders.js => script-loaders.ts} (69%) rename client/src/utils/{standardErrorMessage.js => standard-error-message.ts} (100%) rename client/src/utils/{to-learn-path.js => to-learn-path.ts} (51%) diff --git a/client/package.json b/client/package.json index 7e11600b9b..b95d7c7ee5 100644 --- a/client/package.json +++ b/client/package.json @@ -150,6 +150,7 @@ "@types/store": "2.0.2", "@types/validator": "13.6.3", "autoprefixer": "10.3.0", + "axios": "^0.21.1", "babel-plugin-transform-imports": "2.0.0", "chokidar": "3.5.2", "copy-webpack-plugin": "9.0.1", diff --git a/client/src/client-only-routes/show-certification.tsx b/client/src/client-only-routes/show-certification.tsx index 7f3e2d8edf..72c910305c 100644 --- a/client/src/client-only-routes/show-certification.tsx +++ b/client/src/client-only-routes/show-certification.tsx @@ -22,8 +22,8 @@ import { } from '../redux'; import { certMap } from '../resources/cert-and-project-map'; import { createFlashMessage } from '../components/Flash/redux'; -import standardErrorMessage from '../utils/standardErrorMessage'; -import reallyWeirdErrorMessage from '../utils/reallyWeirdErrorMessage'; +import standardErrorMessage from '../utils/standard-error-message'; +import reallyWeirdErrorMessage from '../utils/really-weird-error-message'; import { langCodes } from '../../../config/i18n/all-langs'; import envData from '../../../config/env.json'; diff --git a/client/src/components/Donation/PayPalButtonScriptLoader.js b/client/src/components/Donation/PayPalButtonScriptLoader.js index 1a753ab627..8aa98fd466 100644 --- a/client/src/components/Donation/PayPalButtonScriptLoader.js +++ b/client/src/components/Donation/PayPalButtonScriptLoader.js @@ -4,7 +4,7 @@ import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; -import { scriptLoader, scriptRemover } from '../../utils/scriptLoaders'; +import { scriptLoader, scriptRemover } from '../../utils/script-loaders'; import { Loader } from '../../components/helpers'; export class PayPalButtonScriptLoader extends Component { diff --git a/client/src/components/search/searchBar/search-bar-optimized.tsx b/client/src/components/search/searchBar/search-bar-optimized.tsx index bc85448f33..f4d0f35d6c 100644 --- a/client/src/components/search/searchBar/search-bar-optimized.tsx +++ b/client/src/components/search/searchBar/search-bar-optimized.tsx @@ -6,7 +6,7 @@ import { searchPageUrl } from '../../../utils/algolia-locale-setup'; const SearchBarOptimized = (): JSX.Element => { const { t } = useTranslation(); const placeholder = t('search.placeholder'); - const searchUrl: string = searchPageUrl as string; + const searchUrl = searchPageUrl; const [value, setValue] = useState(''); const onChange = (event: React.ChangeEvent) => setValue(event.target.value); diff --git a/client/src/components/search/searchBar/search-bar.tsx b/client/src/components/search/searchBar/search-bar.tsx index 7f539df45b..1a0341dd4b 100644 --- a/client/src/components/search/searchBar/search-bar.tsx +++ b/client/src/components/search/searchBar/search-bar.tsx @@ -23,7 +23,7 @@ import SearchHits from './search-hits'; import './searchbar-base.css'; import './searchbar.css'; -const searchUrl: string = searchPageUrl as string; +const searchUrl = searchPageUrl; const mapStateToProps = createSelector( isSearchDropdownEnabledSelector, isSearchBarFocusedSelector, diff --git a/client/src/components/search/searchBar/search-hits.tsx b/client/src/components/search/searchBar/search-hits.tsx index 54c8c531fc..5cb6fef440 100644 --- a/client/src/components/search/searchBar/search-hits.tsx +++ b/client/src/components/search/searchBar/search-hits.tsx @@ -7,7 +7,7 @@ import { searchPageUrl } from '../../../utils/algolia-locale-setup'; import Suggestion from './search-suggestion'; import NoHitsSuggestion from './no-hits-suggestion'; -const searchUrl = searchPageUrl as string; +const searchUrl = searchPageUrl; interface customHitsPropTypes { // eslint-disable-next-line @typescript-eslint/no-explicit-any hits: Array; diff --git a/client/src/redux/error-saga.js b/client/src/redux/error-saga.js index 7d4e60d9cb..fa3d81ffe5 100644 --- a/client/src/redux/error-saga.js +++ b/client/src/redux/error-saga.js @@ -5,7 +5,7 @@ import { isError } from 'lodash-es'; import { isHandledError, unwrapHandledError } from '../utils/handled-error'; import { reportClientSideError } from '../utils/report-error'; import { createFlashMessage } from '../components/Flash/redux'; -import reportedErrorMessage from '../utils/reportedErrorMessage'; +import reportedErrorMessage from '../utils/reported-error-message'; const errorActionSelector = action => isError(action.payload); diff --git a/client/src/redux/settings/update-email-saga.js b/client/src/redux/settings/update-email-saga.js index d848e46761..b3809fde34 100644 --- a/client/src/redux/settings/update-email-saga.js +++ b/client/src/redux/settings/update-email-saga.js @@ -5,7 +5,7 @@ import { updateMyEmailComplete, updateMyEmailError } from './'; import { createFlashMessage } from '../../components/Flash/redux'; import { putUserUpdateEmail } from '../../utils/ajax'; -import reallyWeirdErrorMessage from '../../utils/reallyWeirdErrorMessage'; +import reallyWeirdErrorMessage from '../../utils/really-weird-error-message'; function* updateMyEmailSaga({ payload: email = '' }) { if (!email || !isEmail(email)) { diff --git a/client/src/templates/Challenges/components/Side-Panel.js b/client/src/templates/Challenges/components/Side-Panel.js index 05f7c52f59..bba4137a10 100644 --- a/client/src/templates/Challenges/components/Side-Panel.js +++ b/client/src/templates/Challenges/components/Side-Panel.js @@ -10,7 +10,7 @@ import TestSuite from './Test-Suite'; import { challengeTestsSelector, isChallengeCompletedSelector } from '../redux'; import { createSelector } from 'reselect'; import './side-panel.css'; -import { mathJaxScriptLoader } from '../../../utils/scriptLoaders'; +import { mathJaxScriptLoader } from '../../../utils/script-loaders'; const mapStateToProps = createSelector( isChallengeCompletedSelector, diff --git a/client/src/utils/ajax.js b/client/src/utils/ajax.js deleted file mode 100644 index 72945abf2b..0000000000 --- a/client/src/utils/ajax.js +++ /dev/null @@ -1,118 +0,0 @@ -import envData from '../../../config/env.json'; -import Tokens from 'csrf'; -import cookies from 'browser-cookies'; - -const { apiLocation } = envData; - -const base = apiLocation; -const tokens = new Tokens(); - -const defaultOptions = { - credentials: 'include' -}; - -// _csrf is passed to the client as a cookie. Tokens are sent back to the server -// via headers: -function getCSRFToken() { - const _csrf = typeof window !== 'undefined' && cookies.get('_csrf'); - if (!_csrf) { - return ''; - } else { - return tokens.create(_csrf); - } -} - -function get(path) { - return fetch(`${base}${path}`, defaultOptions).then(res => res.json()); -} - -export function post(path, body) { - return request('POST', path, body); -} - -function put(path, body) { - return request('PUT', path, body); -} - -function request(method, path, body) { - const options = { - ...defaultOptions, - method, - headers: { - 'CSRF-Token': getCSRFToken(), - 'Content-Type': 'application/json' - }, - body: JSON.stringify(body) - }; - return fetch(`${base}${path}`, options).then(res => res.json()); -} - -/** GET **/ - -export function getSessionUser() { - return get('/user/get-session-user'); -} - -export function getUserProfile(username) { - return get(`/api/users/get-public-profile?username=${username}`); -} - -export function getShowCert(username, certSlug) { - return get(`/certificate/showCert/${username}/${certSlug}`); -} - -export function getUsernameExists(username) { - return get(`/api/users/exists?username=${username}`); -} - -export function getArticleById(shortId) { - return get(`/n/${shortId}`); -} - -/** POST **/ - -export function addDonation(body) { - return post('/donate/add-donation', body); -} - -export function postReportUser(body) { - return post('/user/report-user', body); -} - -export function postDeleteAccount(body) { - return post('/account/delete', body); -} - -export function postResetProgress(body) { - return post('/account/reset-progress', body); -} - -/** PUT **/ - -export function putUpdateMyAbout(values) { - return put('/update-my-about', { ...values }); -} - -export function putUpdateMyUsername(username) { - return put('/update-my-username', { username }); -} - -export function putUpdateMyProfileUI(profileUI) { - return put('/update-my-profileui', { profileUI }); -} - -export function putUpdateUserFlag(update) { - return put('/update-user-flag', update); -} - -export function putUserAcceptsTerms(quincyEmails) { - return put('/update-privacy-terms', { quincyEmails }); -} - -export function putUserUpdateEmail(email) { - return put('/update-my-email', { email }); -} - -export function putVerifyCert(certSlug) { - return put('/certificate/verify', { certSlug }); -} diff --git a/client/src/utils/ajax.ts b/client/src/utils/ajax.ts new file mode 100644 index 0000000000..0c0732f578 --- /dev/null +++ b/client/src/utils/ajax.ts @@ -0,0 +1,160 @@ +import envData from '../../../config/env.json'; +import Tokens from 'csrf'; +import cookies from 'browser-cookies'; + +import type { UserType } from '../redux/prop-types'; + +const { apiLocation } = envData; + +const base = apiLocation; +const tokens = new Tokens(); + +const defaultOptions: RequestInit = { + credentials: 'include' +}; + +// _csrf is passed to the client as a cookie. Tokens are sent back to the server +// via headers: +function getCSRFToken() { + const _csrf = typeof window !== 'undefined' && cookies.get('_csrf'); + if (!_csrf) { + return ''; + } else { + return tokens.create(_csrf); + } +} + +async function get(path: string): Promise { + return fetch(`${base}${path}`, defaultOptions).then(res => res.json()); +} + +export function post(path: string, body: unknown): Promise { + return request('POST', path, body); +} + +function put(path: string, body: unknown): Promise { + return request('PUT', path, body); +} + +async function request( + method: 'POST' | 'PUT', + path: string, + body: unknown +): Promise { + const options: RequestInit = { + ...defaultOptions, + method, + headers: { + 'CSRF-Token': getCSRFToken(), + 'Content-Type': 'application/json' + }, + body: JSON.stringify(body) + }; + return fetch(`${base}${path}`, options).then(res => res.json()); +} + +/** GET **/ + +interface SessionUser { + user: UserType; + sessionMeta: { activeDonations: number }; + result: string; +} +export function getSessionUser(): Promise { + return get('/user/get-session-user'); +} + +export function getUserProfile(username: string): Promise { + return get(`/api/users/get-public-profile?username=${username}`); +} + +interface Cert { + certTitle: string; + username: string; + date: Date; + completionTime: string; +} +export function getShowCert(username: string, certSlug: string): Promise { + return get(`/certificate/showCert/${username}/${certSlug}`); +} + +export function getUsernameExists(username: string): Promise { + return get(`/api/users/exists?username=${username}`); +} + +/** POST **/ + +interface Donation { + email: string; + amount: number; + duration: string; + provider: string; + subscriptionId: string; + customerId: string; + startDate: Date; +} +export function addDonation(body: Donation): Promise { + return post('/donate/add-donation', body); +} + +interface Report { + username: string; + reportDescription: string; +} +export function postReportUser(body: Report): Promise { + return post('/user/report-user', body); +} + +// Both are called without a payload in danger-zone-saga, +// which suggests both are sent without any body +// TODO: Convert to DELETE +export function postDeleteAccount(): Promise { + return post('/account/delete', {}); +} + +export function postResetProgress(): Promise { + return post('/account/reset-progress', {}); +} + +/** PUT **/ + +interface MyAbout { + name: string; + location: string; + about: string; + picture: string; +} +export function putUpdateMyAbout(values: MyAbout): Promise { + return put('/update-my-about', { ...values }); +} + +export function putUpdateMyUsername(username: string): Promise { + return put('/update-my-username', { username }); +} + +export function putUpdateMyProfileUI( + profileUI: UserType['profileUI'] +): Promise { + return put('/update-my-profileui', { profileUI }); +} + +// Update should contain only one flag and one new value +// It's possible to constrain to only one key with TS, but is overkill for this +// https://stackoverflow.com/a/60807986 +export function putUpdateUserFlag( + update: Record +): Promise { + return put('/update-user-flag', update); +} + +export function putUserAcceptsTerms(quincyEmails: boolean): Promise { + return put('/update-privacy-terms', { quincyEmails }); +} + +export function putUserUpdateEmail(email: string): Promise { + return put('/update-my-email', { email }); +} + +export function putVerifyCert(certSlug: string): Promise { + return put('/certificate/verify', { certSlug }); +} diff --git a/client/src/utils/algolia-locale-setup.js b/client/src/utils/algolia-locale-setup.ts similarity index 91% rename from client/src/utils/algolia-locale-setup.js rename to client/src/utils/algolia-locale-setup.ts index 1ced1eaa7b..5cbec735b1 100644 --- a/client/src/utils/algolia-locale-setup.js +++ b/client/src/utils/algolia-locale-setup.ts @@ -1,6 +1,8 @@ import envData from '../../../config/env.json'; -const { clientLocale } = envData; +const { clientLocale } = envData as { + clientLocale: keyof typeof algoliaIndices; +}; const algoliaIndices = { english: { diff --git a/client/src/utils/curriculum-helpers.test.js b/client/src/utils/curriculum-helpers.test.ts similarity index 97% rename from client/src/utils/curriculum-helpers.test.js rename to client/src/utils/curriculum-helpers.test.ts index 3c8d012151..38465b6a5c 100644 --- a/client/src/utils/curriculum-helpers.test.js +++ b/client/src/utils/curriculum-helpers.test.ts @@ -2,9 +2,7 @@ import __testHelpers, { removeJSComments } from './curriculum-helpers'; import jsTestValues from './__fixtures/curriculum-helpers-javascript'; import cssTestValues from './__fixtures/curriculum-helpers-css'; import htmlTestValues from './__fixtures/curriculum-helpers-html'; -/* eslint-disable max-len */ import whiteSpaceTestValues from './__fixtures/curriculum-helpers-remove-white-space'; -/* eslint-enable max-len */ const { stringWithWhiteSpaceChars, stringWithWhiteSpaceCharsRemoved } = whiteSpaceTestValues; diff --git a/client/src/utils/format.test.js b/client/src/utils/format.test.ts similarity index 91% rename from client/src/utils/format.test.js rename to client/src/utils/format.test.ts index 66488790a6..2856010f46 100644 --- a/client/src/utils/format.test.js +++ b/client/src/utils/format.test.ts @@ -1,12 +1,9 @@ -/* global BigInt */ +import { format } from './format'; -const { format } = require('./format'); - -/* eslint-disable no-unused-vars */ function simpleFun() { + // eslint-disable-next-line no-var, @typescript-eslint/no-unused-vars var x = 'y'; } -/* eslint-enable no-unused-vars */ /* format uses util.inspect to do almost everything, the tests are just there to warn us if util.inspect ever changes */ diff --git a/client/src/utils/get-words.js b/client/src/utils/get-words.ts similarity index 63% rename from client/src/utils/get-words.js rename to client/src/utils/get-words.ts index c97cdd3be3..befc6a3132 100644 --- a/client/src/utils/get-words.js +++ b/client/src/utils/get-words.ts @@ -1,8 +1,18 @@ -/* global preval */ - // this lets us do dynamic work ahead of time, inlining motivation.json, so // that Webpack will never try to include locales that we know are not used. +interface Quote { + quote: string; + author: string; +} + +interface Motivation { + compliments: string[]; + motivationalQuotes: Quote[]; +} + +declare const preval: (s: TemplateStringsArray) => Motivation; + const words = preval` const config = require('../../../config/env.json'); const { clientLocale } = config; @@ -11,14 +21,14 @@ const words = preval` module.exports = words; `; -function randomItem(arr) { +function randomItem(arr: T[]): T { return arr[Math.floor(Math.random() * arr.length)]; } -export function randomQuote() { +export function randomQuote(): Quote { return randomItem(words.motivationalQuotes); } -export function randomCompliment() { +export function randomCompliment(): string { return randomItem(words.compliments); } diff --git a/client/src/utils/handled-error.js b/client/src/utils/handled-error.js deleted file mode 100644 index 8aa7ce6ec0..0000000000 --- a/client/src/utils/handled-error.js +++ /dev/null @@ -1,82 +0,0 @@ -import { has } from 'lodash-es'; - -import standardErrorMessage from './standardErrorMessage'; -import reportedErrorMessage from './reportedErrorMessage'; - -import { reportClientSideError } from './report-error'; - -export const handledErrorSymbol = Symbol('handledError'); - -export function isHandledError(err) { - return has(err, handledErrorSymbol); -} - -export function unwrapHandledError(err) { - return handledErrorSymbol in err ? err[handledErrorSymbol] : {}; -} - -export function wrapHandledError(err, { type, message, redirectTo }) { - err[handledErrorSymbol] = { type, message, redirectTo }; - return err; -} - -export function handle400Error(e, options = { redirectTo: '/' }) { - const { - response: { status } - } = e; - let { redirectTo } = options; - let flash = { ...standardErrorMessage, redirectTo }; - - switch (status) { - case 401: - case 403: { - return { - ...flash, - type: 'warn', - message: 'flash.not-authorized' - }; - } - case 404: { - return { - ...flash, - type: 'info', - message: 'flash.could-not-find' - }; - } - default: { - return flash; - } - } -} - -export function handle500Error( - e, - options = { - redirectTo: '/' - }, - _reportClientSideError = reportClientSideError -) { - const { redirectTo } = options; - _reportClientSideError(e, 'We just handled a 5** error on the client'); - return { ...reportedErrorMessage, redirectTo }; -} - -export function handleAPIError( - e, - options, - _reportClientSideError = reportClientSideError -) { - const { response: { status = 0 } = {} } = e; - if (status >= 400 && status < 500) { - return handle400Error(e, options); - } - if (status >= 500) { - return handle500Error(e, options, _reportClientSideError); - } - const { redirectTo } = options; - _reportClientSideError( - e, - 'We just handled an api error on the client without an error status code' - ); - return { ...reportedErrorMessage, redirectTo }; -} diff --git a/client/src/utils/handled-error.test.js b/client/src/utils/handled-error.test.ts similarity index 86% rename from client/src/utils/handled-error.test.js rename to client/src/utils/handled-error.test.ts index 726b431a52..42e59cb839 100644 --- a/client/src/utils/handled-error.test.js +++ b/client/src/utils/handled-error.test.ts @@ -1,4 +1,6 @@ import { isObject } from 'lodash-es'; +import type { AxiosError } from 'axios'; + import { isHandledError, wrapHandledError, @@ -6,8 +8,9 @@ import { handledErrorSymbol, handleAPIError } from './handled-error'; +import type { HandledError } from './handled-error'; -import reportedErrorMessage from './reportedErrorMessage'; +import reportedErrorMessage from './reported-error-message'; describe('client/src utilities', () => { describe('handled-error.js', () => { @@ -19,7 +22,7 @@ describe('client/src utilities', () => { describe('isHandledError', () => { it('returns a boolean', () => { - expect(typeof isHandledError({})).toEqual('boolean'); + expect(typeof isHandledError({} as Error)).toEqual('boolean'); }); it('returns false for an unhandled error', () => { @@ -27,7 +30,7 @@ describe('client/src utilities', () => { }); it('returns true for a handled error', () => { - const handledError = new Error(); + const handledError = new Error() as HandledError; handledError[handledErrorSymbol] = {}; expect(isHandledError(handledError)).toEqual(true); @@ -39,14 +42,14 @@ describe('client/src utilities', () => { // we need to make these tests more robust 💪 it('returns an error with a handledError property', () => { const handledError = wrapHandledError( - new Error(), + new Error() as HandledError, mockHandledErrorData ); expect(handledErrorSymbol in handledError).toEqual(true); }); it('assigns error handling details to the handledError property', () => { const handledError = wrapHandledError( - new Error(), + new Error() as HandledError, mockHandledErrorData ); expect(handledError[handledErrorSymbol]).toEqual(mockHandledErrorData); @@ -57,13 +60,13 @@ describe('client/src utilities', () => { // this is testing implementation details 👎 // we need to make these tests more robust 💪 it('returns an object by default', () => { - const error = new Error(); + const error = new Error() as HandledError; const unwrappedError = unwrapHandledError(error); expect(isObject(unwrappedError)).toBe(true); }); it('returns the data that was wrapped in the error', () => { - const handledError = new Error(); + const handledError = new Error() as HandledError; handledError[handledErrorSymbol] = mockHandledErrorData; const unwrapped = unwrapHandledError(handledError); expect(unwrapped).toEqual(mockHandledErrorData); @@ -71,7 +74,7 @@ describe('client/src utilities', () => { }); describe('handleAPIError', () => { - let reportMock; + let reportMock: () => void; beforeEach(() => { reportMock = jest.fn(); }); @@ -82,7 +85,7 @@ describe('client/src utilities', () => { response: { status: 400 } - }; + } as AxiosError; const result = handleAPIError( axiosErrorMock, { redirectTo: '/' }, @@ -100,7 +103,7 @@ describe('client/src utilities', () => { response: { status: i } - }; + } as AxiosError; handleAPIError(axiosErrorMock, { redirectTo: '/' }, reportMock); } expect(reportMock).not.toHaveBeenCalled(); @@ -111,7 +114,7 @@ describe('client/src utilities', () => { response: { status: 502 } - }; + } as AxiosError; handleAPIError(axiosErrorMock, { redirectTo: '/' }, reportMock); expect(reportMock).toHaveBeenCalledTimes(1); }); @@ -121,7 +124,7 @@ describe('client/src utilities', () => { response: { status: 502 } - }; + } as AxiosError; const result = handleAPIError( axiosErrorMock, { redirectTo: '/' }, @@ -135,7 +138,7 @@ describe('client/src utilities', () => { response: { status: 400 } - }; + } as AxiosError; const result = handleAPIError( axiosErrorMock, { redirectTo: null }, diff --git a/client/src/utils/handled-error.ts b/client/src/utils/handled-error.ts new file mode 100644 index 0000000000..178074b5e6 --- /dev/null +++ b/client/src/utils/handled-error.ts @@ -0,0 +1,109 @@ +import { has } from 'lodash-es'; +import type { AxiosError, AxiosResponse } from 'axios'; + +import standardErrorMessage from './standard-error-message'; +import reportedErrorMessage from './reported-error-message'; + +import { reportClientSideError } from './report-error'; + +interface ErrorData { + type?: string; + message?: string; + redirectTo?: string | null; +} + +export const handledErrorSymbol = Symbol('handledError'); + +export type HandledError = Error & { + [handledErrorSymbol]: ErrorData; +}; + +export function isHandledError(err: unknown): err is HandledError { + return has(err, handledErrorSymbol); +} + +export function unwrapHandledError( + err: HandledError +): ErrorData | Record { + return handledErrorSymbol in err ? err[handledErrorSymbol] : {}; +} + +export function wrapHandledError( + err: Error, + { type, message, redirectTo }: ErrorData +): HandledError { + (err as HandledError)[handledErrorSymbol] = { + type, + message, + redirectTo + }; + return err as HandledError; +} + +export function handle400Error( + e: AxiosError, + options: ErrorData = { redirectTo: '/' } +): ErrorData { + const { status } = e.response as AxiosResponse; + const { redirectTo } = options; + const flash = { ...standardErrorMessage, redirectTo }; + + switch (status) { + case 401: + case 403: { + return { + ...flash, + type: 'warn', + message: 'flash.not-authorized' + }; + } + case 404: { + return { + ...flash, + type: 'info', + message: 'flash.could-not-find' + }; + } + default: { + return flash; + } + } +} + +export function handle500Error( + e: AxiosError, + options: ErrorData = { + redirectTo: '/' + }, + _reportClientSideError: ( + e: Error, + message: string + ) => void = reportClientSideError +): ErrorData { + const { redirectTo } = options; + _reportClientSideError(e, 'We just handled a 5** error on the client'); + return { ...reportedErrorMessage, redirectTo }; +} + +export function handleAPIError( + e: AxiosError, + options: ErrorData, + _reportClientSideError: ( + e: Error, + message: string + ) => void = reportClientSideError +): ErrorData { + const { response: { status = 0 } = {} } = e; + if (status >= 400 && status < 500) { + return handle400Error(e, options); + } + if (status >= 500) { + return handle500Error(e, options, _reportClientSideError); + } + const { redirectTo } = options; + _reportClientSideError( + e, + 'We just handled an api error on the client without an error status code' + ); + return { ...reportedErrorMessage, redirectTo }; +} diff --git a/client/src/utils/index.js b/client/src/utils/index.ts similarity index 100% rename from client/src/utils/index.js rename to client/src/utils/index.ts diff --git a/client/src/utils/path-parsers.test.js b/client/src/utils/path-parsers.test.ts similarity index 98% rename from client/src/utils/path-parsers.test.js rename to client/src/utils/path-parsers.test.ts index 2643a5043a..5e313c38a5 100644 --- a/client/src/utils/path-parsers.test.js +++ b/client/src/utils/path-parsers.test.ts @@ -1,5 +1,3 @@ -/* global describe it expect */ - import { isChallenge, isLanding } from './path-parsers'; const pathnames = { diff --git a/client/src/utils/reallyWeirdErrorMessage.js b/client/src/utils/really-weird-error-message.ts similarity index 100% rename from client/src/utils/reallyWeirdErrorMessage.js rename to client/src/utils/really-weird-error-message.ts diff --git a/client/src/utils/report-error.js b/client/src/utils/report-error.js deleted file mode 100644 index af07522b2a..0000000000 --- a/client/src/utils/report-error.js +++ /dev/null @@ -1,4 +0,0 @@ -// TODO: integrate with Sentry? -export function reportClientSideError(e, message = 'Unhandled error') { - return console.error(`Client: ${message}`, e); -} diff --git a/client/src/utils/report-error.ts b/client/src/utils/report-error.ts new file mode 100644 index 0000000000..0a904c53dd --- /dev/null +++ b/client/src/utils/report-error.ts @@ -0,0 +1,7 @@ +// TODO: integrate with Sentry? +export function reportClientSideError( + e: Error, + message = 'Unhandled error' +): void { + return console.error(`Client: ${message}`, e); +} diff --git a/client/src/utils/reportedErrorMessage.js b/client/src/utils/reported-error-message.ts similarity index 100% rename from client/src/utils/reportedErrorMessage.js rename to client/src/utils/reported-error-message.ts diff --git a/client/src/utils/scriptLoaders.js b/client/src/utils/script-loaders.ts similarity index 69% rename from client/src/utils/scriptLoaders.js rename to client/src/utils/script-loaders.ts index 35f9ff5f5e..97b8f45901 100644 --- a/client/src/utils/scriptLoaders.js +++ b/client/src/utils/script-loaders.ts @@ -1,25 +1,29 @@ -export const scriptLoader = (id, key, async, src, onload, text) => { - let s = document.createElement('script'); +export function scriptLoader( + id: string, + async: boolean, + src: string, + onload: (() => void) | null, + text: string +): void { + const s = document.createElement('script'); s.type = 'text/javascript'; s.id = id; - s.key = key; s.async = async; s.onload = onload; s.src = src; s.text = text; document.getElementsByTagName('head')[0].appendChild(s); -}; +} -export const scriptRemover = id => { - let script = document.getElementById(id); +export function scriptRemover(id: string): void { + const script = document.getElementById(id); if (script) { script.remove(); } -}; +} -export const mathJaxScriptLoader = () => +export function mathJaxScriptLoader(): void { scriptLoader( - 'mathjax', 'mathjax', false, 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/' + @@ -39,3 +43,4 @@ export const mathJaxScriptLoader = () => document.querySelector('.project-euler') ]);` ); +} diff --git a/client/src/utils/standardErrorMessage.js b/client/src/utils/standard-error-message.ts similarity index 100% rename from client/src/utils/standardErrorMessage.js rename to client/src/utils/standard-error-message.ts diff --git a/client/src/utils/to-learn-path.js b/client/src/utils/to-learn-path.ts similarity index 51% rename from client/src/utils/to-learn-path.js rename to client/src/utils/to-learn-path.ts index 0071f18010..5fab37804f 100644 --- a/client/src/utils/to-learn-path.js +++ b/client/src/utils/to-learn-path.ts @@ -1,6 +1,15 @@ import { withPrefix } from 'gatsby'; -export default function toLearnPath({ superBlock, block, challenge }) { +interface ToLearnPathKwargs { + superBlock: string; + block: string; + challenge: string; +} +export default function toLearnPath({ + superBlock, + block, + challenge +}: ToLearnPathKwargs): string { let path = withPrefix('/learn'); if (superBlock) path += `/${superBlock}`; if (block) path += `/${block}`; From f6455db7b886d4f2a9eb76a26e15fb5ed3963857 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 12 Jul 2021 09:24:27 +0000 Subject: [PATCH 161/344] chore(deps): pin dependency axios to 0.21.1 --- client/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/package.json b/client/package.json index b95d7c7ee5..4f019d7ea5 100644 --- a/client/package.json +++ b/client/package.json @@ -150,7 +150,7 @@ "@types/store": "2.0.2", "@types/validator": "13.6.3", "autoprefixer": "10.3.0", - "axios": "^0.21.1", + "axios": "0.21.1", "babel-plugin-transform-imports": "2.0.0", "chokidar": "3.5.2", "copy-webpack-plugin": "9.0.1", From 4307179d00890cd37ee87eba60f966723cdc9022 Mon Sep 17 00:00:00 2001 From: Ismail Tlemcani <34961373+Ismailtlem@users.noreply.github.com> Date: Mon, 12 Jul 2021 12:26:10 +0100 Subject: [PATCH 162/344] fix broken image url after submission on profile page (#42507) --- .../src/components/helpers/avatar-renderer.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/client/src/components/helpers/avatar-renderer.tsx b/client/src/components/helpers/avatar-renderer.tsx index 1c7d598795..fb847c83f9 100644 --- a/client/src/components/helpers/avatar-renderer.tsx +++ b/client/src/components/helpers/avatar-renderer.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState, useEffect } from 'react'; import { Image } from '@freecodecamp/react-bootstrap'; import DefaultAvatar from '../../assets/icons/default-avatar'; import { defaultUserImage } from '../../../../config/misc'; @@ -19,9 +19,22 @@ function AvatarRenderer({ isTopContributor }: AvatarRendererProps): JSX.Element { const { t } = useTranslation(); + const [isPictureValid, setIsPictureValid] = useState(true); const borderColor: string = borderColorPicker(isDonating, isTopContributor); + const onImageLoad = () => setIsPictureValid(true); + const onImageError = () => setIsPictureValid(false); + + useEffect(() => { + const validationImage = document.createElement('img'); + validationImage.src = picture; + validationImage.onload = onImageLoad; + validationImage.onerror = onImageError; + }, [picture]); + const isPlaceHolderImage = - /example.com|identicon.org/.test(picture) || picture === defaultUserImage; + !isPictureValid || + /example.com|identicon.org/.test(picture) || + picture === defaultUserImage; return (
          From 32fac23a2da945104ec3109159e4728be6128fe9 Mon Sep 17 00:00:00 2001 From: gikf <60067306+gikf@users.noreply.github.com> Date: Mon, 12 Jul 2021 16:19:03 +0200 Subject: [PATCH 163/344] fix(curriculum): clean-up Project Euler 161-180 (#42782) * fix: clean-up Project Euler 161-180 * fix: corrections from review Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> --- .../project-euler/problem-161-triominoes.md | 14 +++++-- .../problem-162-hexadecimal-numbers.md | 22 ++++++---- .../problem-163-cross-hatched-triangles.md | 23 ++++++++--- ...s-have-a-sum-greater-than-a-given-value.md | 10 ++--- .../problem-165-intersections.md | 40 ++++++++++++++----- .../project-euler/problem-166-criss-cross.md | 19 +++++---- ...roblem-167-investigating-ulam-sequences.md | 20 +++++----- .../problem-168-number-rotations.md | 12 +++--- ...an-be-expressed-as-a-sum-of-powers-of-2.md | 28 ++++++------- ...can-be-formed-by-concatenating-products.md | 15 ++++--- ...f-the-squares-of-the-digits-is-a-square.md | 22 +++++----- ...gating-numbers-with-few-repeated-digits.md | 10 ++--- ...ent-hollow-square-laminae-can-be-formed.md | 10 +++-- ...one-two-three-...-distinct-arrangements.md | 16 +++++--- ...an-be-expressed-as-a-sum-of-powers-of-2.md | 32 +++++++++++---- ...-angled-triangles-that-share-a-cathetus.md | 8 ++-- ...oblem-177-integer-angled-quadrilaterals.md | 18 ++++++--- .../project-euler/problem-178-step-numbers.md | 10 ++--- ...oblem-179-consecutive-positive-divisors.md | 10 ++--- ...-zeros-of-a-function-of-three-variables.md | 30 ++++++++------ 20 files changed, 230 insertions(+), 139 deletions(-) diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-161-triominoes.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-161-triominoes.md index ea369bae60..3c645846a9 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-161-triominoes.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-161-triominoes.md @@ -12,18 +12,24 @@ A triomino is a shape consisting of three squares joined via the edges. There are two basic forms: +two basic triominoes forms + If all possible orientations are taken into account there are six: +triominoes forms including orientation + Any n by m grid for which nxm is divisible by 3 can be tiled with triominoes. If we consider tilings that can be obtained by reflection or rotation from another tiling as different there are 41 ways a 2 by 9 grid can be tiled with triominoes: +animation showing 41 ways of filling 2x9 grid with triominoes + In how many ways can a 9 by 12 grid be tiled in this way by triominoes? # --hints-- -`euler161()` should return 20574308184277972. +`triominoes()` should return `20574308184277972`. ```js -assert.strictEqual(euler161(), 20574308184277972); +assert.strictEqual(triominoes(), 20574308184277972); ``` # --seed-- @@ -31,12 +37,12 @@ assert.strictEqual(euler161(), 20574308184277972); ## --seed-contents-- ```js -function euler161() { +function triominoes() { return true; } -euler161(); +triominoes(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-162-hexadecimal-numbers.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-162-hexadecimal-numbers.md index 53a6bcd772..8b63fdc2ab 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-162-hexadecimal-numbers.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-162-hexadecimal-numbers.md @@ -10,9 +10,9 @@ dashedName: problem-162-hexadecimal-numbers In the hexadecimal number system numbers are represented using 16 different digits: -0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F +$$0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F$$ -The hexadecimal number AF when written in the decimal number system equals 10x16+15=175. +The hexadecimal number AF when written in the decimal number system equals $10 \times 16 + 15 = 175$. In the 3-digit hexadecimal numbers 10A, 1A0, A10, and A01 the digits 0,1 and A are all present. @@ -20,16 +20,22 @@ Like numbers written in base ten we write hexadecimal numbers without leading ze How many hexadecimal numbers containing at most sixteen hexadecimal digits exist with all of the digits 0,1, and A present at least once? -Give your answer as a hexadecimal number. +Give your answer with hexadecimal number as a string. -(A,B,C,D,E and F in upper case, without any leading or trailing code that marks the number as hexadecimal and without leading zeroes , e.g. 1A3F and not: 1a3f and not 0x1a3f and not $1A3F and not #1A3F and not 0000001A3F) +**Note:** (A,B,C,D,E and F in upper case, without any leading or trailing code that marks the number as hexadecimal and without leading zeroes , e.g. 1A3F and not: 1a3f and not 0x1a3f and not $1A3F and not #1A3F and not 0000001A3F) # --hints-- -`euler162()` should return 3D58725572C62302. +`hexadecimalNumbers()` should return a string. ```js -assert.strictEqual(euler162(), '3D58725572C62302'); +assert(typeof hexadecimalNumbers() === 'string'); +``` + +`hexadecimalNumbers()` should return the string `3D58725572C62302`. + +```js +assert.strictEqual(hexadecimalNumbers(), '3D58725572C62302'); ``` # --seed-- @@ -37,12 +43,12 @@ assert.strictEqual(euler162(), '3D58725572C62302'); ## --seed-contents-- ```js -function euler162() { +function hexadecimalNumbers() { return true; } -euler162(); +hexadecimalNumbers(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-163-cross-hatched-triangles.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-163-cross-hatched-triangles.md index 72ed1158b1..1bd17c7351 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-163-cross-hatched-triangles.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-163-cross-hatched-triangles.md @@ -10,14 +10,27 @@ dashedName: problem-163-cross-hatched-triangles Consider an equilateral triangle in which straight lines are drawn from each vertex to the middle of the opposite side, such as in the size 1 triangle in the sketch below. -Sixteen triangles of either different shape or size or orientation or location can now be observed in that triangle. Using size 1 triangles as building blocks, larger triangles can be formed, such as the size 2 triangle in the above sketch. One-hundred and four triangles of either different shape or size or orientation or location can now be observed in that size 2 triangle. It can be observed that the size 2 triangle contains 4 size 1 triangle building blocks. A size 3 triangle would contain 9 size 1 triangle building blocks and a size n triangle would thus contain n2 size 1 triangle building blocks. If we denote T(n) as the number of triangles present in a triangle of size n, then T(1) = 16 T(2) = 104 Find T(36). +triangles with size 1 and size 2 + +Sixteen triangles of either different shape or size or orientation or location can now be observed in that triangle. Using size 1 triangles as building blocks, larger triangles can be formed, such as the size 2 triangle in the above sketch. One-hundred and four triangles of either different shape or size or orientation or location can now be observed in that size 2 triangle. + +It can be observed that the size 2 triangle contains 4 size 1 triangle building blocks. A size 3 triangle would contain 9 size 1 triangle building blocks and a size $n$ triangle would thus contain $n^2$ size 1 triangle building blocks. + +If we denote $T(n)$ as the number of triangles present in a triangle of size $n$, then + +$$\begin{align} + & T(1) = 16 \\\\ + & T(2) = 104 +\end{align}$$ + +Find $T(36)$. # --hints-- -`euler163()` should return 343047. +`crossHatchedTriangles()` should return `343047`. ```js -assert.strictEqual(euler163(), 343047); +assert.strictEqual(crossHatchedTriangles(), 343047); ``` # --seed-- @@ -25,12 +38,12 @@ assert.strictEqual(euler163(), 343047); ## --seed-contents-- ```js -function euler163() { +function crossHatchedTriangles() { return true; } -euler163(); +crossHatchedTriangles(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value.md index e511646823..18a4bc8bad 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value.md @@ -11,14 +11,14 @@ dashedName: >- # --description-- -How many 20 digit numbers n (without any leading zero) exist such that no three consecutive digits of n have a sum greater than 9? +How many 20 digit numbers $n$ (without any leading zero) exist such that no three consecutive digits of $n$ have a sum greater than 9? # --hints-- -`euler164()` should return 378158756814587. +`consecutiveDigitsSum()` should return `378158756814587`. ```js -assert.strictEqual(euler164(), 378158756814587); +assert.strictEqual(consecutiveDigitsSum(), 378158756814587); ``` # --seed-- @@ -26,12 +26,12 @@ assert.strictEqual(euler164(), 378158756814587); ## --seed-contents-- ```js -function euler164() { +function consecutiveDigitsSum() { return true; } -euler164(); +consecutiveDigitsSum(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-165-intersections.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-165-intersections.md index a98373c338..9a25a1588c 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-165-intersections.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-165-intersections.md @@ -8,22 +8,44 @@ dashedName: problem-165-intersections # --description-- -A segment is uniquely defined by its two endpoints. By considering two line segments in plane geometry there are three possibilities: - -the segments have zero points, one point, or infinitely many points in common. +A segment is uniquely defined by its two endpoints. By considering two line segments in plane geometry there are three possibilities: the segments have zero points, one point, or infinitely many points in common. Moreover when two segments have exactly one point in common it might be the case that that common point is an endpoint of either one of the segments or of both. If a common point of two segments is not an endpoint of either of the segments it is an interior point of both segments. -We will call a common point T of two segments L1 and L2 a true intersection point of L1 and L2 if T is the only common point of L1 and L2 and T is an interior point of both segments. +We will call a common point $T$ of two segments $L_1$ and $L_2$ a true intersection point of $L_1$ and $L_2$ if $T$ is the only common point of $L_1$ and $L_2$ and $T$ is an interior point of both segments. -Consider the three segments L1, L2, and L3: L1: (27, 44) to (12, 32) L2: (46, 53) to (17, 62) L3: (46, 70) to (22, 40) It can be verified that line segments L2 and L3 have a true intersection point. We note that as the one of the end points of L3: (22,40) lies on L1 this is not considered to be a true point of intersection. L1 and L2 have no common point. So among the three line segments, we find one true intersection point. Now let us do the same for 5000 line segments. To this end, we generate 20000 numbers using the so-called "Blum Blum Shub" pseudo-random number generator. s0 = 290797 sn+1 = sn×sn (modulo 50515093) tn = sn (modulo 500) To create each line segment, we use four consecutive numbers tn. That is, the first line segment is given by: (t1, t2) to (t3, t4) The first four numbers computed according to the above generator should be: 27, 144, 12 and 232. The first segment would thus be (27,144) to (12,232). How many distinct true intersection points are found among the 5000 line segments? +Consider the three segments $L_1$, $L_2$, and $L_3$: + +$$\begin{align} + & L_1: (27, 44) \\;\text{to}\\; (12, 32) \\\\ + & L_2: (46, 53) \\;\text{to}\\; (17, 62) \\\\ + & L_3: (46, 70) \\;\text{to}\\; (22, 40) \\\\ +\end{align}$$ + +It can be verified that line segments $L_2$ and $L_3$ have a true intersection point. We note that as the one of the end points of $L_3$: (22, 40) lies on $L_1$ this is not considered to be a true point of intersection. $L_1$ and $L_2$ have no common point. So among the three line segments, we find one true intersection point. + +Now let us do the same for 5000 line segments. To this end, we generate 20000 numbers using the so-called "Blum Blum Shub" pseudo-random number generator. + +$$\begin{align} + & s_0 = 290797 \\\\ + & s_{n + 1} = s_n × s_n (\text{modulo}\\; 50515093) \\\\ + & t_n = s_n (\text{modulo}\\; 500) \\\\ +\end{align}$$ + +To create each line segment, we use four consecutive numbers $t_n$. That is, the first line segment is given by: + +($_t$1, $t_2$) to ($t_3$, $t_4$) + +The first four numbers computed according to the above generator should be: 27, 144, 12 and 232. The first segment would thus be (27, 144) to (12, 232). + +How many distinct true intersection points are found among the 5000 line segments? # --hints-- -`euler165()` should return 2868868. +`distinctIntersections()` should return `2868868`. ```js -assert.strictEqual(euler165(), 2868868); +assert.strictEqual(distinctIntersections(), 2868868); ``` # --seed-- @@ -31,12 +53,12 @@ assert.strictEqual(euler165(), 2868868); ## --seed-contents-- ```js -function euler165() { +function distinctIntersections() { return true; } -euler165(); +distinctIntersections(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-166-criss-cross.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-166-criss-cross.md index 9f1db5cea4..dfb3821789 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-166-criss-cross.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-166-criss-cross.md @@ -8,22 +8,27 @@ dashedName: problem-166-criss-cross # --description-- -A 4x4 grid is filled with digits d, 0 ≤ d ≤ 9. +A 4x4 grid is filled with digits $d$, $0 ≤ d ≤ 9$. It can be seen that in the grid -6 3 3 0 5 0 4 3 0 7 1 4 1 2 4 5 +$$\begin{array}{} + 6 & 3 & 3 & 0 \\\\ + 5 & 0 & 4 & 3 \\\\ + 0 & 7 & 1 & 4 \\\\ + 1 & 2 & 4 & 5 +\end{array}$$ the sum of each row and each column has the value 12. Moreover the sum of each diagonal is also 12. -In how many ways can you fill a 4x4 grid with the digits d, 0 ≤ d ≤ 9 so that each row, each column, and both diagonals have the same sum? +In how many ways can you fill a 4x4 grid with the digits $d$, $0 ≤ d ≤ 9$ so that each row, each column, and both diagonals have the same sum? # --hints-- -`euler166()` should return 7130034. +`crissCross()` should return `7130034`. ```js -assert.strictEqual(euler166(), 7130034); +assert.strictEqual(crissCross(), 7130034); ``` # --seed-- @@ -31,12 +36,12 @@ assert.strictEqual(euler166(), 7130034); ## --seed-contents-- ```js -function euler166() { +function crissCross() { return true; } -euler166(); +crissCross(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-167-investigating-ulam-sequences.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-167-investigating-ulam-sequences.md index 6f30b4b272..6e2b3c1b4d 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-167-investigating-ulam-sequences.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-167-investigating-ulam-sequences.md @@ -8,24 +8,22 @@ dashedName: problem-167-investigating-ulam-sequences # --description-- -For two positive integers a and b, the Ulam sequence U(a,b) is defined by U(a,b)1 = a, U(a,b)2 = b and for k > 2, +For two positive integers $a$ and $b$, the Ulam sequence $U(a,b)$ is defined by ${U{(a,b)}\_1} = a$, ${U{(a,b)}\_2} = b$ and for $k > 2$, ${U{(a,b)}\_k}$ is the smallest integer greater than ${U{(a,b)}\_{(k-1)}}$ which can be written in exactly one way as the sum of two distinct previous members of $U(a,b)$. -U(a,b)k is the smallest integer greater than U(a,b)(k-1) which can be written in exactly one way as the sum of two distinct previous members of U(a,b). +For example, the sequence $U(1,2)$ begins with -For example, the sequence U(1,2) begins with +$$1, 2, 3 = 1 + 2, 4 = 1 + 3, 6 = 2 + 4, 8 = 2 + 6, 11 = 3 + 8$$ -1, 2, 3 = 1 + 2, 4 = 1 + 3, 6 = 2 + 4, 8 = 2 + 6, 11 = 3 + 8; +5 does not belong to it because $5 = 1 + 4 = 2 + 3$ has two representations as the sum of two previous members, likewise $7 = 1 + 6 = 3 + 4$. -5 does not belong to it because 5 = 1 + 4 = 2 + 3 has two representations as the sum of two previous members, likewise 7 = 1 + 6 = 3 + 4. - -Find ∑U(2,2n+1)k for 2 ≤ n ≤10, where k = 1011. +Find $\sum {U(2, 2n + 1)_k}$ for $2 ≤ n ≤ 10$, where $k = {10}^{11}$. # --hints-- -`euler167()` should return 3916160068885. +`ulamSequences()` should return `3916160068885`. ```js -assert.strictEqual(euler167(), 3916160068885); +assert.strictEqual(ulamSequences(), 3916160068885); ``` # --seed-- @@ -33,12 +31,12 @@ assert.strictEqual(euler167(), 3916160068885); ## --seed-contents-- ```js -function euler167() { +function ulamSequences() { return true; } -euler167(); +ulamSequences(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-168-number-rotations.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-168-number-rotations.md index 9ad5f78e64..6f5c679ed3 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-168-number-rotations.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-168-number-rotations.md @@ -10,18 +10,18 @@ dashedName: problem-168-number-rotations Consider the number 142857. We can right-rotate this number by moving the last digit (7) to the front of it, giving us 714285. -It can be verified that 714285=5×142857. +It can be verified that $714285 = 5 × 142857$. This demonstrates an unusual property of 142857: it is a divisor of its right-rotation. -Find the last 5 digits of the sum of all integers n, 10 < n < 10100, that have this property. +Find the last 5 digits of the sum of all integers $n$, $10 < n < 10100$, that have this property. # --hints-- -`euler168()` should return 59206. +`numberRotations()` should return `59206`. ```js -assert.strictEqual(euler168(), 59206); +assert.strictEqual(numberRotations(), 59206); ``` # --seed-- @@ -29,12 +29,12 @@ assert.strictEqual(euler168(), 59206); ## --seed-contents-- ```js -function euler168() { +function numberRotations() { return true; } -euler168(); +numberRotations(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-169-exploring-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-169-exploring-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md index 0cfb0034f4..78f6895092 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-169-exploring-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-169-exploring-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md @@ -11,26 +11,26 @@ dashedName: >- # --description-- -Define f(0)=1 and f(n) to be the number of different ways n can be expressed as a sum of integer powers of 2 using each power no more than twice. +Define $f(0)=1$ and $f(n)$ to be the number of different ways $n$ can be expressed as a sum of integer powers of 2 using each power no more than twice. -For example, f(10)=5 since there are five different ways to express 10: +For example, $f(10)=5$ since there are five different ways to express 10: -1 + 1 + 8 +$$\begin{align} + & 1 + 1 + 8 \\\\ + & 1 + 1 + 4 + 4 \\\\ + & 1 + 1 + 2 + 2 + 4 \\\\ + & 2 + 4 + 4 \\\\ + & 2 + 8 +\end{align}$$ -1 + 1 + 4 + 41 + 1 + 2 + 2 + 4 - -2 + 4 + 4 - -2 + 8 - -What is f(1025)? +What is $f({10}^{25})$? # --hints-- -`euler169()` should return 178653872807. +`numberOfWaysToExpress()` should return `178653872807`. ```js -assert.strictEqual(euler169(), 178653872807); +assert.strictEqual(numberOfWaysToExpress(), 178653872807); ``` # --seed-- @@ -38,12 +38,12 @@ assert.strictEqual(euler169(), 178653872807); ## --seed-contents-- ```js -function euler169() { +function numberOfWaysToExpress() { return true; } -euler169(); +numberOfWaysToExpress(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-170-find-the-largest-0-to-9-pandigital-that-can-be-formed-by-concatenating-products.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-170-find-the-largest-0-to-9-pandigital-that-can-be-formed-by-concatenating-products.md index f12d0490f2..6cce571bac 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-170-find-the-largest-0-to-9-pandigital-that-can-be-formed-by-concatenating-products.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-170-find-the-largest-0-to-9-pandigital-that-can-be-formed-by-concatenating-products.md @@ -13,9 +13,12 @@ dashedName: >- Take the number 6 and multiply it by each of 1273 and 9854: -6 × 1273 = 7638 6 × 9854 = 59124 +$$\begin{align} + & 6 × 1273 = 7638 \\\\ + & 6 × 9854 = 59124 \\\\ +\end{align}$$ -By concatenating these products we get the 1 to 9 pandigital 763859124. We will call 763859124 the "concatenated product of 6 and (1273,9854)". Notice too, that the concatenation of the input numbers, 612739854, is also 1 to 9 pandigital. +By concatenating these products we get the 1 to 9 pandigital 763859124. We will call 763859124 the "concatenated product of 6 and (1273, 9854)". Notice too, that the concatenation of the input numbers, 612739854, is also 1 to 9 pandigital. The same can be done for 0 to 9 pandigital numbers. @@ -23,10 +26,10 @@ What is the largest 0 to 9 pandigital 10-digit concatenated product of an intege # --hints-- -`euler170()` should return 9857164023. +`largestPandigital()` should return `9857164023`. ```js -assert.strictEqual(euler170(), 9857164023); +assert.strictEqual(largestPandigital(), 9857164023); ``` # --seed-- @@ -34,12 +37,12 @@ assert.strictEqual(euler170(), 9857164023); ## --seed-contents-- ```js -function euler170() { +function largestPandigital() { return true; } -euler170(); +largestPandigital(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square.md index d03ddf909b..e4658cd2b7 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square.md @@ -11,22 +11,22 @@ dashedName: >- # --description-- -For a positive integer n, let f(n) be the sum of the squares of the digits (in base 10) of n, e.g. +For a positive integer $n$, let $f(n)$ be the sum of the squares of the digits (in base 10) of $n$, e.g. -f(3) = 32 = 9, +$$\begin{align} + & f(3) = 3^2 = 9 \\\\ + & f(25) = 2^2 + 5^2 = 4 + 25 = 29 \\\\ + & f(442) = 4^2 + 4^2 + 2^2 = 16 + 16 + 4 = 36 \\\\ +\end{align}$$ -f(25) = 22 + 52 = 4 + 25 = 29, - -f(442) = 42 + 42 + 22 = 16 + 16 + 4 = 36 - -Find the last nine digits of the sum of all n, 0 < n < 1020, such that f(n) is a perfect square. +Find the last nine digits of the sum of all $n$, $0 < n < {10}^{20}$, such that $f(n)$ is a perfect square. # --hints-- -`euler171()` should return 142989277. +`lastDigitsSumOfPerfectSquare()` should return `142989277`. ```js -assert.strictEqual(euler171(), 142989277); +assert.strictEqual(lastDigitsSumOfPerfectSquare(), 142989277); ``` # --seed-- @@ -34,12 +34,12 @@ assert.strictEqual(euler171(), 142989277); ## --seed-contents-- ```js -function euler171() { +function lastDigitsSumOfPerfectSquare() { return true; } -euler171(); +lastDigitsSumOfPerfectSquare(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-172-investigating-numbers-with-few-repeated-digits.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-172-investigating-numbers-with-few-repeated-digits.md index a25ab3224f..0ad7b86f36 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-172-investigating-numbers-with-few-repeated-digits.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-172-investigating-numbers-with-few-repeated-digits.md @@ -8,14 +8,14 @@ dashedName: problem-172-investigating-numbers-with-few-repeated-digits # --description-- -How many 18-digit numbers n (without leading zeros) are there such that no digit occurs more than three times in n? +How many 18-digit numbers $n$ (without leading zeros) are there such that no digit occurs more than three times in $n$? # --hints-- -`euler172()` should return 227485267000992000. +`numbersWithRepeatedDigits()` should return `227485267000992000`. ```js -assert.strictEqual(euler172(), 227485267000992000); +assert.strictEqual(numbersWithRepeatedDigits(), 227485267000992000); ``` # --seed-- @@ -23,12 +23,12 @@ assert.strictEqual(euler172(), 227485267000992000); ## --seed-contents-- ```js -function euler172() { +function numbersWithRepeatedDigits() { return true; } -euler172(); +numbersWithRepeatedDigits(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-173-using-up-to-one-million-tiles-how-many-different-hollow-square-laminae-can-be-formed.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-173-using-up-to-one-million-tiles-how-many-different-hollow-square-laminae-can-be-formed.md index a07789fd1d..5d49c3b9fa 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-173-using-up-to-one-million-tiles-how-many-different-hollow-square-laminae-can-be-formed.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-173-using-up-to-one-million-tiles-how-many-different-hollow-square-laminae-can-be-formed.md @@ -13,14 +13,16 @@ dashedName: >- We shall define a square lamina to be a square outline with a square "hole" so that the shape possesses vertical and horizontal symmetry. For example, using exactly thirty-two square tiles we can form two different square laminae: +two square lamina with holes 2x2 and 7x7 + With one-hundred tiles, and not necessarily using all of the tiles at one time, it is possible to form forty-one different square laminae. Using up to one million tiles how many different square laminae can be formed? # --hints-- -`euler173()` should return 1572729. +`differentHollowSquareLaminae()` should return `1572729`. ```js -assert.strictEqual(euler173(), 1572729); +assert.strictEqual(differentHollowSquareLaminae(), 1572729); ``` # --seed-- @@ -28,12 +30,12 @@ assert.strictEqual(euler173(), 1572729); ## --seed-contents-- ```js -function euler173() { +function differentHollowSquareLaminae() { return true; } -euler173(); +differentHollowSquareLaminae(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-174-counting-the-number-of-hollow-square-laminae-that-can-form-one-two-three-...-distinct-arrangements.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-174-counting-the-number-of-hollow-square-laminae-that-can-form-one-two-three-...-distinct-arrangements.md index e7183612d5..ff7276377f 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-174-counting-the-number-of-hollow-square-laminae-that-can-form-one-two-three-...-distinct-arrangements.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-174-counting-the-number-of-hollow-square-laminae-that-can-form-one-two-three-...-distinct-arrangements.md @@ -15,14 +15,20 @@ We shall define a square lamina to be a square outline with a square "hole" so t Given eight tiles it is possible to form a lamina in only one way: 3x3 square with a 1x1 hole in the middle. However, using thirty-two tiles it is possible to form two distinct laminae. -If t represents the number of tiles used, we shall say that t = 8 is type L(1) and t = 32 is type L(2). Let N(n) be the number of t ≤ 1000000 such that t is type L(n); for example, N(15) = 832. What is ∑ N(n) for 1 ≤ n ≤ 10? +two square lamina with holes 2x2 and 7x7 + +If $t$ represents the number of tiles used, we shall say that $t = 8$ is type $L(1)$ and $t = 32$ is type $L(2)$. + +Let $N(n)$ be the number of $t ≤ 1000000$ such that $t$ is type $L(n)$; for example, $N(15) = 832$. + +What is $\sum N(n)$ for $1 ≤ n ≤ 10$? # --hints-- -`euler174()` should return 209566. +`hollowSquareLaminaeDistinctArrangements()` should return `209566`. ```js -assert.strictEqual(euler174(), 209566); +assert.strictEqual(hollowSquareLaminaeDistinctArrangements(), 209566); ``` # --seed-- @@ -30,12 +36,12 @@ assert.strictEqual(euler174(), 209566); ## --seed-contents-- ```js -function euler174() { +function hollowSquareLaminaeDistinctArrangements() { return true; } -euler174(); +hollowSquareLaminaeDistinctArrangements(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-175-fractions-involving-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-175-fractions-involving-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md index 8f32fcb4bd..20907644d9 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-175-fractions-involving-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-175-fractions-involving-the-number-of-different-ways-a-number-can-be-expressed-as-a-sum-of-powers-of-2.md @@ -11,18 +11,36 @@ dashedName: >- # --description-- -Define f(0)=1 and f(n) to be the number of ways to write n as a sum of powers of 2 where no power occurs more than twice. +Define $f(0) = 1$ and $f(n)$ to be the number of ways to write $n$ as a sum of powers of 2 where no power occurs more than twice. -For example, f(10)=5 since there are five different ways to express 10:10 = 8+2 = 8+1+1 = 4+4+2 = 4+2+2+1+1 = 4+4+1+1 +For example, $f(10) = 5$ since there are five different ways to express 10: -It can be shown that for every fraction p/q (p>0, q>0) there exists at least one integer n such that f(n)/f(n-1)=p/q. For instance, the smallest n for which f(n)/f(n-1)=13/17 is 241. The binary expansion of 241 is 11110001. Reading this binary number from the most significant bit to the least significant bit there are 4 one's, 3 zeroes and 1 one. We shall call the string 4,3,1 the Shortened Binary Expansion of 241. Find the Shortened Binary Expansion of the smallest n for which f(n)/f(n-1)=123456789/987654321. Give your answer as comma separated integers, without any whitespaces. +$$10 = 8 + 2 = 8 + 1 + 1 = 4 + 4 + 2 = 4 + 2 + 2 + 1 + 1 = 4 + 4 + 1 + 1$$ + +It can be shown that for every fraction $\frac{p}{q}\\; (p>0, q>0)$ there exists at least one integer $n$ such that $\frac{f(n)}{f(n - 1)} = \frac{p}{q}$. + +For instance, the smallest $n$ for which $\frac{f(n)}{f(n - 1)} = \frac{13}{17}$ is 241. The binary expansion of 241 is 11110001. + +Reading this binary number from the most significant bit to the least significant bit there are 4 one's, 3 zeroes and 1 one. We shall call the string 4,3,1 the Shortened Binary Expansion of 241. + +Find the Shortened Binary Expansion of the smallest $n$ for which + +$$\frac{f(n)}{f(n - 1)} = \frac{123456789}{987654321}$$ + +Give your answer as a string with comma separated integers, without any whitespaces. # --hints-- -`euler175()` should return 1, 13717420, 8. +`shortenedBinaryExpansionOfNumber()` should return a string. ```js -assert.strictEqual(euler175(), 1, 13717420, 8); +assert(typeof shortenedBinaryExpansionOfNumber() === 'string'); +``` + +`shortenedBinaryExpansionOfNumber()` should return the string `1,13717420,8`. + +```js +assert.strictEqual(shortenedBinaryExpansionOfNumber(), '1,13717420,8'); ``` # --seed-- @@ -30,12 +48,12 @@ assert.strictEqual(euler175(), 1, 13717420, 8); ## --seed-contents-- ```js -function euler175() { +function shortenedBinaryExpansionOfNumber() { return true; } -euler175(); +shortenedBinaryExpansionOfNumber(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-176-right-angled-triangles-that-share-a-cathetus.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-176-right-angled-triangles-that-share-a-cathetus.md index c3b6c090fe..d5e7b34ad6 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-176-right-angled-triangles-that-share-a-cathetus.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-176-right-angled-triangles-that-share-a-cathetus.md @@ -14,10 +14,10 @@ Find the smallest integer that can be the length of a cathetus of exactly 47547 # --hints-- -`euler176()` should return 96818198400000. +`trianglesSharingCathetus()` should return `96818198400000`. ```js -assert.strictEqual(euler176(), 96818198400000); +assert.strictEqual(trianglesSharingCathetus(), 96818198400000); ``` # --seed-- @@ -25,12 +25,12 @@ assert.strictEqual(euler176(), 96818198400000); ## --seed-contents-- ```js -function euler176() { +function trianglesSharingCathetus() { return true; } -euler176(); +trianglesSharingCathetus(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-177-integer-angled-quadrilaterals.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-177-integer-angled-quadrilaterals.md index 2e39114654..686ddad5cd 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-177-integer-angled-quadrilaterals.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-177-integer-angled-quadrilaterals.md @@ -10,14 +10,22 @@ dashedName: problem-177-integer-angled-quadrilaterals Let ABCD be a convex quadrilateral, with diagonals AC and BD. At each vertex the diagonal makes an angle with each of the two sides, creating eight corner angles. -For example, at vertex A, the two angles are CAD, CAB. We call such a quadrilateral for which all eight corner angles have integer values when measured in degrees an "integer angled quadrilateral". An example of an integer angled quadrilateral is a square, where all eight corner angles are 45°. Another example is given by DAC = 20°, BAC = 60°, ABD = 50°, CBD = 30°, BCA = 40°, DCA = 30°, CDB = 80°, ADB = 50°. What is the total number of non-similar integer angled quadrilaterals? Note: In your calculations you may assume that a calculated angle is integral if it is within a tolerance of 10-9 of an integer value. +convex quadrilateral ABCD, with diagonals AC and BD + +For example, at vertex A, the two angles are CAD, CAB. + +We call such a quadrilateral for which all eight corner angles have integer values when measured in degrees an "integer angled quadrilateral". An example of an integer angled quadrilateral is a square, where all eight corner angles are 45°. Another example is given by DAC = 20°, BAC = 60°, ABD = 50°, CBD = 30°, BCA = 40°, DCA = 30°, CDB = 80°, ADB = 50°. + +What is the total number of non-similar integer angled quadrilaterals? + +**Note:** In your calculations you may assume that a calculated angle is integral if it is within a tolerance of ${10}^{-9}$ of an integer value. # --hints-- -`euler177()` should return 129325. +`integerAngledQuadrilaterals()` should return `129325`. ```js -assert.strictEqual(euler177(), 129325); +assert.strictEqual(integerAngledQuadrilaterals(), 129325); ``` # --seed-- @@ -25,12 +33,12 @@ assert.strictEqual(euler177(), 129325); ## --seed-contents-- ```js -function euler177() { +function integerAngledQuadrilaterals() { return true; } -euler177(); +integerAngledQuadrilaterals(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-178-step-numbers.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-178-step-numbers.md index 12bad9c5ad..e9ea0adc66 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-178-step-numbers.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-178-step-numbers.md @@ -16,14 +16,14 @@ A number for which every pair of consecutive digits has a difference of one is c A pandigital number contains every decimal digit from 0 to 9 at least once. -How many pandigital step numbers less than 1040 are there? +How many pandigital step numbers less than ${10}^{40}$ are there? # --hints-- -`euler178()` should return 126461847755. +`stepNumbers()` should return `126461847755`. ```js -assert.strictEqual(euler178(), 126461847755); +assert.strictEqual(stepNumbers(), 126461847755); ``` # --seed-- @@ -31,12 +31,12 @@ assert.strictEqual(euler178(), 126461847755); ## --seed-contents-- ```js -function euler178() { +function stepNumbers() { return true; } -euler178(); +stepNumbers(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-179-consecutive-positive-divisors.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-179-consecutive-positive-divisors.md index 1811def962..9245393058 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-179-consecutive-positive-divisors.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-179-consecutive-positive-divisors.md @@ -8,14 +8,14 @@ dashedName: problem-179-consecutive-positive-divisors # --description-- -Find the number of integers 1 < n < 107, for which n and n + 1 have the same number of positive divisors. For example, 14 has the positive divisors 1, 2, 7, 14 while 15 has 1, 3, 5, 15. +Find the number of integers $1 < n < {10}^7$, for which $n$ and $n + 1$ have the same number of positive divisors. For example, 14 has the positive divisors 1, 2, 7, 14 while 15 has 1, 3, 5, 15. # --hints-- -`euler179()` should return 986262. +`consecutivePositiveDivisors()` should return `986262`. ```js -assert.strictEqual(euler179(), 986262); +assert.strictEqual(consecutivePositiveDivisors(), 986262); ``` # --seed-- @@ -23,12 +23,12 @@ assert.strictEqual(euler179(), 986262); ## --seed-contents-- ```js -function euler179() { +function consecutivePositiveDivisors() { return true; } -euler179(); +consecutivePositiveDivisors(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-180-rational-zeros-of-a-function-of-three-variables.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-180-rational-zeros-of-a-function-of-three-variables.md index 3b46677319..e1b5202106 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-180-rational-zeros-of-a-function-of-three-variables.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-180-rational-zeros-of-a-function-of-three-variables.md @@ -8,30 +8,34 @@ dashedName: problem-180-rational-zeros-of-a-function-of-three-variables # --description-- -For any integer n, consider the three functions +For any integer $n$, consider the three functions -f1,n(x,y,z) = xn+1 + yn+1 − zn+1f2,n(x,y,z) = (xy + yz + zx)\*(xn-1 + yn-1 − zn-1)f3,n(x,y,z) = xyz\*(xn-2 + yn-2 − zn-2) +$$\begin{align} + & f_{1,n}(x,y,z) = x^{n + 1} + y^{n + 1} − z^{n + 1}\\\\ + & f_{2,n}(x,y,z) = (xy + yz + zx) \times (x^{n - 1} + y^{n - 1} − z^{n - 1})\\\\ + & f_{3,n}(x,y,z) = xyz \times (x^{n - 2} + y^{n - 2} − z^{n - 2}) +\end{align}$$ and their combination -fn(x,y,z) = f1,n(x,y,z) + f2,n(x,y,z) − f3,n(x,y,z) +$$\begin{align} + & f_n(x,y,z) = f_{1,n}(x,y,z) + f_{2,n}(x,y,z) − f_{3,n}(x,y,z) +\end{align}$$ -We call (x,y,z) a golden triple of order k if x, y, and z are all rational numbers of the form a / b with +We call $(x,y,z)$ a golden triple of order $k$ if $x$, $y$, and $z$ are all rational numbers of the form $\frac{a}{b}$ with $0 < a < b ≤ k$ and there is (at least) one integer $n$, so that $f_n(x,y,z) = 0$. -0 < a < b ≤ k and there is (at least) one integer n, so that fn(x,y,z) = 0. +Let $s(x,y,z) = x + y + z$. -Let s(x,y,z) = x + y + z. +Let $t = \frac{u}{v}$ be the sum of all distinct $s(x,y,z)$ for all golden triples $(x,y,z)$ of order 35. All the $s(x,y,z)$ and $t$ must be in reduced form. -Let t = u / v be the sum of all distinct s(x,y,z) for all golden triples (x,y,z) of order 35. All the s(x,y,z) and t must be in reduced form. - -Find u + v. +Find $u + v$. # --hints-- -`euler180()` should return 285196020571078980. +`rationalZeros()` should return `285196020571078980`. ```js -assert.strictEqual(euler180(), 285196020571078980); +assert.strictEqual(rationalZeros(), 285196020571078980); ``` # --seed-- @@ -39,12 +43,12 @@ assert.strictEqual(euler180(), 285196020571078980); ## --seed-contents-- ```js -function euler180() { +function rationalZeros() { return true; } -euler180(); +rationalZeros(); ``` # --solutions-- From b89032206544d9aca4dbbe50303d26df82eacf36 Mon Sep 17 00:00:00 2001 From: camperbot Date: Mon, 12 Jul 2021 21:02:20 +0530 Subject: [PATCH 164/344] chore(i18n,docs): processed translations (#42830) --- docs/i18n/chinese/_sidebar.md | 54 +++++++++++++++++------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/docs/i18n/chinese/_sidebar.md b/docs/i18n/chinese/_sidebar.md index 65cb22f048..9f1cb43f46 100644 --- a/docs/i18n/chinese/_sidebar.md +++ b/docs/i18n/chinese/_sidebar.md @@ -1,34 +1,34 @@ -- **Getting Started** - - [Introduction](index.md "Contribute to the freeCodeCamp.org Community") - - [Frequently Asked Questions](FAQ.md) -- **Code Contribution** - - [Set up freeCodeCamp locally](how-to-setup-freecodecamp-locally.md) - - [Codebase best practices](codebase-best-practices.md) - - [Open a pull request](how-to-open-a-pull-request.md) - - [Work on coding challenges](how-to-work-on-coding-challenges.md) - - [Work on video challenges](how-to-help-with-video-challenges.md) - - [Work on the news theme](how-to-work-on-the-news-theme.md) - - [Work on the docs theme](how-to-work-on-the-docs-theme.md) - - [Work on practice projects](how-to-work-on-practice-projects.md) -- **Translation Contribution** - - [Work on translating resources](how-to-translate-files.md) - - [Work on proofreading translations](how-to-proofread-files.md) -- **Optional Guides** - - [Set up freeCodeCamp on Windows (WSL)](how-to-setup-wsl.md) - - [Add Cypress tests](how-to-add-cypress-tests.md) - - [Work on localized client web app](how-to-work-on-localized-client-webapp.md) - - [Catch outgoing emails locally](how-to-catch-outgoing-emails-locally.md) - - [Test translations locally](how-to-test-translations-locally.md) +- **准备开始** + - [介绍](index.md "为 freeCodeCamp.org 社区贡献") + - [常见问题](FAQ.md) +- **代码贡献** + - [如何在本地系统中设置 freeCodeCamp 的编码环境](how-to-setup-freecodecamp-locally.md) + - [代码库最佳实践](codebase-best-practices.md) + - [拉取请求](how-to-open-a-pull-request.md) + - [参与编程挑战贡献](how-to-work-on-coding-challenges.md) + - [参与视频挑战贡献](how-to-help-with-video-challenges.md) + - [参与专栏贡献](how-to-work-on-the-news-theme.md) + - [参与文档贡献](how-to-work-on-the-docs-theme.md) + - [参与练习项目贡献](how-to-work-on-practice-projects.md) +- **翻译贡献** + - [参与翻译贡献](how-to-translate-files.md) + - [参与校对贡献](how-to-proofread-files.md) +- **可选指南** + - [在 Windows 上运行 freeCodeCamp(WSL)](how-to-setup-wsl.md) + - [添加 Cypress 测试](how-to-add-cypress-tests.md) + - [在本地运行客户端 web app](how-to-work-on-localized-client-webapp.md) + - [本地接收电子邮件](how-to-catch-outgoing-emails-locally.md) + - [测试本地翻译](how-to-test-translations-locally.md) --- -- **Flight Manuals** (for Staff & Mods) - - [Moderator Handbook](moderator-handbook.md) - - [DevOps Handbook](devops.md) +- **飞行手册**(针对员工 & 维护人员) + - [维护人员手册](moderator-handbook.md) + - [DevOps 手册](devops.md) --- -- **Our Community** +- **我们的社区** - [**GitHub**](https://github.com/freecodecamp/freecodecamp) - - [**Discourse Forum**](https://freecodecamp.org/forum/c/contributors) - - [**Chat Server**](https://chat.freecodecamp.org/home) + - [**Discourse 论坛**](https://freecodecamp.org/forum/c/contributors) + - [**聊天室**](https://chat.freecodecamp.org/home) From d8262375fdb57fb4805bb954ac54b31d9997a6fb Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 12 Jul 2021 17:57:29 +0000 Subject: [PATCH 165/344] chore(deps): update dependency autoprefixer to v10.3.1 --- client/package-lock.json | 6 +++--- client/package.json | 2 +- tools/ui-components/package-lock.json | 6 +++--- tools/ui-components/package.json | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 17c44afc3a..59db6e1886 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -5260,9 +5260,9 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" }, "autoprefixer": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.3.0.tgz", - "integrity": "sha512-BzVzdjs47nT3MphTddr8eSsPVEIUCF96X6iC8V5iEB8RtxrU+ybtdhHV5rsqRqOsoyh/acQaYs7YupHPUECgmg==", + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.3.1.tgz", + "integrity": "sha512-L8AmtKzdiRyYg7BUXJTzigmhbQRCXFKz6SA1Lqo0+AR2FBbQ4aTAPFSDlOutnFkjhiz8my4agGXog1xlMjPJ6A==", "requires": { "browserslist": "^4.16.6", "caniuse-lite": "^1.0.30001243", diff --git a/client/package.json b/client/package.json index 4f019d7ea5..79eb9d1ad7 100644 --- a/client/package.json +++ b/client/package.json @@ -149,7 +149,7 @@ "@types/sanitize-html": "2.3.2", "@types/store": "2.0.2", "@types/validator": "13.6.3", - "autoprefixer": "10.3.0", + "autoprefixer": "10.3.1", "axios": "0.21.1", "babel-plugin-transform-imports": "2.0.0", "chokidar": "3.5.2", diff --git a/tools/ui-components/package-lock.json b/tools/ui-components/package-lock.json index 08078d57b0..dd71656bf0 100644 --- a/tools/ui-components/package-lock.json +++ b/tools/ui-components/package-lock.json @@ -8013,9 +8013,9 @@ "dev": true }, "autoprefixer": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.3.0.tgz", - "integrity": "sha512-BzVzdjs47nT3MphTddr8eSsPVEIUCF96X6iC8V5iEB8RtxrU+ybtdhHV5rsqRqOsoyh/acQaYs7YupHPUECgmg==", + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.3.1.tgz", + "integrity": "sha512-L8AmtKzdiRyYg7BUXJTzigmhbQRCXFKz6SA1Lqo0+AR2FBbQ4aTAPFSDlOutnFkjhiz8my4agGXog1xlMjPJ6A==", "dev": true, "requires": { "browserslist": "^4.16.6", diff --git a/tools/ui-components/package.json b/tools/ui-components/package.json index b59b8f1105..d9c3d66fbf 100644 --- a/tools/ui-components/package.json +++ b/tools/ui-components/package.json @@ -34,7 +34,7 @@ "@storybook/addon-postcss": "2.0.0", "@storybook/react": "6.3.4", "@testing-library/react": "12.0.0", - "autoprefixer": "10.3.0", + "autoprefixer": "10.3.1", "babel-loader": "8.2.2", "babel-plugin-transform-react-remove-prop-types": "0.4.24", "cross-env": "7.0.3", From 16078251e35c1f4864d7e1c67bf43ea33d9476a5 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 12 Jul 2021 18:52:47 +0000 Subject: [PATCH 166/344] chore(deps): update typescript-eslint monorepo to v4.28.3 --- package-lock.json | 102 +++++++++++++++++++++++----------------------- package.json | 4 +- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/package-lock.json b/package-lock.json index e1ed707c12..04f903d997 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8247,13 +8247,13 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.2.tgz", - "integrity": "sha512-PGqpLLzHSxq956rzNGasO3GsAPf2lY9lDUBXhS++SKonglUmJypaUtcKzRtUte8CV7nruwnDxtLUKpVxs0wQBw==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.3.tgz", + "integrity": "sha512-jW8sEFu1ZeaV8xzwsfi6Vgtty2jf7/lJmQmDkDruBjYAbx5DA8JtbcMnP0rNPUG+oH5GoQBTSp+9613BzuIpYg==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "4.28.2", - "@typescript-eslint/scope-manager": "4.28.2", + "@typescript-eslint/experimental-utils": "4.28.3", + "@typescript-eslint/scope-manager": "4.28.3", "debug": "^4.3.1", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.1.0", @@ -8262,43 +8262,43 @@ }, "dependencies": { "@typescript-eslint/experimental-utils": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.28.2.tgz", - "integrity": "sha512-MwHPsL6qo98RC55IoWWP8/opTykjTp4JzfPu1VfO2Z0MshNP0UZ1GEV5rYSSnZSUI8VD7iHvtIPVGW5Nfh7klQ==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.28.3.tgz", + "integrity": "sha512-zZYl9TnrxwEPi3FbyeX0ZnE8Hp7j3OCR+ELoUfbwGHGxWnHg9+OqSmkw2MoCVpZksPCZYpQzC559Ee9pJNHTQw==", "dev": true, "requires": { "@types/json-schema": "^7.0.7", - "@typescript-eslint/scope-manager": "4.28.2", - "@typescript-eslint/types": "4.28.2", - "@typescript-eslint/typescript-estree": "4.28.2", + "@typescript-eslint/scope-manager": "4.28.3", + "@typescript-eslint/types": "4.28.3", + "@typescript-eslint/typescript-estree": "4.28.3", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/scope-manager": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.28.2.tgz", - "integrity": "sha512-MqbypNjIkJFEFuOwPWNDjq0nqXAKZvDNNs9yNseoGBB1wYfz1G0WHC2AVOy4XD7di3KCcW3+nhZyN6zruqmp2A==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.28.3.tgz", + "integrity": "sha512-/8lMisZ5NGIzGtJB+QizQ5eX4Xd8uxedFfMBXOKuJGP0oaBBVEMbJVddQKDXyyB0bPlmt8i6bHV89KbwOelJiQ==", "dev": true, "requires": { - "@typescript-eslint/types": "4.28.2", - "@typescript-eslint/visitor-keys": "4.28.2" + "@typescript-eslint/types": "4.28.3", + "@typescript-eslint/visitor-keys": "4.28.3" } }, "@typescript-eslint/types": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.2.tgz", - "integrity": "sha512-Gr15fuQVd93uD9zzxbApz3wf7ua3yk4ZujABZlZhaxxKY8ojo448u7XTm/+ETpy0V0dlMtj6t4VdDvdc0JmUhA==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.3.tgz", + "integrity": "sha512-kQFaEsQBQVtA9VGVyciyTbIg7S3WoKHNuOp/UF5RG40900KtGqfoiETWD/v0lzRXc+euVE9NXmfer9dLkUJrkA==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.2.tgz", - "integrity": "sha512-86lLstLvK6QjNZjMoYUBMMsULFw0hPHJlk1fzhAVoNjDBuPVxiwvGuPQq3fsBMCxuDJwmX87tM/AXoadhHRljg==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.3.tgz", + "integrity": "sha512-YAb1JED41kJsqCQt1NcnX5ZdTA93vKFCMP4lQYG6CFxd0VzDJcKttRlMrlG+1qiWAw8+zowmHU1H0OzjWJzR2w==", "dev": true, "requires": { - "@typescript-eslint/types": "4.28.2", - "@typescript-eslint/visitor-keys": "4.28.2", + "@typescript-eslint/types": "4.28.3", + "@typescript-eslint/visitor-keys": "4.28.3", "debug": "^4.3.1", "globby": "^11.0.3", "is-glob": "^4.0.1", @@ -8307,12 +8307,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.2.tgz", - "integrity": "sha512-aT2B4PLyyRDUVUafXzpZFoc0C9t0za4BJAKP5sgWIhG+jHECQZUEjuQSCIwZdiJJ4w4cgu5r3Kh20SOdtEBl0w==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.3.tgz", + "integrity": "sha512-ri1OzcLnk1HH4gORmr1dllxDzzrN6goUIz/P4MHFV0YZJDCADPR3RvYNp0PW2SetKTThar6wlbFTL00hV2Q+fg==", "dev": true, "requires": { - "@typescript-eslint/types": "4.28.2", + "@typescript-eslint/types": "4.28.3", "eslint-visitor-keys": "^2.0.0" } }, @@ -8409,41 +8409,41 @@ } }, "@typescript-eslint/parser": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.28.2.tgz", - "integrity": "sha512-Q0gSCN51eikAgFGY+gnd5p9bhhCUAl0ERMiDKrTzpSoMYRubdB8MJrTTR/BBii8z+iFwz8oihxd0RAdP4l8w8w==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.28.3.tgz", + "integrity": "sha512-ZyWEn34bJexn/JNYvLQab0Mo5e+qqQNhknxmc8azgNd4XqspVYR5oHq9O11fLwdZMRcj4by15ghSlIEq+H5ltQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "4.28.2", - "@typescript-eslint/types": "4.28.2", - "@typescript-eslint/typescript-estree": "4.28.2", + "@typescript-eslint/scope-manager": "4.28.3", + "@typescript-eslint/types": "4.28.3", + "@typescript-eslint/typescript-estree": "4.28.3", "debug": "^4.3.1" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.28.2.tgz", - "integrity": "sha512-MqbypNjIkJFEFuOwPWNDjq0nqXAKZvDNNs9yNseoGBB1wYfz1G0WHC2AVOy4XD7di3KCcW3+nhZyN6zruqmp2A==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.28.3.tgz", + "integrity": "sha512-/8lMisZ5NGIzGtJB+QizQ5eX4Xd8uxedFfMBXOKuJGP0oaBBVEMbJVddQKDXyyB0bPlmt8i6bHV89KbwOelJiQ==", "dev": true, "requires": { - "@typescript-eslint/types": "4.28.2", - "@typescript-eslint/visitor-keys": "4.28.2" + "@typescript-eslint/types": "4.28.3", + "@typescript-eslint/visitor-keys": "4.28.3" } }, "@typescript-eslint/types": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.2.tgz", - "integrity": "sha512-Gr15fuQVd93uD9zzxbApz3wf7ua3yk4ZujABZlZhaxxKY8ojo448u7XTm/+ETpy0V0dlMtj6t4VdDvdc0JmUhA==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.3.tgz", + "integrity": "sha512-kQFaEsQBQVtA9VGVyciyTbIg7S3WoKHNuOp/UF5RG40900KtGqfoiETWD/v0lzRXc+euVE9NXmfer9dLkUJrkA==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.2.tgz", - "integrity": "sha512-86lLstLvK6QjNZjMoYUBMMsULFw0hPHJlk1fzhAVoNjDBuPVxiwvGuPQq3fsBMCxuDJwmX87tM/AXoadhHRljg==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.3.tgz", + "integrity": "sha512-YAb1JED41kJsqCQt1NcnX5ZdTA93vKFCMP4lQYG6CFxd0VzDJcKttRlMrlG+1qiWAw8+zowmHU1H0OzjWJzR2w==", "dev": true, "requires": { - "@typescript-eslint/types": "4.28.2", - "@typescript-eslint/visitor-keys": "4.28.2", + "@typescript-eslint/types": "4.28.3", + "@typescript-eslint/visitor-keys": "4.28.3", "debug": "^4.3.1", "globby": "^11.0.3", "is-glob": "^4.0.1", @@ -8452,12 +8452,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.2.tgz", - "integrity": "sha512-aT2B4PLyyRDUVUafXzpZFoc0C9t0za4BJAKP5sgWIhG+jHECQZUEjuQSCIwZdiJJ4w4cgu5r3Kh20SOdtEBl0w==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.3.tgz", + "integrity": "sha512-ri1OzcLnk1HH4gORmr1dllxDzzrN6goUIz/P4MHFV0YZJDCADPR3RvYNp0PW2SetKTThar6wlbFTL00hV2Q+fg==", "dev": true, "requires": { - "@typescript-eslint/types": "4.28.2", + "@typescript-eslint/types": "4.28.3", "eslint-visitor-keys": "^2.0.0" } }, diff --git a/package.json b/package.json index b57cbac9fe..cc6390bb53 100644 --- a/package.json +++ b/package.json @@ -107,8 +107,8 @@ "@testing-library/dom": "8.1.0", "@testing-library/jest-dom": "5.14.1", "@testing-library/user-event": "13.1.9", - "@typescript-eslint/eslint-plugin": "4.28.2", - "@typescript-eslint/parser": "4.28.2", + "@typescript-eslint/eslint-plugin": "4.28.3", + "@typescript-eslint/parser": "4.28.3", "babel-eslint": "10.1.0", "babel-plugin-transform-imports": "2.0.0", "cross-env": "7.0.3", From ba828f9040c5d2365c895c74fe53671bef211c46 Mon Sep 17 00:00:00 2001 From: camperbot Date: Tue, 13 Jul 2021 03:07:14 +0530 Subject: [PATCH 167/344] chore(i18n,client): processed translations (#42831) --- client/i18n/locales/espanol/intro.json | 142 +++++++++--------- client/i18n/locales/espanol/translations.json | 4 +- 2 files changed, 73 insertions(+), 73 deletions(-) diff --git a/client/i18n/locales/espanol/intro.json b/client/i18n/locales/espanol/intro.json index b10c6a68e8..ce538cad2c 100644 --- a/client/i18n/locales/espanol/intro.json +++ b/client/i18n/locales/espanol/intro.json @@ -152,7 +152,7 @@ "title": "Programación funcional", "intro": [ "La programación funcional es otro enfoque común en el desarrollo de software. En programación funcional, el código está organizado en funciones más pequeñas y básicas que se pueden combinar para construir programas de mayor complejidad.", - "In this course, you'll learn the core concepts of Functional Programming including pure functions, how to avoid mutations, and how to write cleaner code with methods like .map() and .filter()." + "En este curso, aprenderás los conceptos básicos de programación funcional incluyendo funciones puras, cómo evitar mutaciones, y cómo escribir código más limpio con métodos como .map() y .filter()." ] }, "intermediate-algorithm-scripting": { @@ -192,64 +192,64 @@ } }, "front-end-libraries": { - "title": "Bibliotecas de desarrollo Front end", + "title": "Librerías de desarrollo Front End", "intro": [ - "Now that you're familiar with HTML, CSS, and JavaScript, level up your skills by learning some of the most popular front end libraries in the industry.", - "In the Front End Libraries Certification, you'll learn how to style your site quickly with Bootstrap. You'll also learn how add logic to your CSS styles and extend them with Sass.", - "Later, you'll build a shopping cart and other applications to learn how to create powerful Single Page Applications (SPAs) with React and Redux." + "Ahora que ya estás familiarizado con HTML, CSS y JavaScript, mejora tus habilidades aprendiendo algunas de las librerías de Front End más populares de la industria.", + "En la certificación de librerías de Front End, aprenderás a diseñar tu sitio rápidamente con Bootstrap. También aprenderás cómo añadir lógica a tus estilos CSS y extenderlos con Sass.", + "Después, construirás un carrito de compras y otras aplicaciones para aprender a crear poderosas Single Page Applications (SPAs) con React y Redux." ], "note": "", "blocks": { "bootstrap": { "title": "Bootstrap", "intro": [ - "Bootstrap is a front end framework used to design responsive web pages and applications. It takes a mobile-first approach to web development, and includes pre-built CSS styles and classes, plus some JavaScript functionality.", - "In this course, you'll learn how to build responsive websites with Bootstrap, and use its included classes to style buttons, images, forms, navigation, and other common elements." + "Bootstrap es un framework de front end utilizado para diseñar páginas y aplicaciones web. Tiene un enfoque de desarrollo web centrado en los dispositivos móviles e incluye estilos y clases CSS preconfigurados, además de algunas funciones de JavaScript.", + "En este curso, aprenderás cómo crear sitios web responsivos con Bootstrap, y utilizarás sus clases incluidas para estilizar botones, imágenes, formularios, navegación y otros elementos." ] }, "jquery": { "title": "jQuery", "intro": [ - "jQuery is one of the most widely used JavaScript libraries in the world.", - "In 2006 when it was released, all major browsers handled JavaScript slightly differently. jQuery simplified the process of writing client-side JavaScript, and also ensured that your code worked the same way in all browsers.", - "In this course, you'll learn how to use jQuery to select, remove, clone, and modify different elements on the page." + "jQuery es una de las librerías de JavaScript más utilizadas en el mundo.", + "En 2006, cuando se lanzó, los principales navegadores manejaban JavaScript de forma ligeramente diferente. jQuery simplificó el proceso de escribir JavaScript del lado del cliente, y también garantizó que tu código funcionara de la misma manera en todos los navegadores.", + "En este curso, aprenderás a usar jQuery para seleccionar, eliminar, copiar y modificar diferentes elementos en la página." ] }, "sass": { "title": "SASS", "intro": [ - "Sass, or \"Syntactically Awesome StyleSheets\", is a language extension of CSS. It adds features that aren't available in basic CSS, which make it easier for you to simplify and maintain the style sheets for your projects.", - "In this Sass course, you'll learn how to store data in variables, nest CSS, create reusable styles with mixins, add logic and loops to your styles, and more." + "Sass, o \"Syntactically Awesome StyleSheets\", es una extensión del lenguaje CSS. Añade características que no están disponibles en CSS básicos, lo que te facilita simplificar y mantener las hojas de estilo para tus proyectos.", + "En este curso de Sass, aprenderás cómo almacenar datos en variables, anidar CSS, crear estilos reutilizables con mixins, añadir lógica y bucles a tus estilos, y más." ] }, "react": { "title": "React", "intro": [ - "React is a popular JavaScript library for building reusable, component-driven user interfaces for web pages or applications.", - "React combines HTML with JavaScript functionality into its own markup language called JSX. React also makes it easy to manage the flow of data throughout the application.", - "In this course, you'll learn how to create different React components, manage data in the form of state props, use different lifecycle methods like componentDidMount, and much more." + "React es una librería muy popular de JavaScript para construir interfaces de usuario reutilizables, impulsadas por componentes para páginas web o aplicaciones.", + "React combina HTML con funcionalidad de JavaScript creando su propio lenguaje de marcado llamado JSX. React hace fácil la administración del flujo de datos a través de la aplicación.", + "En este curso, aprenderás cómo crear diferentes componentes de React, administrar las propiedades de estado de los datos, usar diferentes métodos de ciclo de vida como componentDidMount y mucho más." ] }, "redux": { "title": "Redux", "intro": [ - "As applications grow in size and scope, managing shared data becomes much more difficult. Redux is defined as a \"predictable state container for JavaScript apps\" that helps ensure your apps work predictably, and are easier to test.", - "While you can use Redux with any view library, we introduce Redux here before combining it with React in the next set of courses.", - "In this course, you'll learn the fundamentals of Redux stores, actions, reducers and middleware to manage data throughout your application." + "A medida que las aplicaciones crecen en tamaño y alcance, la gestión de datos compartidos se vuelve mucho más difícil. Redux se define como un \"contenedor de estado predecible para aplicaciones de JavaScript\" que ayuda a asegurar que tus aplicaciones funcionen de manera predecible, y sean más fáciles de probar.", + "Aunque puedes usar Redux con cualquier librería de vistas, aquí introducimos Redux antes de combinarlo con React en los siguientes capítulos del curso.", + "En este curso, aprenderás los fundamentos de almacenamiento en Redux, así como de las acciones, reductores e intermediarios para administrar datos a lo largo de tu aplicación." ] }, "react-and-redux": { - "title": "React and Redux", + "title": "React y Redux", "intro": [ - "React and Redux are often mentioned together, and with good reason. The developer who created Redux was a React developer who wanted to make it easier to share data across different components.", - "Now that you know how to manage the flow of shared data with Redux, it's time to combine that knowledge with React. In the React and Redux courses, you'll build a React component and learn how to manage state locally at the component level, and throughout the entire application with Redux." + "React y Redux se mencionan a menudo juntos, y con razón. El desarrollador que creó Redux era un desarrollador de React que quería hacer más fácil compartir datos a través de diferentes componentes.", + "Ahora que sabes cómo administrar el flujo de datos compartidos con Redux, es hora de combinar ese conocimiento con React. En los cursos de React y Redux, construirás un componente de React y aprenderás cómo administrar el estado localmente a nivel de componentes, y a lo largo de toda la aplicación con Redux." ] }, "front-end-libraries-projects": { - "title": "Front End Development Libraries Projects", + "title": "Proyectos de librerías de desarrollo Front End", "intro": [ - "It's time to put your front end development libraries skills to the test. Use Bootstrap, jQuery, Sass, React, and Redux to build 5 projects that will test everything you've learned up to this point.", - "Complete all 5 projects, and you'll earn the Front End Development Libraries certification." + "Es hora de poner a prueba tus habilidades con las librerías de desarrollo front end. Usa Bootstrap, jQuery, Sass, React, y Redux para construir 5 proyectos que probarán todo lo que has aprendido hasta este punto.", + "Completa los 5 proyectos y obtendrás la certificación librerías de desarrollo Front End." ] } } @@ -259,7 +259,7 @@ "intro": [ "Los datos están a nuestro alrededor, pero no significan mucho si no tienen forma o contexto.", "En la certificación Visualización de Datos, construirás diagramas, gráficos, y mapas para presentar diferentes tipos de datos utilizando la biblioteca D3.js.", - "You'll also learn about JSON (JavaScript Object Notation), and how to work with data online using an API (Application Programming Interface)." + "También aprenderás acerca de JSON (JavaScript Object Notation), y cómo trabajar con datos en línea usando un API (Application Programing Interface)." ], "note": "", "blocks": { @@ -276,19 +276,19 @@ "title": "APIs JSON y AJAX", "intro": [ "De forma similar a la que las interfaces de usuario \"UI\" ayudan a la gente a usar programas, las APIs (Interfaces de Programación de Aplicación) ayudan a los programas a interactuar con otros programas. Las APIs son herramientas que los ordenadores utilizan para comunicarse entre sí, en parte para enviar y recibir datos.", - "Programmers often use AJAX (Asynchronous JavaScript and XML) when working with APIs. AJAX refers to a group of technologies that make asynchronous requests to a server to transfer data, then load any returned data into the page. And the data transferred between the browser and server is often in a format called JSON (JavaScript Object Notation).", - "This course will teach you the basics about working with APIs and different AJAX technologies in the browser." + "Los programadores a menudo usan AJAX (Asynchronous JavaScript y XML) cuando trabajan con APIs. AJAX se refiere a un grupo de tecnologías que hacen peticiones asíncronas a un servidor para transferir datos, y luego cargar cualquier dato devuelto en la página. Y los datos transferidos entre el navegador y el servidor suelen estar en un formato llamado JSON (JavaScript Object Notation).", + "Este curso te enseñará lo básico sobre trabajar con APIs y diferentes tecnologías AJAX en el navegador." ] }, "data-visualization-projects": { - "title": "Data Visualization Projects", + "title": "Proyectos de visualización de datos", "intro": [ - "Now that you learned how to work with D3, APIs, and AJAX technologies, put your skills to the test with these 5 Data Visualization projects.", - "In these projects, you'll need to fetch data and parse a dataset, then use D3 to create different data visualizations. Finish them all to earn your Data Visualization certification." + "Ahora que has aprendido a trabajar con las tecnologías D3, APIs y AJAX, pon a prueba tus habilidades con estos 5 proyectos de visualización de datos.", + "En estos proyectos, necesitarás obtener datos y analizar un conjunto de datos y después usar D3 para crear diferentes visualizaciones de datos. Termínalos todos para obtener tu certificación de visualización de datos." ] }, "d3-dashboard": { - "title": "D3 Dashboard", + "title": "Panel D3", "intro": [ "", "" @@ -297,15 +297,15 @@ } }, "relational-databases": { - "title": "Relational Databases", + "title": "Bases de Datos Relacionales", "intro": [ - "placeholder" + "marcador de posición" ], "blocks": { "learn-relational-databases": { - "title": "Learn Relational Databases", + "title": "Aprender Bases de Datos Relacionales", "intro": [ - "placeholder" + "marcador de posición" ] } } @@ -313,41 +313,41 @@ "apis-and-microservices": { "title": "APIs y Microservicios", "intro": [ - "Until this point, you've only used JavaScript on the front end to add interactivity to a page, solve algorithm challenges, or build an SPA. But JavaScript can also be used on the back end, or server, to build entire web applications.", - "Today, one of the popular ways to build applications is through microservices, which are small, modular applications that work together to form a larger whole.", - "In the APIs and Microservices Certification, you'll learn how to write back end-ready with Node.js and npm (Node Package Manager). You'll also build web applications with the Express framework, and build a People Finder microservice with MongoDB and the Mongoose library." + "Hasta este punto, sólo has usado JavaScript en la parte de front end para añadir interactividad a una página, resolver los desafíos de algoritmos o construir un SPA. Pero JavaScript también se puede utilizar en el back end, o servidor, para construir aplicaciones web completas.", + "Hoy en día, una de las formas populares de construir aplicaciones es a través de microservicios, que son pequeñas aplicaciones modulares que trabajan juntas para formar un todo más grande.", + "En la certificación de APIs y Microservicios aprenderás cómo escribir para back- nd con Node.js y npm (Node Package Manager). También construirá aplicaciones web con el framework Express, y construirás un microservicio \"People Finder\" con MongoDB y la librería Mongoose." ], "note": "", "blocks": { "managing-packages-with-npm": { - "title": "Managing Packages with NPM", + "title": "Gestión de paquetes con NPM", "intro": [ - "npm (Node Package Manager), is a command line tool to install, create, and share packages of JavaScript code written for Node.js. There are many open source packages available on npm, so before starting a project, take some time to explore so you don't end up recreating the wheel for things like working with dates or fetching data from an API.", - "In this course, you'll learn the basics of using npm, including how to work with the package.json and how to manage your installed dependencies." + "npm (Node Package Manager), es una herramienta de línea de comandos para instalar, crear y compartir paquetes de código JavaScript escritos para Node.js. Hay muchos paquetes de código abierto disponibles en npm, así que antes de iniciar un proyecto, tómate algo de tiempo para explorar los diferentes paquetes, para que no termines reinventando la rueda para cosas comunes como trabajar con fechas y obtener datos de una API.", + "En este curso, aprenderás los conceptos básicos del uso de npm, incluyendo cómo trabajar con el package.json y cómo administrar las dependencias instaladas." ] }, "basic-node-and-express": { - "title": "Basic Node and Express", + "title": "Node y Express básicos", "intro": [ - "Node.js is a JavaScript runtime that allows developers to write backend (server-side) programs in JavaScript. Node.js comes with a handful of built-in modules — small, independent programs — that help with this. Some of the core modules include HTTP, which acts like a server, and File System, a module to read and modify files.", - "In the last set of courses you learned to install and manage packages from npm, which are collections of smaller modules. These packages can help you build larger, more complex applications.", - "Express is a lightweight web application framework, and is one of the most popular packages on npm. Express makes it much easier to create a server and handle routing the routing for your application, which handles things like direct people to the correct page when they visit a certain endpoint like
          /blog
          .", - "In this course, you'll learn the basics of Node and Express including how to create a server, serve different files, and handle different requests from the browser." + "Node.js es un entorno que trabaja en tiempo de ejecución de JavaScript que permite a los desarrolladores escribir programas de backend (del lado del servidor) en JavaScript. Node.js viene con un puñado de módulos integrados — pequeños programas independientes — que ayudan con esto. Algunos de los módulos principales incluyen HTTP, que actúa como un servidor, y File System, un módulo para leer y modificar archivos.", + "En el último conjunto de cursos aprendiste a instalar y administrar paquetes desde npm, que son colecciones de módulos más pequeños. Estos paquetes pueden ayudarte a construir aplicaciones más grandes y complejas.", + "Express es un framework de aplicaciones web ligero, y es uno de los paquetes más populares de npm. Express hace que sea mucho más fácil crear un servidor y manejar el enrutamiento de tu aplicación, que gestiona cosas como dirigir a la gente a la página correcta cuando visitan un determinado endpoint como
          /blog
          .", + "En este curso, aprenderás los conceptos básicos de Node y Express incluyendo cómo crear un servidor, servir diferentes archivos y manejar diferentes peticiones desde el navegador." ] }, "mongodb-and-mongoose": { - "title": "MongoDB and Mongoose", + "title": "MongoDB y Mongoose", "intro": [ - "MongoDB is a database application that stores JSON documents (or records) that you can use in your application. Unlike SQL, another type of database, Mongo is a non-relational or \"NoSQL\" database. This means Mongo stores all associated data within one record, instead of storing it across many preset tables as in a SQL database.", - "Mongoose is a popular npm package that is often installed alongside Mongo. With Mongoose, you can use plain JavaScript objects instead of JSON, which makes it easier to work with Mongo. Also, it allows you to create blueprints for your documents called schemas, so you don't accidentally save the wrong type of data and cause bugs later.", - "In the MongoDB and Mongoose courses, you'll learn the fundamentals of working with persistent data including how to set up a model, and save, delete, and find documents in the database." + "MongoDB es una aplicación de base de datos que almacena documentos (o registros) JSON que puedes utilizar en tu aplicación. A diferencia de SQL, otro tipo de base de datos, Mongo es una base de datos no relacional o \"NoSQL\". Esto significa que Mongo almacena todos los datos asociados dentro de un registro en lugar de almacenarlos en varias tablas predefinidas como en una base de datos SQL.", + "Mongoose es un popular paquete npm que a menudo se instala junto con Mongo. Con Mongoose, puedes utilizar objetos de JavaScript simples en lugar de JSON, lo que hace más fácil trabajar con Mongo. Además, te permite crear plantillas para tus documentos llamados esquemas, para que no guarde accidentalmente el tipo equivocado de datos y cause errores más tarde.", + "En los cursos de MongoDB y Mongoose, aprenderás los fundamentos para trabajar con datos persistentes, incluyendo cómo configurar un modelo, guardar, eliminar y encontrar documentos en la base de datos." ] }, "apis-and-microservices-projects": { - "title": "APIs and Microservices Projects", + "title": "Proyectos de microservicios y APIs", "intro": [ - "You've worked with APIs before, but now that you know npm, Node, Express, MongoDB, and Mongoose, it's time to build your own. Draw on everything you've learned up to this point to create 5 different microservices, which are smaller applications that are limited in scope.", - "After creating these, you'll have 5 cool microservice APIs you can show off to friends, family, and potential employers. Oh, and you'll have a shiny new APIs and Microservices Certification, too." + "Has trabajado con APIs antes, pero ahora que conoces npm, Node, Express, MongoDB y Mongoose, es el momento de construir tu propia API. Basado en todo lo que ha aprendido hasta este punto, crearás 5 microservicios diferentes, que son aplicaciones más pequeñas que tienen un alcance limitado.", + "Después de crearlas, tendrás 5 APIs de microservicios interesantes que puedes mostrar a amigos, familiares y potenciales empleadores. Oh, y también tendrás una nueva y brillante certificación de APIs y microservicios." ] } } @@ -355,33 +355,33 @@ "quality-assurance": { "title": "Control de Calidad", "intro": [ - "As your programs or web applications become more complex, you'll want to test them to make sure that new changes don't break their original functionality.", - "In the Quality Assurance Certification, you'll learn how to write tests with Chai to ensure your applications work the way you expect them to.", - "Then you'll build a chat application to learn advanced Node and Express concepts. You'll also use Pug as a template engine, Passport for authentication, and Socket.io for real-time communication between the server and connected clients." + "A medida que tus programas o aplicaciones web se vuelven más complejos, querrás probarlos para asegurarte de que los nuevos cambios no rompan su funcionalidad original.", + "En la certificación de control de calidad, aprenderás a escribir pruebas con Chai para asegurarte de que tus aplicaciones funcionan como esperas.", + "Luego construirás una aplicación de chat para aprender conceptos avanzados de Node y Express. También usarás Pug como motor de plantillas, Passport para autenticación y Socket.io para la comunicación en tiempo real entre el servidor y los clientes conectados." ], "note": "", "blocks": { "quality-assurance-and-testing-with-chai": { - "title": "Quality Assurance and Testing with Chai", + "title": "Control de calidad y pruebas con Chai", "intro": [ - "Chai is a JavaScript testing library that helps you confirm that your program still behaves the way you expect it to after you make changes to your code.", - "Using Chai, you can write tests that describe your program's requirements and see if your program meets them.", - "In this course, you'll learn about assertions, deep equality, truthiness, testing APIs, and other fundamentals for testing JavaScript applications." + "Chai es una librería de pruebas de JavaScript que te ayuda a confirmar que tu programa todavía se comporta de la manera que esperas después de realizar cambios en tu código.", + "Usando Chai, puedes escribir pruebas que describan los requisitos de tu programa y ver si tu programa los cumple.", + "En este curso, aprenderá sobre aserciones, igualdad profunda, veracidad, pruebas de APIs y otros fundamentos para probar aplicaciones JavaScript." ] }, "advanced-node-and-express": { - "title": "Advanced Node and Express", + "title": "Node y Express avanzados", "intro": [ - "Now it's time to take a deep dive into Node.js and Express.js by building a chat application with a sign-in system.", - "To implement the sign-in system safely, you'll need to learn about authentication. This is the act of verifying the identity of a person or process.", - "In this course, you'll learn how to use Passport to manage authentication, Pug to create reusable templates for quickly building the front end, and web sockets for real-time communication between the clients and server." + "Ahora es el momento de sumergirse en Node.js y Express.js construyendo una aplicación de chat con un sistema de inicio de sesión.", + "Para implementar el sistema de inicio de sesión de forma segura, necesitarás aprender acerca de autenticación. Este es el acto de verificar la identidad de una persona o proceso.", + "En este curso, aprenderás cómo utilizar Passport para administrar la autenticación, Pug para crear plantillas reutilizables para construir rápidamente el front end, y web sockets para comunicación en tiempo real entre los clientes y el servidor." ] }, "quality-assurance-projects": { "title": "Quality Assurance Projects", "intro": [ - "Now that you're well versed in both the front end and back end, it's time to apply all the skills and concepts you've learned up to this point. You'll build 5 different web applications, and write tests for each one to make sure they're working and can handle different edge cases.", - "After completing these Quality Assurance projects, you'll have 5 more projects under your belt, and a new certification to show off on your portfolio." + "Ahora que estas versado tanto en el front end como en el back end, es tiempo de aplicar todas tus nuevas habilidades y los conceptos que has aprendido hasta el momento. Construirás 5 aplicaciones web diferentes y escribirás pruebas para cada una de ellas, para estar seguro de que funcionarán y que tus aplicaciones pueden manejar diferentes casos extremos.", + "Después de completar estos proyectos de Control de Calidad, tendrás 5 proyectos más en tu currículum, y una nueva certificación para mostrar en tu portafolio." ] } } @@ -389,22 +389,22 @@ "scientific-computing-with-python": { "title": "Cálculo Científico con Python", "intro": [ - "Python is one of the most popular, flexible programming languages today. You can use it for everything from basic scripting to machine learning.", - "In the Scientific Computing with Python Certification, you'll learn Python fundamentals like variables, loops, conditionals, and functions. Then you'll quickly ramp up to complex data structures, networking, relational databases, and data visualization." + "Hoy en día, Python es uno de los lenguajes de programación más populares y flexibles. Puedes usarlo para todo, desde programas básicos hasta machine learning.", + "En la certificación de Cálculo Científico con Python, aprenderás los fundamentos de Python tales como: variables, bucles, condicionales, y funciones. Luego, avanzarás rápidamente por estructura de datos complejas, redes, base de datos relacionales y visualización de datos." ], "note": "", "blocks": { "python-for-everybody": { "title": "Python for Everybody", "intro": [ - "Python for everybody is a free video course series that teaches the basics of using Python 3.", - "The courses were created by Dr. Charles Severance (also known as Dr. Chuck). He is a Clinical Professor at the University of Michigan School of Information, where he teaches various technology-oriented courses including programming, database design, and web development." + "Python para todos, es una serie de videocursos gratuitos, que enseña los conceptos básicos del uso de Python 3.", + "Los cursos fueron creados por el Dr. Charles Severance (también conocido como Dr. Chuck). El es un Profesor de Clínica en la Escuela de Información de la Universidad de Michigan, donde él enseña varios cursos orientados a tecnología, diseño de bases de datos y desarrollo web." ] }, "scientific-computing-with-python-projects": { "title": "Scientific Computing with Python Projects", "intro": [ - "Time to put your Python skills to the test. By completing these projects, you will demonstrate that you have a good foundational knowledge of Python and qualify for the Scientific Computing with Python Certification." + "Es momento de poner a prueba tus habilidades con Python. Al completar estos proyectos, demostrarás que tienes el conocimiento fundamental de Python y que calificas para la Certificación de cálculo científico con Python." ] } } diff --git a/client/i18n/locales/espanol/translations.json b/client/i18n/locales/espanol/translations.json index e784b60861..f7c2a3f209 100644 --- a/client/i18n/locales/espanol/translations.json +++ b/client/i18n/locales/espanol/translations.json @@ -396,7 +396,7 @@ "shield": "Un escudo con una marca de verificación", "tensorflow": "Icono de Tensorflow", "algorithm": "Nodos ramificados", - "magnifier": "magnifier" + "magnifier": "lupa" }, "aria": { "fcc-logo": "Logo de freeCodeCamp", @@ -559,7 +559,7 @@ }, "certification-card": { "title": "Reclamar tu certificación", - "intro": "Complete the following steps to claim and view your {{i18nCertText}}", + "intro": "Completa los siguientes pasos para reclamar y ver tu {{i18nCertText}}", "complete-project": "Completa {{i18nCertText}} proyectos", "accept-honesty": "Acepta nuestra política de honestidad académica", "set-name": "Establece tu nombre, y hazlo público", From b8b89ed549e6d453bd40d0eef49477c9de57ab58 Mon Sep 17 00:00:00 2001 From: "Nicholas Carrigan (he/him)" Date: Mon, 12 Jul 2021 15:42:26 -0700 Subject: [PATCH 168/344] feat: enable more certs (#42764) --- config/i18n/all-langs.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/config/i18n/all-langs.js b/config/i18n/all-langs.js index a5ffbca77f..3eab767c0c 100644 --- a/config/i18n/all-langs.js +++ b/config/i18n/all-langs.js @@ -39,7 +39,10 @@ const auditedCerts = { 'front-end-libraries', 'data-visualization', 'apis-and-microservices', - 'quality-assurance' + 'quality-assurance', + 'scientific-computing-with-python', + 'data-analysis-with-python', + 'information-security' ], 'chinese-traditional': [ 'responsive-web-design', @@ -47,7 +50,10 @@ const auditedCerts = { 'front-end-libraries', 'data-visualization', 'apis-and-microservices', - 'quality-assurance' + 'quality-assurance', + 'scientific-computing-with-python', + 'data-analysis-with-python', + 'information-security' ], italian: [ 'responsive-web-design', From 6c37c9a5384f1cb3639d0938bd2699c5aec8046b Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 13 Jul 2021 09:27:11 +0000 Subject: [PATCH 169/344] chore(deps): update dependency lint-staged to v11.0.1 --- package-lock.json | 335 +--------------------------------------------- package.json | 2 +- 2 files changed, 8 insertions(+), 329 deletions(-) diff --git a/package-lock.json b/package-lock.json index 04f903d997..3816bd701d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18033,9 +18033,9 @@ } }, "lint-staged": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-11.0.0.tgz", - "integrity": "sha512-3rsRIoyaE8IphSUtO1RVTFl1e0SLBtxxUOPBtHxQgBHS5/i6nqvjcUfNioMa4BU9yGnPzbO+xkfLtXtxBpCzjw==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-11.0.1.tgz", + "integrity": "sha512-RkTA1ulE6jAGFskxpGAwxfVRXjHp7D9gFg/+KMARUWMPiVFP0t28Em2u0gL8sA0w3/ck3TC57F2v2RNeQ5XPnw==", "dev": true, "requires": { "chalk": "^4.1.1", @@ -18055,12 +18055,6 @@ "stringify-object": "^3.3.0" }, "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -18070,15 +18064,6 @@ "color-convert": "^2.0.1" } }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, "chalk": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", @@ -18089,16 +18074,6 @@ "supports-color": "^7.1.0" } }, - "cli-truncate": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", - "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", - "dev": true, - "requires": { - "slice-ansi": "^3.0.0", - "string-width": "^4.2.0" - } - }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -18120,86 +18095,12 @@ "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" - } - }, - "picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", - "dev": true - }, - "slice-ansi": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", - "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - } - }, - "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -18208,28 +18109,17 @@ "requires": { "has-flag": "^4.0.0" } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } } } }, "listr2": { - "version": "3.8.2", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.8.2.tgz", - "integrity": "sha512-E28Fw7Zd3HQlCJKzb9a8C8M0HtFWQeucE+S8YrSrqZObuCLPRHMRrR8gNmYt65cU9orXYHwvN5agXC36lYt7VQ==", + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.10.0.tgz", + "integrity": "sha512-eP40ZHihu70sSmqFNbNy2NL1YwImmlMmPh9WO5sLmPDleurMHt3n+SwEWNu2kzKScexZnkyFtc1VI0z/TGlmpw==", "dev": true, "requires": { - "chalk": "^4.1.1", "cli-truncate": "^2.1.0", - "figures": "^3.2.0", - "indent-string": "^4.0.0", + "colorette": "^1.2.2", "log-update": "^4.0.0", "p-map": "^4.0.0", "rxjs": "^6.6.7", @@ -18237,171 +18127,6 @@ "wrap-ansi": "^7.0.0" }, "dependencies": { - "ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "requires": { - "type-fest": "^0.21.3" - } - }, - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "requires": { - "restore-cursor": "^3.1.0" - } - }, - "cli-truncate": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", - "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", - "dev": true, - "requires": { - "slice-ansi": "^3.0.0", - "string-width": "^4.2.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "log-update": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", - "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", - "dev": true, - "requires": { - "ansi-escapes": "^4.3.0", - "cli-cursor": "^3.1.0", - "slice-ansi": "^4.0.0", - "wrap-ansi": "^6.2.0" - }, - "dependencies": { - "slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - } - }, - "wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - } - } - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "p-map": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", - "dev": true, - "requires": { - "aggregate-error": "^3.0.0" - } - }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, "rxjs": { "version": "6.6.7", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", @@ -18410,52 +18135,6 @@ "requires": { "tslib": "^1.9.0" } - }, - "slice-ansi": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", - "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - } - }, - "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true } } }, diff --git a/package.json b/package.json index cc6390bb53..e05ab61ef3 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,7 @@ "jest": "27.0.6", "js-yaml": "3.14.1", "lerna": "4.0.0", - "lint-staged": "11.0.0", + "lint-staged": "11.0.1", "lodash": "4.17.21", "markdownlint": "0.23.1", "mock-fs": "5.0.0", From e97c302c3d69325afab22491d026dd0f3c8c1762 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 13 Jul 2021 11:18:14 +0000 Subject: [PATCH 170/344] fix(deps): update dependency react-reflex to v4.0.2 --- client/package-lock.json | 6 +++--- client/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 59db6e1886..1f2a022288 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -16950,9 +16950,9 @@ } }, "react-reflex": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/react-reflex/-/react-reflex-4.0.1.tgz", - "integrity": "sha512-Lsh0X/ms5vzR9eWkpgcXKnkG4J9Cb52z70YJMfai8jwVfbrG4aPrWPFS/zf+cZaxteZJj2Iz3xiSue1LNd0C/Q==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/react-reflex/-/react-reflex-4.0.2.tgz", + "integrity": "sha512-dTnCb3ZfT49u0uiOtTV0xRorObO5Cmwwj2kyC2pL7+orgMc5utrnQjfqIQvB5VpsnwVpsC43uKPMG5kPmT+wIQ==", "requires": { "@babel/runtime": "^7.0.0", "lodash.throttle": "^4.1.1", diff --git a/client/package.json b/client/package.json index 79eb9d1ad7..cb434b6490 100644 --- a/client/package.json +++ b/client/package.json @@ -104,7 +104,7 @@ "react-lazy-load": "3.1.13", "react-monaco-editor": "0.43.0", "react-redux": "5.1.2", - "react-reflex": "4.0.1", + "react-reflex": "4.0.2", "react-responsive": "6.1.2", "react-scrollable-anchor": "0.6.1", "react-spinkit": "3.0.0", From 5e8ac21c2619ea508d7d145824b608c880ade119 Mon Sep 17 00:00:00 2001 From: tristansoriaga <35946776+tristansoriaga@users.noreply.github.com> Date: Tue, 13 Jul 2021 23:37:38 +0800 Subject: [PATCH 171/344] fix(curriculum): remove example function calls from seed (#42797) --- .../algorithms/implement-bubble-sort.md | 4 +--- .../algorithms/implement-insertion-sort.md | 4 +--- .../algorithms/implement-merge-sort.md | 4 +--- .../algorithms/implement-selection-sort.md | 5 +---- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-bubble-sort.md b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-bubble-sort.md index 6cf8150f25..51fbb296de 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-bubble-sort.md +++ b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-bubble-sort.md @@ -52,7 +52,7 @@ assert( ); ``` -`bubbleSort` should return an array that is unchanged except for order. +`bubbleSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92])` should return an array that is unchanged except for order. ```js assert.sameMembers( @@ -113,8 +113,6 @@ function bubbleSort(array) { return array; // Only change code above this line } - -bubbleSort([1, 4, 2, 8, 345, 123, 43, 32, 5643, 63, 123, 43, 2, 55, 1, 234, 92]); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-insertion-sort.md b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-insertion-sort.md index ce4a857bea..bbac650914 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-insertion-sort.md +++ b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-insertion-sort.md @@ -48,7 +48,7 @@ assert( ); ``` -`insertionSort` should return an array that is unchanged except for order. +`insertionSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92])` should return an array that is unchanged except for order. ```js assert.sameMembers( @@ -109,8 +109,6 @@ function insertionSort(array) { return array; // Only change code above this line } - -insertionSort([1, 4, 2, 8, 345, 123, 43, 32, 5643, 63, 123, 43, 2, 55, 1, 234, 92]); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-merge-sort.md b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-merge-sort.md index ab1dca4381..e6d9660a3a 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-merge-sort.md +++ b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-merge-sort.md @@ -56,7 +56,7 @@ assert( ); ``` -`mergeSort` should return an array that is unchanged except for order. +`mergeSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92])` should return an array that is unchanged except for order. ```js assert.sameMembers( @@ -117,8 +117,6 @@ function mergeSort(array) { return array; // Only change code above this line } - -mergeSort([1, 4, 2, 8, 345, 123, 43, 32, 5643, 63, 123, 43, 2, 55, 1, 234, 92]); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-selection-sort.md b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-selection-sort.md index 1a1b082090..5e677d406d 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-selection-sort.md +++ b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-selection-sort.md @@ -48,7 +48,7 @@ assert( ); ``` -`selectionSort` should return an array that is unchanged except for order. +`selectionSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92])` should return an array that is unchanged except for order. ```js assert.sameMembers( @@ -109,9 +109,6 @@ function selectionSort(array) { return array; // Only change code above this line } - - -selectionSort([1, 4, 2, 8, 345, 123, 43, 32, 5643, 63, 123, 43, 2, 55, 1, 234, 92]); ``` # --solutions-- From e6a17214e2924d9f58ef05939e78cd588f28cb06 Mon Sep 17 00:00:00 2001 From: Ahmad Abdolsaheb Date: Tue, 13 Jul 2021 20:36:18 +0300 Subject: [PATCH 172/344] fix(client):fix scriptloader args (#42847) --- client/src/components/Donation/PayPalButtonScriptLoader.js | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/components/Donation/PayPalButtonScriptLoader.js b/client/src/components/Donation/PayPalButtonScriptLoader.js index 8aa98fd466..45a033fa99 100644 --- a/client/src/components/Donation/PayPalButtonScriptLoader.js +++ b/client/src/components/Donation/PayPalButtonScriptLoader.js @@ -41,7 +41,6 @@ export class PayPalButtonScriptLoader extends Component { if (subscription) queries += '&vault=true&intent=subscription'; scriptLoader( - 'paypal-sdk', 'paypal-sdk', true, `https://www.paypal.com/sdk/js${queries}`, From 6fac38ef7d724efc469f7918a9e5013210e1f39c Mon Sep 17 00:00:00 2001 From: RawandDev <82733587+RawandDev@users.noreply.github.com> Date: Tue, 13 Jul 2021 23:27:44 +0300 Subject: [PATCH 173/344] fix(curriculum): improve seo with better-used terms (#42848) * update main JS introduction * update note * update es6 with rephrasing * intro of basic algo scripting remove unnecessary comma * oop intro removing unnecessary phrase * Update client/i18n/locales/english/intro.json Done! Co-authored-by: Shaun Hamilton * Update client/i18n/locales/english/intro.json Co-authored-by: Shaun Hamilton Co-authored-by: Shaun Hamilton --- client/i18n/locales/english/intro.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/i18n/locales/english/intro.json b/client/i18n/locales/english/intro.json index 53abb86636..fb9bf1fb9b 100644 --- a/client/i18n/locales/english/intro.json +++ b/client/i18n/locales/english/intro.json @@ -83,9 +83,9 @@ "intro": [ "While HTML and CSS control the content and styling of a page, JavaScript is used to make it interactive. In the JavaScript Algorithm and Data Structures Certification, you'll learn the fundamentals of JavaScript including variables, arrays, objects, loops, and functions.", "Once you have the fundamentals down, you'll apply that knowledge by creating algorithms to manipulate strings, factorialize numbers, and even calculate the orbit of the International Space Station.", - "Along the way, you'll also learn two important programing styles or paradigms: Object Oriented Programing (OOP), and Functional Programing (FP)." + "Along the way, you'll also learn two important programming styles or paradigms: Object Oriented Programming (OOP) and Functional Programming (FP)." ], - "note": "Note: Some browser extensions, such as ad-blockers and script-blockers can interfere with the tests. If you face issues, we recommend disabling extensions that modify or block content of pages, while taking the course.", + "note": "Note: Some browser extensions, such as ad-blockers and script-blockers can interfere with the tests. If you face issues, we recommend disabling extensions that modify or block the content of pages while taking the course.", "blocks": { "basic-javascript": { "title": "Basic JavaScript", @@ -98,7 +98,7 @@ "title": "ES6", "intro": [ "ECMAScript, or ES, is a standardized version of JavaScript. Because all major browsers follow this specification, the terms ECMAScript and JavaScript are interchangeable.", - "Most of the JavaScript you've learned up to this point was in ES5 (ECMAScript 5), which was finalized in 2009. While you can still write programs in ES5, JavaScript is always evolving, and new features are released every year.", + "Most of the JavaScript you've learned up to this point was in ES5 (ECMAScript 5), which was finalized in 2009. While you can still write programs in ES5, JavaScript is constantly evolving, and new features are released every year.", "ES6, released in 2015, added many powerful new features to the language. In this course, you'll learn these new features, including let and const, arrow functions, classes, promises, and modules." ] }, @@ -128,15 +128,15 @@ "title": "Basic Algorithm Scripting", "intro": [ "An algorithm is a series of step-by-step instructions that describe how to do something.", - "To write an effective algorithm, it helps to break a problem down into smaller parts, and think carefully about how to solve each part with code.", + "To write an effective algorithm, it helps to break a problem down into smaller parts and think carefully about how to solve each part with code.", "In this course, you'll learn the fundamentals of algorithmic thinking by writing algorithms that do everything from converting temperatures to handling complex 2D arrays." ] }, "object-oriented-programming": { "title": "Object Oriented Programming", "intro": [ - "OOP, or Object Oriented Programming, is one of the major approaches to the software development process. In OOP, objects and classes are used to organize code to describe things and what they can do.", - "In this course, you'll learn the basic principles of OOP in JavaScript including the this keyword, prototype chains, constructors, and inheritance." + "OOP, or Object Oriented Programming, is one of the major approaches to the software development process. In OOP, objects and classes organize code to describe things and what they can do.", + "In this course, you'll learn the basic principles of OOP in JavaScript, including the this keyword, prototype chains, constructors, and inheritance." ] }, "functional-programming": { From cc8d92798ab29f16201fd8bd403c35fd62cf764c Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 13 Jul 2021 21:58:41 +0000 Subject: [PATCH 174/344] chore(deps): update codesee to v0.48.0 --- client/package-lock.json | 12 ++++++------ client/package.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 1f2a022288..29fea1f878 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -2802,9 +2802,9 @@ } }, "@codesee/babel-plugin-instrument": { - "version": "0.47.2", - "resolved": "https://registry.npmjs.org/@codesee/babel-plugin-instrument/-/babel-plugin-instrument-0.47.2.tgz", - "integrity": "sha512-gqh7SAHGI3Rx0VpyxJjyfJOsDeBrVhUtmKFnf2QeJ3mjyesTdEPsq0FC4X0SD5Lp84FPbWiB+jYltjygOy+w3A==", + "version": "0.48.0", + "resolved": "https://registry.npmjs.org/@codesee/babel-plugin-instrument/-/babel-plugin-instrument-0.48.0.tgz", + "integrity": "sha512-8dzLf8Z+6BAoIzdbh2/V2a+UeKjcfnkDy9rPLTWkzUT0cHALSFZ4k3rOellbXkSYeT8chIHQYPjPaRTQFtOqyg==", "dev": true, "requires": { "@babel/plugin-syntax-jsx": "^7.12.13", @@ -2861,9 +2861,9 @@ } }, "@codesee/tracker": { - "version": "0.47.2", - "resolved": "https://registry.npmjs.org/@codesee/tracker/-/tracker-0.47.2.tgz", - "integrity": "sha512-1KtvnuczOzTU0JSbctl6DSMyrF2UxzkbfFN2KEpNyHkffEbq2zQncGB2WLKQ6kUvgU4ue7RNYHKXHJ3ZXVFYHw==", + "version": "0.48.0", + "resolved": "https://registry.npmjs.org/@codesee/tracker/-/tracker-0.48.0.tgz", + "integrity": "sha512-450eHsuZNTTlBhYUTvS4QT6GWTVp0o8rZm9epBka4AJzeGAKxRaJa8rSbwK5ISJg9U88hU+f2ZIH2UXBaifc2Q==", "dev": true }, "@discoveryjs/json-ext": { diff --git a/client/package.json b/client/package.json index cb434b6490..c3fbd813ff 100644 --- a/client/package.json +++ b/client/package.json @@ -128,8 +128,8 @@ }, "devDependencies": { "@babel/types": "7.14.5", - "@codesee/babel-plugin-instrument": "0.47.2", - "@codesee/tracker": "0.47.2", + "@codesee/babel-plugin-instrument": "0.48.0", + "@codesee/tracker": "0.48.0", "@testing-library/jest-dom": "5.14.1", "@testing-library/react": "12.0.0", "@types/jest": "26.0.24", From c6878a1309f1d93919c21213721e971d0c816c34 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 14 Jul 2021 01:24:32 +0000 Subject: [PATCH 175/344] chore(deps): update dependency redux-saga-test-plan to v4.0.3 --- client/package-lock.json | 6 +++--- client/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 29fea1f878..5d82bdcfbf 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -17246,9 +17246,9 @@ } }, "redux-saga-test-plan": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/redux-saga-test-plan/-/redux-saga-test-plan-4.0.2.tgz", - "integrity": "sha512-UGQq1IXhl+D/mOBqV7eEt9qlAswBvtfaHZ0GKQwumElIkFiglzKK670QISg8AbvEpsyPE3BnLkuikOK17zZFhg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/redux-saga-test-plan/-/redux-saga-test-plan-4.0.3.tgz", + "integrity": "sha512-bhiWnwb3Gvsu1iUh8A4jUvDxhf1AU/ZfjTspDMWf2fRFUCBeKBnTBm+UcKAPRJxKro5h1ypS/jaFNb7kJaf5yw==", "dev": true, "requires": { "core-js": "^2.4.1", diff --git a/client/package.json b/client/package.json index c3fbd813ff..1f3e6f36b6 100644 --- a/client/package.json +++ b/client/package.json @@ -158,7 +158,7 @@ "jest-json-schema-extended": "1.0.0", "monaco-editor-webpack-plugin": "4.0.0", "react-test-renderer": "16.14.0", - "redux-saga-test-plan": "4.0.2", + "redux-saga-test-plan": "4.0.3", "webpack": "5.44.0", "webpack-cli": "4.7.2" } From e918e05cfac51cf901456d809abcf7a7f1fcaf7f Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 14 Jul 2021 08:01:52 +0000 Subject: [PATCH 176/344] fix(deps): update dependency i18next to v20.3.3 --- client/package-lock.json | 6 +++--- client/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 5d82bdcfbf..34b9c86963 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -12331,9 +12331,9 @@ "integrity": "sha512-EcuixamT82oplpoJ2XU4pDtKGWQ7b00CD9f1ug9IaQ3p1bkHMiKCZ9ut9QDI6qsa6cpUuB+A/I+zLtdNK4n2DQ==" }, "i18next": { - "version": "20.3.2", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-20.3.2.tgz", - "integrity": "sha512-e8CML2R9Ng2sSQOM80wb/PrM2j8mDm84o/T4Amzn9ArVyNX5/ENWxxAXkRpZdTQNDaxKImF93Wep4mAoozFrKw==", + "version": "20.3.3", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-20.3.3.tgz", + "integrity": "sha512-tx9EUhHeaipvZ5pFLTaN9Xdm5Ssal774MpujaTA1Wv/ST/1My5SnoBmliY1lOpyEP5Z51Dq1gXifk/y4Yt3agQ==", "requires": { "@babel/runtime": "^7.12.0" } diff --git a/client/package.json b/client/package.json index 1f3e6f36b6..969e83eb95 100644 --- a/client/package.json +++ b/client/package.json @@ -79,7 +79,7 @@ "gatsby-remark-prismjs": "5.6.0", "gatsby-source-filesystem": "3.9.0", "gatsby-transformer-remark": "4.6.0", - "i18next": "20.3.2", + "i18next": "20.3.3", "jquery": "3.6.0", "lodash": "4.17.21", "lodash-es": "4.17.21", From 7b327f082bdf0b6bdfdb951e128aeb0403689455 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 14 Jul 2021 09:34:33 +0000 Subject: [PATCH 177/344] fix(deps): update dependency react-i18next to v11.11.2 --- client/package-lock.json | 6 +++--- client/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 34b9c86963..3f5cac070f 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -16798,9 +16798,9 @@ } }, "react-i18next": { - "version": "11.11.1", - "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.11.1.tgz", - "integrity": "sha512-MtfzPEOvx0ev2cz0HmrEcduuqkktSa5bfeN8Flp0cvN0xP3H3MRSTa8P6pxPtqstHbRe1cD9QBOr5T/FEV2gOw==", + "version": "11.11.2", + "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.11.2.tgz", + "integrity": "sha512-42tWoD0X12mJyYtTnK99Hihi2nCc3WIJ23WpUiDwojTWj7w5rfa/cCqo57QLhTFOoYSpG+ydr6Cr1hjtkvmVPw==", "requires": { "@babel/runtime": "^7.14.5", "html-parse-stringify": "^3.0.1" diff --git a/client/package.json b/client/package.json index 969e83eb95..86863f51a0 100644 --- a/client/package.json +++ b/client/package.json @@ -99,7 +99,7 @@ "react-ga": "3.3.0", "react-helmet": "6.1.0", "react-hotkeys": "2.0.0", - "react-i18next": "11.11.1", + "react-i18next": "11.11.2", "react-instantsearch-dom": "6.12.0", "react-lazy-load": "3.1.13", "react-monaco-editor": "0.43.0", From bfc21e4c40a02c451e8d80b0f0a638c1a83ca74f Mon Sep 17 00:00:00 2001 From: gikf <60067306+gikf@users.noreply.github.com> Date: Wed, 14 Jul 2021 13:05:12 +0200 Subject: [PATCH 178/344] fix(curriculum): clean-up Project Euler 141-160 (#42750) * fix: clean-up Project Euler 141-160 * fix: corrections from review Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> * fix: corrections from review Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> * fix: use different notation for consistency * Update curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-144-investigating-multiple-reflections-of-a-laser-beam.md Co-authored-by: gikf <60067306+gikf@users.noreply.github.com> Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> --- ...ressive-numbers-n-which-are-also-square.md | 18 ++--- .../problem-142-perfect-square-collection.md | 10 +-- ...ting-the-torricelli-point-of-a-triangle.md | 16 +++-- ...ng-multiple-reflections-of-a-laser-beam.md | 29 ++++++-- ...ble-numbers-are-there-below-one-billion.md | 12 ++-- ...oblem-146-investigating-a-prime-pattern.md | 12 ++-- ...m-147-rectangles-in-cross-hatched-grids.md | 21 ++++-- .../problem-148-exploring-pascals-triangle.md | 14 ++-- ...searching-for-a-maximum-sum-subsequence.md | 26 ++++--- ...y-for-a-sub-triangle-having-minimum-sum.md | 31 ++++++--- ...tandard-sizes-an-expected-value-problem.md | 16 +++-- ...ng-one-half-as-a-sum-of-inverse-squares.md | 16 +++-- ...lem-153-investigating-gaussian-integers.md | 54 +++++++++------ .../problem-154-exploring-pascals-pyramid.md | 16 +++-- ...problem-155-counting-capacitor-circuits.md | 20 ++++-- .../problem-156-counting-digits.md | 36 +++++++--- ...em-157-solving-the-diophantine-equation.md | 67 ++++++------------- ...hically-after-its-neighbour-to-the-left.md | 14 ++-- ...159-digital-root-sums-of-factorisations.md | 30 ++++++++- .../problem-160-factorial-trailing-digits.md | 22 +++--- 20 files changed, 290 insertions(+), 190 deletions(-) diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-141-investigating-progressive-numbers-n-which-are-also-square.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-141-investigating-progressive-numbers-n-which-are-also-square.md index 4bcd7e069a..6e11220d65 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-141-investigating-progressive-numbers-n-which-are-also-square.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-141-investigating-progressive-numbers-n-which-are-also-square.md @@ -8,22 +8,22 @@ dashedName: problem-141-investigating-progressive-numbers-n-which-are-also-squar # --description-- -A positive integer, n, is divided by d and the quotient and remainder are q and r respectively. In addition d, q, and r are consecutive positive integer terms in a geometric sequence, but not necessarily in that order. +A positive integer, $n$, is divided by $d$ and the quotient and remainder are $q$ and $r$ respectively. In addition $d$, $q$, and $r$ are consecutive positive integer terms in a geometric sequence, but not necessarily in that order. -For example, 58 divided by 6 has quotient 9 and remainder 4. It can also be seen that 4, 6, 9 are consecutive terms in a geometric sequence (common ratio 3/2). +For example, 58 divided by 6 has a quotient of 9 and a remainder of 4. It can also be seen that 4, 6, 9 are consecutive terms in a geometric sequence (common ratio $\frac{3}{2}$). -We will call such numbers, n, progressive. +We will call such numbers, $n$, progressive. -Some progressive numbers, such as 9 and 10404 = 1022, happen to also be perfect squares. The sum of all progressive perfect squares below one hundred thousand is 124657. +Some progressive numbers, such as 9 and 10404 = ${102}^2$, also happen to be perfect squares. The sum of all progressive perfect squares below one hundred thousand is 124657. -Find the sum of all progressive perfect squares below one trillion (1012). +Find the sum of all progressive perfect squares below one trillion (${101}^2$). # --hints-- -`euler141()` should return 878454337159. +`progressivePerfectSquares()` should return `878454337159`. ```js -assert.strictEqual(euler141(), 878454337159); +assert.strictEqual(progressivePerfectSquares(), 878454337159); ``` # --seed-- @@ -31,12 +31,12 @@ assert.strictEqual(euler141(), 878454337159); ## --seed-contents-- ```js -function euler141() { +function progressivePerfectSquares() { return true; } -euler141(); +progressivePerfectSquares(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-142-perfect-square-collection.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-142-perfect-square-collection.md index 03d921eac9..dea7472ce7 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-142-perfect-square-collection.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-142-perfect-square-collection.md @@ -8,14 +8,14 @@ dashedName: problem-142-perfect-square-collection # --description-- -Find the smallest x + y + z with integers x > y > z > 0 such that x + y, x − y, x + z, x − z, y + z, y − z are all perfect squares. +Find the smallest $x + y + z$ with integers $x > y > z > 0$ such that $x + y$, $x − y$, $x + z$, $x − z$, $y + z$, $y − z$ are all perfect squares. # --hints-- -`euler142()` should return 1006193. +`perfectSquareCollection()` should return `1006193`. ```js -assert.strictEqual(euler142(), 1006193); +assert.strictEqual(perfectSquareCollection(), 1006193); ``` # --seed-- @@ -23,12 +23,12 @@ assert.strictEqual(euler142(), 1006193); ## --seed-contents-- ```js -function euler142() { +function perfectSquareCollection() { return true; } -euler142(); +perfectSquareCollection(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-143-investigating-the-torricelli-point-of-a-triangle.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-143-investigating-the-torricelli-point-of-a-triangle.md index fd11d827b7..6e07616d37 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-143-investigating-the-torricelli-point-of-a-triangle.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-143-investigating-the-torricelli-point-of-a-triangle.md @@ -8,20 +8,22 @@ dashedName: problem-143-investigating-the-torricelli-point-of-a-triangle # --description-- -Let ABC be a triangle with all interior angles being less than 120 degrees. Let X be any point inside the triangle and let XA = p, XC = q, and XB = r. +Let ABC be a triangle with all interior angles being less than 120 degrees. Let X be any point inside the triangle and let $XA = p$, $XC = q$, and $XB = r$. Fermat challenged Torricelli to find the position of X such that p + q + r was minimised. -Torricelli was able to prove that if equilateral triangles AOB, BNC and AMC are constructed on each side of triangle ABC, the circumscribed circles of AOB, BNC, and AMC will intersect at a single point, T, inside the triangle. Moreover he proved that T, called the Torricelli/Fermat point, minimises p + q + r. Even more remarkable, it can be shown that when the sum is minimised, AN = BM = CO = p + q + r and that AN, BM and CO also intersect at T. +Torricelli was able to prove that if equilateral triangles AOB, BNC and AMC are constructed on each side of triangle ABC, the circumscribed circles of AOB, BNC, and AMC will intersect at a single point, T, inside the triangle. Moreover he proved that T, called the Torricelli/Fermat point, minimises $p + q + r$. Even more remarkable, it can be shown that when the sum is minimised, $AN = BM = CO = p + q + r$ and that AN, BM and CO also intersect at T. -If the sum is minimised and a, b, c, p, q and r are all positive integers we shall call triangle ABC a Torricelli triangle. For example, a = 399, b = 455, c = 511 is an example of a Torricelli triangle, with p + q + r = 784. Find the sum of all distinct values of p + q + r ≤ 120000 for Torricelli triangles. +equilateral triangles AOB, BNC and AMC constructed on each side of triangle ABC; with the circumscribed circles of AOB, BNC, and AMC will intersecting at a single point, T, inside the triangle + +If the sum is minimised and a, b, c, p, q and r are all positive integers we shall call triangle ABC a Torricelli triangle. For example, $a = 399$, $b = 455$, $c = 511$ is an example of a Torricelli triangle, with $p + q + r = 784$. Find the sum of all distinct values of $p + q + r ≤ 120000$ for Torricelli triangles. # --hints-- -`euler143()` should return 30758397. +`sumTorricelliTriangles()` should return `30758397`. ```js -assert.strictEqual(euler143(), 30758397); +assert.strictEqual(sumTorricelliTriangles(), 30758397); ``` # --seed-- @@ -29,12 +31,12 @@ assert.strictEqual(euler143(), 30758397); ## --seed-contents-- ```js -function euler143() { +function sumTorricelliTriangles() { return true; } -euler143(); +sumTorricelliTriangles(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-144-investigating-multiple-reflections-of-a-laser-beam.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-144-investigating-multiple-reflections-of-a-laser-beam.md index 88d8b1e5a8..a1faca6fb9 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-144-investigating-multiple-reflections-of-a-laser-beam.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-144-investigating-multiple-reflections-of-a-laser-beam.md @@ -10,20 +10,35 @@ dashedName: problem-144-investigating-multiple-reflections-of-a-laser-beam In laser physics, a "white cell" is a mirror system that acts as a delay line for the laser beam. The beam enters the cell, bounces around on the mirrors, and eventually works its way back out. -The specific white cell we will be considering is an ellipse with the equation 4x2 + y2 = 100 +The specific white cell we will be considering is an ellipse with the equation $4{x}^2 + y^2 = 100$ -The section corresponding to −0.01 ≤ x ≤ +0.01 at the top is missing, allowing the light to enter and exit through the hole. +The section corresponding to $−0.01 ≤ x ≤ +0.01$ at the top is missing, allowing the light to enter and exit through the hole. -The light beam in this problem starts at the point (0.0,10.1) just outside the white cell, and the beam first impacts the mirror at (1.4,-9.6). Each time the laser beam hits the surface of the ellipse, it follows the usual law of reflection "angle of incidence equals angle of reflection." That is, both the incident and reflected beams make the same angle with the normal line at the point of incidence. In the figure on the left, the red line shows the first two points of contact between the laser beam and the wall of the white cell; the blue line shows the line tangent to the ellipse at the point of incidence of the first bounce.The slope m of the tangent line at any point (x,y) of the given ellipse is: m = −4x/yThe normal line is perpendicular to this tangent line at the point of incidence. The animation on the right shows the first 10 reflections of the beam. +
          + light beam starting at point (0.0, 10.1), and impacing the mirror at point (1.4, -9.6) + animation with first 10 relfections of the beam +

          + +The light beam in this problem starts at the point (0.0, 10.1) just outside the white cell, and the beam first impacts the mirror at (1.4, -9.6). + +Each time the laser beam hits the surface of the ellipse, it follows the usual law of reflection "angle of incidence equals angle of reflection." That is, both the incident and reflected beams make the same angle with the normal line at the point of incidence. + +In the figure on the left, the red line shows the first two points of contact between the laser beam and the wall of the white cell; the blue line shows the line tangent to the ellipse at the point of incidence of the first bounce. + +The slope m of the tangent line at any point (x, y) of the given ellipse is: $m = −4 × \frac{x}{y}$ + +The normal line is perpendicular to this tangent line at the point of incidence. + +The animation on the right shows the first 10 reflections of the beam. How many times does the beam hit the internal surface of the white cell before exiting? # --hints-- -`euler144()` should return 354. +`laserBeamReflections()` should return `354`. ```js -assert.strictEqual(euler144(), 354); +assert.strictEqual(laserBeamReflections(), 354); ``` # --seed-- @@ -31,12 +46,12 @@ assert.strictEqual(euler144(), 354); ## --seed-contents-- ```js -function euler144() { +function laserBeamReflections() { return true; } -euler144(); +laserBeamReflections(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-145-how-many-reversible-numbers-are-there-below-one-billion.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-145-how-many-reversible-numbers-are-there-below-one-billion.md index 0ec3679a6f..7b72223e78 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-145-how-many-reversible-numbers-are-there-below-one-billion.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-145-how-many-reversible-numbers-are-there-below-one-billion.md @@ -8,18 +8,18 @@ dashedName: problem-145-how-many-reversible-numbers-are-there-below-one-billion # --description-- -Some positive integers n have the property that the sum \[ n + reverse(n) ] consists entirely of odd (decimal) digits. For instance, 36 + 63 = 99 and 409 + 904 = 1313. We will call such numbers reversible; so 36, 63, 409, and 904 are reversible. Leading zeroes are not allowed in either n or reverse(n). +Some positive integers $n$ have the property that the sum [ $n + reverse(n)$ ] consists entirely of odd (decimal) digits. For instance, $36 + 63 = 99$ and $409 + 904 = 1313$. We will call such numbers reversible; so 36, 63, 409, and 904 are reversible. Leading zeroes are not allowed in either $n$ or $reverse(n)$. There are 120 reversible numbers below one-thousand. -How many reversible numbers are there below one-billion (109)? +How many reversible numbers are there below one-billion (${10}^9$)? # --hints-- -`euler145()` should return 608720. +`reversibleNumbers()` should return `608720`. ```js -assert.strictEqual(euler145(), 608720); +assert.strictEqual(reversibleNumbers(), 608720); ``` # --seed-- @@ -27,12 +27,12 @@ assert.strictEqual(euler145(), 608720); ## --seed-contents-- ```js -function euler145() { +function reversibleNumbers() { return true; } -euler145(); +reversibleNumbers(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-146-investigating-a-prime-pattern.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-146-investigating-a-prime-pattern.md index ddfec6766b..ed8f0bd847 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-146-investigating-a-prime-pattern.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-146-investigating-a-prime-pattern.md @@ -8,16 +8,16 @@ dashedName: problem-146-investigating-a-prime-pattern # --description-- -The smallest positive integer n for which the numbers n2+1, n2+3, n2+7, n2+9, n2+13, and n2+27 are consecutive primes is 10. The sum of all such integers n below one-million is 1242490. +The smallest positive integer $n$ for which the numbers $n^2 + 1$, $n^2 + 3$, $n^2 + 7$, $n^2 + 9$, $n^2 + 13$, and $n^2 + 27$ are consecutive primes is 10. The sum of all such integers $n$ below one-million is 1242490. -What is the sum of all such integers n below 150 million? +What is the sum of all such integers $n$ below 150 million? # --hints-- -`euler146()` should return 676333270. +`primePattern()` should return `676333270`. ```js -assert.strictEqual(euler146(), 676333270); +assert.strictEqual(primePattern(), 676333270); ``` # --seed-- @@ -25,12 +25,12 @@ assert.strictEqual(euler146(), 676333270); ## --seed-contents-- ```js -function euler146() { +function primePattern() { return true; } -euler146(); +primePattern(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-147-rectangles-in-cross-hatched-grids.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-147-rectangles-in-cross-hatched-grids.md index 3b422811f6..9d058e4ef5 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-147-rectangles-in-cross-hatched-grids.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-147-rectangles-in-cross-hatched-grids.md @@ -10,7 +10,18 @@ dashedName: problem-147-rectangles-in-cross-hatched-grids In a 3x2 cross-hatched grid, a total of 37 different rectangles could be situated within that grid as indicated in the sketch. -There are 5 grids smaller than 3x2, vertical and horizontal dimensions being important, i.e. 1x1, 2x1, 3x1, 1x2 and 2x2. If each of them is cross-hatched, the following number of different rectangles could be situated within those smaller grids: 1x1: 1 2x1: 4 3x1: 8 1x2: 4 2x2: 18 +ways of situating different rectangles wihtin cross-hatched 3x2 grid + +There are 5 grids smaller than 3x2, vertical and horizontal dimensions being important, i.e. 1x1, 2x1, 3x1, 1x2 and 2x2. If each of them is cross-hatched, the following number of different rectangles could be situated within those smaller grids: + +$$\begin{array}{|c|c|} +\hline + 1 \times 1 & 1 \\\\ \hline + 2 \times 1 & 4 \\\\ \hline + 3 \times 1 & 8 \\\\ \hline + 1 \times 2 & 4 \\\\ \hline + 2 \times 2 & 18 \\\\ \hline +\end{array}$$ Adding those to the 37 of the 3x2 grid, a total of 72 different rectangles could be situated within 3x2 and smaller grids. @@ -18,10 +29,10 @@ How many different rectangles could be situated within 47x43 and smaller grids? # --hints-- -`euler147()` should return 846910284. +`crossHatchedRectangles()` should return `846910284`. ```js -assert.strictEqual(euler147(), 846910284); +assert.strictEqual(crossHatchedRectangles(), 846910284); ``` # --seed-- @@ -29,12 +40,12 @@ assert.strictEqual(euler147(), 846910284); ## --seed-contents-- ```js -function euler147() { +function crossHatchedRectangles() { return true; } -euler147(); +crossHatchedRectangles(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-148-exploring-pascals-triangle.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-148-exploring-pascals-triangle.md index 13babe893b..ecd6bab978 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-148-exploring-pascals-triangle.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-148-exploring-pascals-triangle.md @@ -10,7 +10,7 @@ dashedName: problem-148-exploring-pascals-triangle We can easily verify that none of the entries in the first seven rows of Pascal's triangle are divisible by 7: -
          +```
                       1
                     1   1
                   1   2   1
          @@ -18,20 +18,20 @@ We can easily verify that none of the entries in the first seven rows of Pascal'
               1   4   6   4   1
             1   5   10  10  5   1
           1   6   15  20  15  6   1
          -
          +``` However, if we check the first one hundred rows, we will find that only 2361 of the 5050 entries are not divisible by 7. # --instructions-- -Find the number of entries which are not divisible by 7 in the first one billion (109) rows of Pascal's triangle. +Find the number of entries which are not divisible by 7 in the first one billion (${10}^9$) rows of Pascal's triangle. # --hints-- -`euler148()` should return 2129970655314432. +`entriesOfPascalsTriangle()` should return `2129970655314432`. ```js -assert.strictEqual(euler148(), 2129970655314432); +assert.strictEqual(entriesOfPascalsTriangle(), 2129970655314432); ``` # --seed-- @@ -39,12 +39,12 @@ assert.strictEqual(euler148(), 2129970655314432); ## --seed-contents-- ```js -function euler148() { +function entriesOfPascalsTriangle() { return true; } -euler148(); +entriesOfPascalsTriangle(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-149-searching-for-a-maximum-sum-subsequence.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-149-searching-for-a-maximum-sum-subsequence.md index c76d5370c2..82a1ae17e8 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-149-searching-for-a-maximum-sum-subsequence.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-149-searching-for-a-maximum-sum-subsequence.md @@ -8,28 +8,36 @@ dashedName: problem-149-searching-for-a-maximum-sum-subsequence # --description-- -Looking at the table below, it is easy to verify that the maximum possible sum of adjacent numbers in any direction (horizontal, vertical, diagonal or anti-diagonal) is 16 (= 8 + 7 + 1). +Looking at the table below, it is easy to verify that the maximum possible sum of adjacent numbers in any direction (horizontal, vertical, diagonal or anti-diagonal) is $16 (= 8 + 7 + 1)$. -−25329−6513273−18−4 8 +$$\begin{array}{|r|r|r|r|} + \hline + −2 & 5 & 3 & 2 \\\\ \hline + 9 & −6 & 5 & 1 \\\\ \hline + 3 & 2 & 7 & 3 \\\\ \hline + −1 & 8 & −4 & 8 \\\\ \hline +\end{array}$$ Now, let us repeat the search, but on a much larger scale: First, generate four million pseudo-random numbers using a specific form of what is known as a "Lagged Fibonacci Generator": -For 1 ≤ k ≤ 55, sk = \[100003 − 200003k + 300007k3] (modulo 1000000) − 500000. For 56 ≤ k ≤ 4000000, sk = \[sk−24 + sk−55 + 1000000] (modulo 1000000) − 500000. +For $1 ≤ k ≤ 55$, $s_k = (100003 − 200003k + 300007{k}^3) \\ (modulo\\ 1000000) − 500000$. -Thus, s10 = −393027 and s100 = 86613. +For $56 ≤ k ≤ 4000000$, $s_k = (s_{k − 24} + s_{k − 55} + 1000000) \\ (modulo\\ 1000000) − 500000$. -The terms of s are then arranged in a 2000×2000 table, using the first 2000 numbers to fill the first row (sequentially), the next 2000 numbers to fill the second row, and so on. +Thus, $s_{10} = −393027$ and $s_{100} = 86613$. + +The terms of $s$ are then arranged in a 2000×2000 table, using the first 2000 numbers to fill the first row (sequentially), the next 2000 numbers to fill the second row, and so on. Finally, find the greatest sum of (any number of) adjacent entries in any direction (horizontal, vertical, diagonal or anti-diagonal). # --hints-- -`euler149()` should return 52852124. +`maximumSubSequence()` should return `52852124`. ```js -assert.strictEqual(euler149(), 52852124); +assert.strictEqual(maximumSubSequence(), 52852124); ``` # --seed-- @@ -37,12 +45,12 @@ assert.strictEqual(euler149(), 52852124); ## --seed-contents-- ```js -function euler149() { +function maximumSubSequence() { return true; } -euler149(); +maximumSubSequence(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.md index b632361a8b..950104d8ac 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.md @@ -14,15 +14,28 @@ In a triangular array of positive and negative integers, we wish to find a sub-t In the example below, it can be easily verified that the marked triangle satisfies this condition having a sum of −42. -We wish to make such a triangular array with one thousand rows, so we generate 500500 pseudo-random numbers sk in the range ±219, using a type of random number generator (known as a Linear Congruential Generator) as follows: t := 0 +triangular array, with marked sub-triangle, having sum of -42 -for k = 1 up to k = 500500: +We wish to make such a triangular array with one thousand rows, so we generate 500500 pseudo-random numbers $s_k$ in the range $±2^{19}$, using a type of random number generator (known as a Linear Congruential Generator) as follows: -t := (615949\*t + 797807) modulo 220 sk := t−219 Thus: s1 = 273519, s2 = −153582, s3 = 450905 etc Our triangular array is then formed using the pseudo-random numbers thus: +$$\begin{align} + t := & \\ 0\\\\ + \text{for}\\ & k = 1\\ \text{up to}\\ k = 500500:\\\\ + & t := (615949 × t + 797807)\\ \text{modulo}\\ 2^{20}\\\\ + & s_k := t − 219\\\\ +\end{align}$$ -s1 s2 s3 s4 s5 s6 +Thus: $s_1 = 273519$, $s_2 = −153582$, $s_3 = 450905$ etc. -s7 s8 s9 s10 ... +Our triangular array is then formed using the pseudo-random numbers thus: + +$$ +s_1 \\\\ +s_2\\;s_3 \\\\ +s_4\\; s_5\\; s_6 \\\\ +s_7\\; s_8\\; s_9\\; s_{10} \\\\ +\ldots +$$ Sub-triangles can start at any element of the array and extend down as far as we like (taking-in the two elements directly below it from the next row, the three elements directly below from the row after that, and so on). @@ -32,10 +45,10 @@ Find the smallest possible sub-triangle sum. # --hints-- -`euler150()` should return -271248680. +`smallestSubTriangleSum()` should return `-271248680`. ```js -assert.strictEqual(euler150(), -271248680); +assert.strictEqual(smallestSubTriangleSum(), -271248680); ``` # --seed-- @@ -43,12 +56,12 @@ assert.strictEqual(euler150(), -271248680); ## --seed-contents-- ```js -function euler150() { +function smallestSubTriangleSum() { return true; } -euler150(); +smallestSubTriangleSum(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-151-paper-sheets-of-standard-sizes-an-expected-value-problem.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-151-paper-sheets-of-standard-sizes-an-expected-value-problem.md index e75e5a0fdf..cd06eb57a3 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-151-paper-sheets-of-standard-sizes-an-expected-value-problem.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-151-paper-sheets-of-standard-sizes-an-expected-value-problem.md @@ -16,14 +16,20 @@ He proceeds to cut it in half, thus getting two sheets of size A2. Then he cuts All the unused sheets are placed back in the envelope. -At the beginning of each subsequent batch, he takes from the envelope one sheet of paper at random. If it is of size A5, he uses it. If it is larger, he repeats the 'cut-in-half' procedure until he has what he needs and any remaining sheets are always placed back in the envelope. Excluding the first and last batch of the week, find the expected number of times (during each week) that the foreman finds a single sheet of paper in the envelope. Give your answer rounded to six decimal places using the format x.xxxxxx . +A1-size sheet split into: A2, A3, A4 and two A5 sheets + +At the beginning of each subsequent batch, he takes one sheet of paper from the envelope at random. If it is of size A5, he uses it. If it is larger, he repeats the 'cut-in-half' procedure until he has what he needs, and any remaining sheets are always placed back in the envelope. + +Excluding the first and last batch of the week, find the expected number of times (during each week) that the foreman finds a single sheet of paper in the envelope. + +Give your answer rounded to six decimal places using the format `x.xxxxxx`. # --hints-- -`euler151()` should return 0.464399. +`expectedValueProblem()` should return `0.464399`. ```js -assert.strictEqual(euler151(), 0.464399); +assert.strictEqual(expectedValueProblem(), 0.464399); ``` # --seed-- @@ -31,12 +37,12 @@ assert.strictEqual(euler151(), 0.464399); ## --seed-contents-- ```js -function euler151() { +function expectedValueProblem() { return true; } -euler151(); +expectedValueProblem(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-152-writing-one-half-as-a-sum-of-inverse-squares.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-152-writing-one-half-as-a-sum-of-inverse-squares.md index 1acd9f0652..79a7bd516d 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-152-writing-one-half-as-a-sum-of-inverse-squares.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-152-writing-one-half-as-a-sum-of-inverse-squares.md @@ -8,18 +8,22 @@ dashedName: problem-152-writing-one-half-as-a-sum-of-inverse-squares # --description-- -There are several ways to write the number 1/2 as a sum of inverse squares using distinct integers. +There are several ways to write the number $\frac{1}{2}$ as a sum of inverse squares using distinct integers. For instance, the numbers {2,3,4,5,7,12,15,20,28,35} can be used: -In fact, only using integers between 2 and 45 inclusive, there are exactly three ways to do it, the remaining two being: {2,3,4,6,7,9,10,20,28,35,36,45} and {2,3,4,6,7,9,12,15,28,30,35,36,45}. How many ways are there to write the number 1/2 as a sum of inverse squares using distinct integers between 2 and 80 inclusive? +$$\frac{1}{2} = \frac{1}{2^2} + \frac{1}{3^2} + \frac{1}{4^2} + \frac{1}{5^2} + \frac{1}{7^2} + \frac{1}{{12}^2} + \frac{1}{{15}^2} + \frac{1}{{20}^2} + \frac{1}{{28}^2} + \frac{1}{{35}^2}$$ + +In fact, only using integers between 2 and 45 inclusive, there are exactly three ways to do it, the remaining two being: {2,3,4,6,7,9,10,20,28,35,36,45} and {2,3,4,6,7,9,12,15,28,30,35,36,45}. + +How many ways are there to write the number $\frac{1}{2}$ as a sum of inverse squares using distinct integers between 2 and 80 inclusive? # --hints-- -`euler152()` should return 301. +`sumInverseSquares()` should return `301`. ```js -assert.strictEqual(euler152(), 301); +assert.strictEqual(sumInverseSquares(), 301); ``` # --seed-- @@ -27,12 +31,12 @@ assert.strictEqual(euler152(), 301); ## --seed-contents-- ```js -function euler152() { +function sumInverseSquares() { return true; } -euler152(); +sumInverseSquares(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-153-investigating-gaussian-integers.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-153-investigating-gaussian-integers.md index b1eaa92c44..21ea252f64 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-153-investigating-gaussian-integers.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-153-investigating-gaussian-integers.md @@ -8,46 +8,60 @@ dashedName: problem-153-investigating-gaussian-integers # --description-- -As we all know the equation x2=-1 has no solutions for real x. +As we all know the equation $x^2 = -1$ has no solutions for real $x$. -If we however introduce the imaginary number i this equation has two solutions: x=i and x=-i. +If we however introduce the imaginary number $i$ this equation has two solutions: $x = i$ and $x = -i$. -If we go a step further the equation (x-3)2=-4 has two complex solutions: x=3+2i and x=3-2i. x=3+2i and x=3-2i are called each others' complex conjugate. +If we go a step further the equation ${(x - 3)}^2 = -4$ has two complex solutions: $x = 3 + 2i$ and $x = 3 - 2i$, which are called each others' complex conjugate. -Numbers of the form a+bi are called complex numbers. +Numbers of the form $a + bi$ are called complex numbers. -In general a+bi and a−bi are each other's complex conjugate. A Gaussian Integer is a complex number a+bi such that both a and b are integers. +In general $a + bi$ and $a − bi$ are each other's complex conjugate. A Gaussian Integer is a complex number $a + bi$ such that both $a$ and $b$ are integers. -The regular integers are also Gaussian integers (with b=0). +The regular integers are also Gaussian integers (with $b = 0$). -To distinguish them from Gaussian integers with b ≠ 0 we call such integers "rational integers." +To distinguish them from Gaussian integers with $b ≠ 0$ we call such integers "rational integers." -A Gaussian integer is called a divisor of a rational integer n if the result is also a Gaussian integer. +A Gaussian integer is called a divisor of a rational integer $n$ if the result is also a Gaussian integer. -If for example we divide 5 by 1+2i we can simplify in the following manner: +If for example we divide 5 by $1 + 2i$ we can simplify in the following manner: -Multiply numerator and denominator by the complex conjugate of 1+2i: 1−2i. +Multiply numerator and denominator by the complex conjugate of $1 + 2i$: $1 − 2i$. -The result is . +The result is: -So 1+2i is a divisor of 5. +$$\frac{5}{1 + 2i} = \frac{5}{1 + 2i} \frac{1 - 2i}{1 - 2i} = \frac{5(1 - 2i)}{1 - {(2i)}^2} = \frac{5(1 - 2i)}{1 - (-4)} = \frac{5(1 - 2i)}{5} = 1 - 2i$$ -Note that 1+i is not a divisor of 5 because . +So $1 + 2i$ is a divisor of 5. -Note also that if the Gaussian Integer (a+bi) is a divisor of a rational integer n, then its complex conjugate (a−bi) is also a divisor of n. In fact, 5 has six divisors such that the real part is positive: {1, 1 + 2i, 1 − 2i, 2 + i, 2 − i, 5}. +Note that $1 + i$ is not a divisor of 5 because: + +$$\frac{5}{1 + i} = \frac{5}{2} - \frac{5}{2}i$$ + +Note also that if the Gaussian Integer ($a + bi$) is a divisor of a rational integer $n$, then its complex conjugate ($a − bi$) is also a divisor of $n$. In fact, 5 has six divisors such that the real part is positive: {1, 1 + 2i, 1 − 2i, 2 + i, 2 − i, 5}. The following is a table of all of the divisors for the first five positive rational integers: -n Gaussian integer divisors with positive real partSum s(n) of these +| n | Gaussian integer divisors with positive real part | Sum s(n) of these divisors | +|---|---------------------------------------------------|----------------------------| +| 1 | 1 | 1 | +| 2 | 1, 1 + i, 1 - i, 2 | 5 | +| 3 | 1, 3 | 4 | +| 4 | 1, 1 + i, 1 - i, 2, 2 + 2i, 2 - 2i, 4 | 13 | +| 5 | 1, 1 + 2i, 1 - 2i, 2 + i, 2 - i, 5 | 12 | -divisors111 21, 1+i, 1-i, 25 31, 34 41, 1+i, 1-i, 2, 2+2i, 2-2i,413 51, 1+2i, 1-2i, 2+i, 2-i, 512 For divisors with positive real parts, then, we have: . For 1 ≤ n ≤ 105, ∑ s(n)=17924657155. What is ∑ s(n) for 1 ≤ n ≤ 108? +For divisors with positive real parts, then, we have: $\displaystyle\sum_{n=1}^5 s(n) = 35$. + +For $1 ≤ n ≤ {10}^5$, $\displaystyle\sum_{n = 1}^{{10}^5} s(n) = 17924657155$. + +What is $\displaystyle\sum_{n=1}^{{10}^8} s(n)$? # --hints-- -`euler153()` should return 17971254122360636. +`sumGaussianIntegers()` should return `17971254122360636`. ```js -assert.strictEqual(euler153(), 17971254122360636); +assert.strictEqual(sumGaussianIntegers(), 17971254122360636); ``` # --seed-- @@ -55,12 +69,12 @@ assert.strictEqual(euler153(), 17971254122360636); ## --seed-contents-- ```js -function euler153() { +function sumGaussianIntegers() { return true; } -euler153(); +sumGaussianIntegers(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-154-exploring-pascals-pyramid.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-154-exploring-pascals-pyramid.md index 8d8abe0dfc..50401fee04 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-154-exploring-pascals-pyramid.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-154-exploring-pascals-pyramid.md @@ -10,14 +10,20 @@ dashedName: problem-154-exploring-pascals-pyramid A triangular pyramid is constructed using spherical balls so that each ball rests on exactly three balls of the next lower level. -Then, we calculate the number of paths leading from the apex to each position: A path starts at the apex and progresses downwards to any of the three spheres directly below the current position. Consequently, the number of paths to reach a certain position is the sum of the numbers immediately above it (depending on the position, there are up to three numbers above it). The result is Pascal's pyramid and the numbers at each level n are the coefficients of the trinomial expansion (x + y + z)n. How many coefficients in the expansion of (x + y + z)200000 are multiples of 1012? +triangular pyramid constructed using spherical balls with four levels + +Then, we calculate the number of paths leading from the apex to each position: A path starts at the apex and progresses downwards to any of the three spheres directly below the current position. Consequently, the number of paths to reach a certain position is the sum of the numbers immediately above it (depending on the position, there are up to three numbers above it). + +The result is Pascal's pyramid and the numbers at each level n are the coefficients of the trinomial expansion ${(x + y + z)}^n$. + +How many coefficients in the expansion of ${(x + y + z)}^{200000}$ are multiples of ${10}^{12}$? # --hints-- -`euler154()` should return 479742450. +`pascalsPyramid()` should return `479742450`. ```js -assert.strictEqual(euler154(), 479742450); +assert.strictEqual(pascalsPyramid(), 479742450); ``` # --seed-- @@ -25,12 +31,12 @@ assert.strictEqual(euler154(), 479742450); ## --seed-contents-- ```js -function euler154() { +function pascalsPyramid() { return true; } -euler154(); +pascalsPyramid(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-155-counting-capacitor-circuits.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-155-counting-capacitor-circuits.md index 404c223c6a..d79411a0d1 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-155-counting-capacitor-circuits.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-155-counting-capacitor-circuits.md @@ -10,18 +10,24 @@ dashedName: problem-155-counting-capacitor-circuits An electric circuit uses exclusively identical capacitors of the same value C. -The capacitors can be connected in series or in parallel to form sub-units, which can then be connected in series or in parallel with other capacitors or other sub-units to form larger sub-units, and so on up to a final circuit. Using this simple procedure and up to n identical capacitors, we can make circuits having a range of different total capacitances. For example, using up to n=3 capacitors of 60 F each, we can obtain the following 7 distinct total capacitance values: +The capacitors can be connected in series or in parallel to form sub-units, which can then be connected in series or in parallel with other capacitors or other sub-units to form larger sub-units, and so on up to a final circuit. -If we denote by D(n) the number of distinct total capacitance values we can obtain when using up to n equal-valued capacitors and the simple procedure described above, we have: D(1)=1, D(2)=3, D(3)=7 ... Find D(18). Reminder : When connecting capacitors C1, C2 etc in parallel, the total capacitance is CT = C1 + C2 +..., +Using this simple procedure and up to n identical capacitors, we can make circuits having a range of different total capacitances. For example, using up to $n = 3$ capacitors of $60 μF$ each, we can obtain the following 7 distinct total capacitance values: -whereas when connecting them in series, the overall capacitance is given by: +example circuits having up to three capacitors, each of 60 μF + +If we denote by $D(n)$ the number of distinct total capacitance values we can obtain when using up to $n$ equal-valued capacitors and the simple procedure described above, we have: $D(1) = 1, D(2) = 3, D(3)=7, \ldots$ + +Find $D(18)$. + +Reminder: When connecting capacitors $C_1$, $C_2$ etc in parallel, the total capacitance is $C_T = C_1 + C_2 + \cdots$, whereas when connecting them in series, the overall capacitance is given by: $\frac{1}{C_T} = \frac{1}{C_1} + \frac{1}{C_2} + \cdots$. # --hints-- -`euler155()` should return 3857447. +`capacitanceValues()` should return `3857447`. ```js -assert.strictEqual(euler155(), 3857447); +assert.strictEqual(capacitanceValues(), 3857447); ``` # --seed-- @@ -29,12 +35,12 @@ assert.strictEqual(euler155(), 3857447); ## --seed-contents-- ```js -function euler155() { +function capacitanceValues() { return true; } -euler155(); +capacitanceValues(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-156-counting-digits.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-156-counting-digits.md index 3ab75c957b..1c2967051b 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-156-counting-digits.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-156-counting-digits.md @@ -12,24 +12,40 @@ Starting from zero the natural numbers are written down in base 10 like this: 0 1 2 3 4 5 6 7 8 9 10 11 12.... -Consider the digit d=1. After we write down each number n, we will update the number of ones that have occurred and call this number f(n,1). The first values for f(n,1), then, are as follows: +Consider the digit $d = 1$. After we write down each number n, we will update the number of ones that have occurred and call this number $f(n, 1)$. The first values for $f(n, 1)$, then, are as follows: -nf(n,1) 00 11 21 31 41 51 61 71 81 91 102 114 125 +| $n$ | $f(n, 1)$ | +|-----|-----------| +| 0 | 0 | +| 1 | 1 | +| 2 | 1 | +| 3 | 1 | +| 4 | 1 | +| 5 | 1 | +| 6 | 1 | +| 7 | 1 | +| 8 | 1 | +| 9 | 1 | +| 10 | 2 | +| 11 | 4 | +| 12 | 5 | -Note that f(n,1) never equals 3. +Note that $f(n, 1)$ never equals 3. -So the first two solutions of the equation f(n,1)=n are n=0 and n=1. The next solution is n=199981. In the same manner the function f(n,d) gives the total number of digits d that have been written down after the number n has been written. +So the first two solutions of the equation $f(n, 1) = n$ are $n = 0$ and $n = 1$. The next solution is $n = 199981$. In the same manner the function $f(n, d)$ gives the total number of digits d that have been written down after the number $n$ has been written. -In fact, for every digit d ≠ 0, 0 is the first solution of the equation f(n,d)=n. Let s(d) be the sum of all the solutions for which f(n,d)=n. +In fact, for every digit $d ≠ 0$, 0 is the first solution of the equation $f(n, d) = n$. Let $s(d)$ be the sum of all the solutions for which $f(n, d) = n$. -You are given that s(1)=22786974071. Find ∑ s(d) for 1 ≤ d ≤ 9. Note: if, for some n, f(n,d)=n for more than one value of d this value of n is counted again for every value of d for which f(n,d)=n. +You are given that $s(1) = 22786974071$. Find $\sum{s(d)}$ for $1 ≤ d ≤ 9$. + +Note: if, for some $n$, $f(n, d) = n$ for more than one value of $d$ this value of $n$ is counted again for every value of $d$ for which $f(n, d) = n$. # --hints-- -`euler156()` should return 21295121502550. +`countingDigits()` should return `21295121502550`. ```js -assert.strictEqual(euler156(), 21295121502550); +assert.strictEqual(countingDigits(), 21295121502550); ``` # --seed-- @@ -37,12 +53,12 @@ assert.strictEqual(euler156(), 21295121502550); ## --seed-contents-- ```js -function euler156() { +function countingDigits() { return true; } -euler156(); +countingDigits(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-157-solving-the-diophantine-equation.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-157-solving-the-diophantine-equation.md index fa1e327051..8640d87695 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-157-solving-the-diophantine-equation.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-157-solving-the-diophantine-equation.md @@ -8,58 +8,33 @@ dashedName: problem-157-solving-the-diophantine-equation # --description-- -Consider the diophantine equation 1/a+1/b= p/10n with a, b, p, n positive integers and a ≤ b. +Consider the diophantine equation $\frac{1}{a} + \frac{1}{b} = \frac{p}{{10}^n}$ with $a$, $b$, $p$, $n$ positive integers and $a ≤ b$. -For n=1 this equation has 20 solutions that are listed below: +For $n = 1$ this equation has 20 solutions that are listed below: -1/1+1/1=20/10 +$$\begin{array}{lllll} + \frac{1}{1} + \frac{1}{1} = \frac{20}{10} & \frac{1}{1} + \frac{1}{2} = \frac{15}{10} +& \frac{1}{1} + \frac{1}{5} = \frac{12}{10} & \frac{1}{1} + \frac{1}{10} = \frac{11}{10} +& \frac{1}{2} + \frac{1}{2} = \frac{10}{10} \\\\ + \frac{1}{2} + \frac{1}{5} = \frac{7}{10} & \frac{1}{2} + \frac{1}{10} = \frac{6}{10} +& \frac{1}{3} + \frac{1}{6} = \frac{5}{10} & \frac{1}{3} + \frac{1}{15} = \frac{4}{10} +& \frac{1}{4} + \frac{1}{4} = \frac{5}{10} \\\\ + \frac{1}{4} + \frac{1}{4} = \frac{5}{10} & \frac{1}{5} + \frac{1}{5} = \frac{4}{10} +& \frac{1}{5} + \frac{1}{10} = \frac{3}{10} & \frac{1}{6} + \frac{1}{30} = \frac{2}{10} +& \frac{1}{10} + \frac{1}{10} = \frac{2}{10} \\\\ + \frac{1}{11} + \frac{1}{110} = \frac{1}{10} & \frac{1}{12} + \frac{1}{60} = \frac{1}{10} +& \frac{1}{14} + \frac{1}{35} = \frac{1}{10} & \frac{1}{15} + \frac{1}{30} = \frac{1}{10} +& \frac{1}{20} + \frac{1}{20} = \frac{1}{10} +\end{array}$$ -1/1+1/2=15/10 - -1/1+1/5=12/10 - -1/1+1/10=11/10 - -1/2+1/2=10/10 - -1/2+1/5=7/10 - -1/2+1/10=6/10 - -1/3+1/6=5/10 - -1/3+1/15=4/10 - -1/4+1/4=5/10 - -1/4+1/20=3/10 - -1/5+1/5=4/10 - -1/5+1/10=3/10 - -1/6+1/30=2/10 - -1/10+1/10=2/10 - -1/11+1/110=1/10 - -1/12+1/60=1/10 - -1/14+1/35=1/10 - -1/15+1/30=1/10 - -1/20+1/20=1/10 - -How many solutions has this equation for 1 ≤ n ≤ 9? +How many solutions has this equation for $1 ≤ n ≤ 9$? # --hints-- -`euler157()` should return 53490. +`diophantineEquation()` should return `53490`. ```js -assert.strictEqual(euler157(), 53490); +assert.strictEqual(diophantineEquation(), 53490); ``` # --seed-- @@ -67,12 +42,12 @@ assert.strictEqual(euler157(), 53490); ## --seed-contents-- ```js -function euler157() { +function diophantineEquation() { return true; } -euler157(); +diophantineEquation(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md index c447c7ce9f..b8658b5899 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md @@ -21,18 +21,18 @@ For 'hat' there is exactly one character that comes lexicographically after its In all there are 10400 strings of length 3 for which exactly one character comes lexicographically after its neighbour to the left. -We now consider strings of n ≤ 26 different characters from the alphabet. +We now consider strings of $n ≤ 26$ different characters from the alphabet. -For every n, p(n) is the number of strings of length n for which exactly one character comes lexicographically after its neighbour to the left. +For every $n$, $p(n)$ is the number of strings of length $n$ for which exactly one character comes lexicographically after its neighbour to the left. -What is the maximum value of p(n)? +What is the maximum value of $p(n)$? # --hints-- -`euler158()` should return 409511334375. +`lexicographicNeighbours()` should return `409511334375`. ```js -assert.strictEqual(euler158(), 409511334375); +assert.strictEqual(lexicographicNeighbours(), 409511334375); ``` # --seed-- @@ -40,12 +40,12 @@ assert.strictEqual(euler158(), 409511334375); ## --seed-contents-- ```js -function euler158() { +function lexicographicNeighbours() { return true; } -euler158(); +lexicographicNeighbours(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-159-digital-root-sums-of-factorisations.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-159-digital-root-sums-of-factorisations.md index b5e3b4945b..10e00d1920 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-159-digital-root-sums-of-factorisations.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-159-digital-root-sums-of-factorisations.md @@ -12,13 +12,37 @@ A composite number can be factored many different ways. For instance, not including multiplication by one, 24 can be factored in 7 distinct ways: -24 = 2x2x2x3 24 = 2x3x4 24 = 2x2x6 24 = 4x6 24 = 3x8 24 = 2x12 24 = 24 +$$\begin{align} + & 24 = 2 \times 2 \times 2 \times 3\\\\ + & 24 = 2 \times 3 \times 4 \\\\ + & 24 = 2 \times 2 \times 6 \\\\ + & 24 = 4 \times 6 \\\\ + & 24 = 3 \times 8 \\\\ + & 24 = 2 \times 12 \\\\ + & 24 = 24 +\end{align}$$ -Recall that the digital root of a number, in base 10, is found by adding together the digits of that number, and repeating that process until a number is arrived at that is less than 10. Thus the digital root of 467 is 8. We shall call a Digital Root Sum (DRS) the sum of the digital roots of the individual factors of our number. The chart below demonstrates all of the DRS values for 24. FactorisationDigital Root Sum2x2x2x3 92x3x4 92x2x6 104x6 103x8 112x12 524 6The maximum Digital Root Sum of 24 is 11. The function mdrs(n) gives the maximum Digital Root Sum of n. So mdrs(24)=11. Find ∑mdrs(n) for 1 < n < 1,000,000. +Recall that the digital root of a number, in base 10, is found by adding together the digits of that number, and repeating that process until a number arrives at less than 10. Thus the digital root of 467 is 8. + +We shall call a Digital Root Sum (DRS) the sum of the digital roots of the individual factors of our number. The chart below demonstrates all of the DRS values for 24. + +| Factorisation | Digital Root Sum | +|---------------|------------------| +| 2x2x2x3 | 9 | +| 2x3x4 | 9 | +| 2x2x6 | 10 | +| 4x6 | 10 | +| 3x8 | 11 | +| 2x12 | 5 | +| 24 | 6 | + +The maximum Digital Root Sum of 24 is 11. The function $mdrs(n)$ gives the maximum Digital Root Sum of $n$. So $mdrs(24) = 11$. + +Find $\sum{mdrs(n)}$ for $1 < n < 1,000,000$. # --hints-- -`euler159()` should return 14489159. +`euler159()` should return `14489159`. ```js assert.strictEqual(euler159(), 14489159); diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-160-factorial-trailing-digits.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-160-factorial-trailing-digits.md index c7319ba84c..bd08ab9a84 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-160-factorial-trailing-digits.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-160-factorial-trailing-digits.md @@ -8,24 +8,24 @@ dashedName: problem-160-factorial-trailing-digits # --description-- -For any N, let f(N) be the last five digits before the trailing zeroes in N!. +For any $N$, let $f(N)$ be the last five digits before the trailing zeroes in $N!$. For example, -9! = 362880 so f(9)=36288 +$$\begin{align} + & 9! = 362880 \\; \text{so} \\; f(9) = 36288 \\\\ + & 10! = 3628800 \\; \text{so} \\; f(10) = 36288 \\\\ + & 20! = 2432902008176640000 \\; \text{so} \\; f(20) = 17664 +\end{align}$$ -10! = 3628800 so f(10)=36288 - -20! = 2432902008176640000 so f(20)=17664 - -Find f(1,000,000,000,000) +Find $f(1,000,000,000,000)$ # --hints-- -`euler160()` should return 16576. +`factorialTrailingDigits()` should return `16576`. ```js -assert.strictEqual(euler160(), 16576); +assert.strictEqual(factorialTrailingDigits(), 16576); ``` # --seed-- @@ -33,12 +33,12 @@ assert.strictEqual(euler160(), 16576); ## --seed-contents-- ```js -function euler160() { +function factorialTrailingDigits() { return true; } -euler160(); +factorialTrailingDigits(); ``` # --solutions-- From 2f8c5619ffd06bc7bd52e657b604265da711a209 Mon Sep 17 00:00:00 2001 From: camperbot Date: Wed, 14 Jul 2021 19:52:21 +0530 Subject: [PATCH 179/344] chore(i18n,client): processed translations (#42856) --- client/i18n/locales/chinese-traditional/intro.json | 12 ++++++------ client/i18n/locales/chinese/intro.json | 12 ++++++------ client/i18n/locales/espanol/intro.json | 14 +++++++------- client/i18n/locales/italian/intro.json | 12 ++++++------ client/i18n/locales/portuguese/intro.json | 12 ++++++------ 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/client/i18n/locales/chinese-traditional/intro.json b/client/i18n/locales/chinese-traditional/intro.json index 5d9c6a0bcc..68dc827c61 100644 --- a/client/i18n/locales/chinese-traditional/intro.json +++ b/client/i18n/locales/chinese-traditional/intro.json @@ -92,9 +92,9 @@ "intro": [ "HTML 和 CSS 控制頁面的內容和樣式,JavaScript 則用於頁面交互。在 JavaScript 算法和數據結構認證中,你將學習 JavaScript 的基礎知識,包括變量、 數組、 對象、 循環和函數。", "打好基礎之後,你將會通過創建算法來操作字符串、進行階乘運算甚至計算國際空間站的軌道來應用這些知識。", - "在這個過程中,你還會學習兩種重要的編程方式或模式:面向對象的編程(OOP)和函數式編程(FP)。" + "Along the way, you'll also learn two important programming styles or paradigms: Object Oriented Programming (OOP) and Functional Programming (FP)." ], - "note": "注意:某些瀏覽器擴展,例如廣告攔截器和腳本攔截器,可能干擾測試。如果你遇到問題,我們建議你在學習時禁用修改或阻止頁面內容的擴展。", + "note": "Note: Some browser extensions, such as ad-blockers and script-blockers can interfere with the tests. If you face issues, we recommend disabling extensions that modify or block the content of pages while taking the course.", "blocks": { "basic-javascript": { "title": "基礎 JavaScript", @@ -107,7 +107,7 @@ "title": "ES6", "intro": [ "ECMAScript(ES)是 JavaScript 的標準。因爲所有主流瀏覽器都遵循此規範,所以 ECMAScript 和 JavaScript 是可以互換的。", - "截至目前你所學到的 JavaScript 大多是在 2009 年定稿的 ES5(ECMAScript5)。你仍然可以使用 ES5 編寫程序。JavaScript 在不斷迭代,每年都會發布新功能。", + "Most of the JavaScript you've learned up to this point was in ES5 (ECMAScript 5), which was finalized in 2009. While you can still write programs in ES5, JavaScript is constantly evolving, and new features are released every year.", "2015 年發佈的 ES6 爲該語言增加了許多強大的新功能。在這個課程中,你將學習這些新功能,包括 letconst、箭頭函數、類、promises 和模塊。" ] }, @@ -137,15 +137,15 @@ "title": "基礎算法", "intro": [ "算法是描述如何處理某個問題的一系列步驟。", - "要寫一個有效的算法,你需要先將一個特定的問題分解爲小的部分,並仔細思考如何用代碼解決每個部分。", + "To write an effective algorithm, it helps to break a problem down into smaller parts and think carefully about how to solve each part with code.", "在這個課程中,你將通過編寫算法來實現諸如轉換溫度、處理複雜的二維數組等,來學習算法思維的基礎知識。" ] }, "object-oriented-programming": { "title": "面向對象編程", "intro": [ - "OOP,即面向對象編程,是軟件開發過程的主要方法之一。在 OOP 中,我們用對象和類來組織代碼,以描述事物的特點以及它們可以做什麼。", - "在這個課程中,你將會學習 JavaScript 中面向對象編程的基本原則,例如 this 關鍵詞、原型鏈、構造器和繼承。" + "OOP, or Object Oriented Programming, is one of the major approaches to the software development process. In OOP, objects and classes organize code to describe things and what they can do.", + "In this course, you'll learn the basic principles of OOP in JavaScript, including the this keyword, prototype chains, constructors, and inheritance." ] }, "functional-programming": { diff --git a/client/i18n/locales/chinese/intro.json b/client/i18n/locales/chinese/intro.json index 2b441d932c..62ad0c0eee 100644 --- a/client/i18n/locales/chinese/intro.json +++ b/client/i18n/locales/chinese/intro.json @@ -92,9 +92,9 @@ "intro": [ "HTML 和 CSS 控制页面的内容和样式,JavaScript 则用于页面交互。在 JavaScript 算法和数据结构认证中,你将学习 JavaScript 的基础知识,包括变量、 数组、 对象、 循环和函数。", "打好基础之后,你将会通过创建算法来操作字符串、进行阶乘运算甚至计算国际空间站的轨道来应用这些知识。", - "在这个过程中,你还会学习两种重要的编程方式或模式:面向对象的编程(OOP)和函数式编程(FP)。" + "Along the way, you'll also learn two important programming styles or paradigms: Object Oriented Programming (OOP) and Functional Programming (FP)." ], - "note": "注意:某些浏览器扩展,例如广告拦截器和脚本拦截器,可能干扰测试。如果你遇到问题,我们建议你在学习时禁用修改或阻止页面内容的扩展。", + "note": "Note: Some browser extensions, such as ad-blockers and script-blockers can interfere with the tests. If you face issues, we recommend disabling extensions that modify or block the content of pages while taking the course.", "blocks": { "basic-javascript": { "title": "基础 JavaScript", @@ -107,7 +107,7 @@ "title": "ES6", "intro": [ "ECMAScript(ES)是 JavaScript 的标准。因为所有主流浏览器都遵循此规范,所以 ECMAScript 和 JavaScript 是可以互换的。", - "截至目前你所学到的 JavaScript 大多是在 2009 年定稿的 ES5(ECMAScript5)。你仍然可以使用 ES5 编写程序。JavaScript 在不断迭代,每年都会发布新功能。", + "Most of the JavaScript you've learned up to this point was in ES5 (ECMAScript 5), which was finalized in 2009. While you can still write programs in ES5, JavaScript is constantly evolving, and new features are released every year.", "2015 年发布的 ES6 为该语言增加了许多强大的新功能。在这个课程中,你将学习这些新功能,包括 letconst、箭头函数、类、promises 和模块。" ] }, @@ -137,15 +137,15 @@ "title": "基础算法", "intro": [ "算法是描述如何处理某个问题的一系列步骤。", - "要写一个有效的算法,你需要先将一个特定的问题分解为小的部分,并仔细思考如何用代码解决每个部分。", + "To write an effective algorithm, it helps to break a problem down into smaller parts and think carefully about how to solve each part with code.", "在这个课程中,你将通过编写算法来实现诸如转换温度、处理复杂的二维数组等,来学习算法思维的基础知识。" ] }, "object-oriented-programming": { "title": "面向对象编程", "intro": [ - "OOP,即面向对象编程,是软件开发过程的主要方法之一。在 OOP 中,我们用对象和类来组织代码,以描述事物的特点以及它们可以做什么。", - "在这个课程中,你将会学习 JavaScript 中面向对象编程的基本原则,例如 this 关键词、原型链、构造器和继承。" + "OOP, or Object Oriented Programming, is one of the major approaches to the software development process. In OOP, objects and classes organize code to describe things and what they can do.", + "In this course, you'll learn the basic principles of OOP in JavaScript, including the this keyword, prototype chains, constructors, and inheritance." ] }, "functional-programming": { diff --git a/client/i18n/locales/espanol/intro.json b/client/i18n/locales/espanol/intro.json index ce538cad2c..5396a306b8 100644 --- a/client/i18n/locales/espanol/intro.json +++ b/client/i18n/locales/espanol/intro.json @@ -92,9 +92,9 @@ "intro": [ "Mientras HTML y CSS controlan el contenido y el estilo de una página, JavaScript se utiliza para hacerlo interactivo. En la certificación Algoritmos de JavaScript y Estructuras de Datos, aprenderás los fundamentos de JavaScript incluyendo variables, arreglos, objetos, bucles y funciones.", "Una vez que tengas los fundamentos, aplicarás ese conocimiento creando algoritmos para manipular cadenas, factorizar números e incluso calcular la órbita de la Estación Espacial Internacional.", - "A lo largo del camino, también aprenderás dos estilos o paradigmas importantes de programación: la Programación Orientada a Objetos (OOP), y la Programación Funcional (FP)." + "Along the way, you'll also learn two important programming styles or paradigms: Object Oriented Programming (OOP) and Functional Programming (FP)." ], - "note": "Nota: Algunas extensiones del navegador, como bloqueadores de anuncios o bloqueadores de scripts pueden interferir con las pruebas. Si se te presentan problemas, te recomendamos deshabilitar las extensiones que modifiquen o bloqueen el contenido de la página, mientras tomas el curso.", + "note": "Note: Some browser extensions, such as ad-blockers and script-blockers can interfere with the tests. If you face issues, we recommend disabling extensions that modify or block the content of pages while taking the course.", "blocks": { "basic-javascript": { "title": "JavaScript básico", @@ -107,7 +107,7 @@ "title": "ES6", "intro": [ "ECMAScript, o ES, es una versión estandarizada de JavaScript. Debido a que todos los principales navegadores siguen esta especificación, los términos ECMAScript y JavaScript son intercambiables.", - "La mayoría del JavaScript que has aprendido hasta este punto estaba en ES5 (ECMAScript 5), el cual fue finalizado en 2009. Aunque puedes seguir escribiendo programas en ES5, JavaScript está evolucionando siempre, y cada año se lanzan nuevas funcionalidades.", + "Most of the JavaScript you've learned up to this point was in ES5 (ECMAScript 5), which was finalized in 2009. While you can still write programs in ES5, JavaScript is constantly evolving, and new features are released every year.", "ES6, lanzado en 2015, añadió muchas nuevas y potentes características al lenguaje. En este curso, aprenderás estas nuevas características, incluyendo let y const, funciones flecha, clases, promesas, y módulos." ] }, @@ -137,15 +137,15 @@ "title": "Programación de algoritmos básicos", "intro": [ "Un algoritmo es una serie de instrucciones paso a paso que describen cómo hacer algo.", - "Para escribir un algoritmo efectivo, es de ayuda dividir un problema en pequeñas partes, y pensar detenidamente sobre como resolver cada parte con código.", + "To write an effective algorithm, it helps to break a problem down into smaller parts and think carefully about how to solve each part with code.", "En este curso, aprenderás los fundamentos del pensamiento algorítmico mediante la escritura de algoritmos que hacen de todo, desde la conversión de temperaturas hasta el manejo de arreglos 2D complejos." ] }, "object-oriented-programming": { "title": "Programación orientada a objetos", "intro": [ - "OOP, o programación orientada a objetos, es uno de los principales enfoques del proceso de desarrollo de software. En la OOP, los objetos y las clases son usadas para organizar código para describir las cosas y lo que pueden hacer.", - "En este curso, aprenderás los principios básicos de OOP en JavaScript incluyendo la palabra clave this, cadenas prototipo, constructores, y herencias." + "OOP, or Object Oriented Programming, is one of the major approaches to the software development process. In OOP, objects and classes organize code to describe things and what they can do.", + "In this course, you'll learn the basic principles of OOP in JavaScript, including the this keyword, prototype chains, constructors, and inheritance." ] }, "functional-programming": { @@ -315,7 +315,7 @@ "intro": [ "Hasta este punto, sólo has usado JavaScript en la parte de front end para añadir interactividad a una página, resolver los desafíos de algoritmos o construir un SPA. Pero JavaScript también se puede utilizar en el back end, o servidor, para construir aplicaciones web completas.", "Hoy en día, una de las formas populares de construir aplicaciones es a través de microservicios, que son pequeñas aplicaciones modulares que trabajan juntas para formar un todo más grande.", - "En la certificación de APIs y Microservicios aprenderás cómo escribir para back- nd con Node.js y npm (Node Package Manager). También construirá aplicaciones web con el framework Express, y construirás un microservicio \"People Finder\" con MongoDB y la librería Mongoose." + "En la certificación de APIs y Microservicios aprenderás cómo escribir para back-end listo con Node.js y npm (Node Package Manager). También construirá aplicaciones web con el framework Express, y construirás un microservicio \"People Finder\" con MongoDB y la librería Mongoose." ], "note": "", "blocks": { diff --git a/client/i18n/locales/italian/intro.json b/client/i18n/locales/italian/intro.json index 70a1ac9df4..f2344d6447 100644 --- a/client/i18n/locales/italian/intro.json +++ b/client/i18n/locales/italian/intro.json @@ -92,9 +92,9 @@ "intro": [ "Mentre HTML e CSS controllano il contenuto e lo stile della pagina, JavaScript viene utilizzato per renderla interattiva. Nella Certificazione Algoritmi e Strutture Dati in JavaScript, imparerai le basi di JavaScript, incluse variabili, array, oggetti, cicli e funzioni.", "Una volta che avrai appreso le basi, applicherai questa conoscenza creando algoritmi per manipolare stringhe, fattorizzare numeri, e persino calcolare l'orbita della Stazione Spaziale Internazionale.", - "Lungo il percorso, imparerai anche due importanti stili di programmazione o paradigmi: Programmazione Orientata agli Oggetti (Object Oriented Programming, OOP) e Programmazione Funzionale (Functional Programming, FP)." + "Along the way, you'll also learn two important programming styles or paradigms: Object Oriented Programming (OOP) and Functional Programming (FP)." ], - "note": "Nota: Alcune estensioni del browser, come ad esempio gli ad-blocker e gli script-blocker, possono interferire con i test. In caso di problemi, ti raccomandiamo di disabilitare durante il corso le estensioni che modificano o bloccano il contenuto delle pagine.", + "note": "Note: Some browser extensions, such as ad-blockers and script-blockers can interfere with the tests. If you face issues, we recommend disabling extensions that modify or block the content of pages while taking the course.", "blocks": { "basic-javascript": { "title": "JavaScript Base", @@ -107,7 +107,7 @@ "title": "ES6", "intro": [ "ECMAScript o ES è una versione standardizzata di JavaScript. Dato che tutti i maggiori browser seguono queste specifiche, i termini ECMAScript e JavaScript sono intercambiabili.", - "La maggior parte del JavaScript che hai appreso finora era in ES5 (ECMAScript 5), che fu definito nel 2009. Anche se puoi ancora scrivere programmi in ES5, JavaScript è in costante evoluzione, e vengono rilasciate ogni anno nuove funzionalità.", + "Most of the JavaScript you've learned up to this point was in ES5 (ECMAScript 5), which was finalized in 2009. While you can still write programs in ES5, JavaScript is constantly evolving, and new features are released every year.", "ES6, rilasciato nel 2015, ha aggiunto molte nuove potenti funzionalità al linguaggio. In questo corso conoscerai queste funzionalità, inclusi let e const, funzioni freccia, classi, promise e moduli." ] }, @@ -137,15 +137,15 @@ "title": "Scrittura di Algoritmi Base", "intro": [ "Un algoritmo è una serie di istruzioni passo-passo che descrivono come fare qualcosa.", - "Per scrivere un algoritmo efficace, aiuta spezzare un problema in parti più piccole, e pensare attentamente a come risolvere ogni parte con il codice.", + "To write an effective algorithm, it helps to break a problem down into smaller parts and think carefully about how to solve each part with code.", "In questo corso, imparerai i fondamenti del pensiero algoritmico scrivendo algoritmi che fanno di tutto, dalla conversione delle temperature alla gestione di complessi array 2D." ] }, "object-oriented-programming": { "title": "Programmazione Orientata agli Oggetti", "intro": [ - "La Programmazione Orientata agli Oggetti (OOP, o Object Oriented Programming), è uno dei principali approcci al processo di sviluppo del software. In OOP, gli oggetti e le classi sono utilizzati per organizzare il codice per descrivere le cose e cosa possono fare.", - "In questo corso, imparerai i principi di base di OOP in JavaScript includendo la parola chiave this, le catene di prototipi, i costruttori e l'ereditarietà." + "OOP, or Object Oriented Programming, is one of the major approaches to the software development process. In OOP, objects and classes organize code to describe things and what they can do.", + "In this course, you'll learn the basic principles of OOP in JavaScript, including the this keyword, prototype chains, constructors, and inheritance." ] }, "functional-programming": { diff --git a/client/i18n/locales/portuguese/intro.json b/client/i18n/locales/portuguese/intro.json index 6e58492037..acff0d002c 100644 --- a/client/i18n/locales/portuguese/intro.json +++ b/client/i18n/locales/portuguese/intro.json @@ -92,9 +92,9 @@ "intro": [ "While HTML and CSS control the content and styling of a page, JavaScript is used to make it interactive. In the JavaScript Algorithm and Data Structures Certification, you'll learn the fundamentals of JavaScript including variables, arrays, objects, loops, and functions.", "Once you have the fundamentals down, you'll apply that knowledge by creating algorithms to manipulate strings, factorialize numbers, and even calculate the orbit of the International Space Station.", - "Along the way, you'll also learn two important programing styles or paradigms: Object Oriented Programing (OOP), and Functional Programing (FP)." + "Along the way, you'll also learn two important programming styles or paradigms: Object Oriented Programming (OOP) and Functional Programming (FP)." ], - "note": "Note: Some browser extensions, such as ad-blockers and script-blockers can interfere with the tests. If you face issues, we recommend disabling extensions that modify or block content of pages, while taking the course.", + "note": "Note: Some browser extensions, such as ad-blockers and script-blockers can interfere with the tests. If you face issues, we recommend disabling extensions that modify or block the content of pages while taking the course.", "blocks": { "basic-javascript": { "title": "Basic JavaScript", @@ -107,7 +107,7 @@ "title": "ES6", "intro": [ "ECMAScript, or ES, is a standardized version of JavaScript. Because all major browsers follow this specification, the terms ECMAScript and JavaScript are interchangeable.", - "Most of the JavaScript you've learned up to this point was in ES5 (ECMAScript 5), which was finalized in 2009. While you can still write programs in ES5, JavaScript is always evolving, and new features are released every year.", + "Most of the JavaScript you've learned up to this point was in ES5 (ECMAScript 5), which was finalized in 2009. While you can still write programs in ES5, JavaScript is constantly evolving, and new features are released every year.", "ES6, released in 2015, added many powerful new features to the language. In this course, you'll learn these new features, including let and const, arrow functions, classes, promises, and modules." ] }, @@ -137,15 +137,15 @@ "title": "Basic Algorithm Scripting", "intro": [ "An algorithm is a series of step-by-step instructions that describe how to do something.", - "To write an effective algorithm, it helps to break a problem down into smaller parts, and think carefully about how to solve each part with code.", + "To write an effective algorithm, it helps to break a problem down into smaller parts and think carefully about how to solve each part with code.", "In this course, you'll learn the fundamentals of algorithmic thinking by writing algorithms that do everything from converting temperatures to handling complex 2D arrays." ] }, "object-oriented-programming": { "title": "Object Oriented Programming", "intro": [ - "OOP, or Object Oriented Programming, is one of the major approaches to the software development process. In OOP, objects and classes are used to organize code to describe things and what they can do.", - "In this course, you'll learn the basic principles of OOP in JavaScript including the this keyword, prototype chains, constructors, and inheritance." + "OOP, or Object Oriented Programming, is one of the major approaches to the software development process. In OOP, objects and classes organize code to describe things and what they can do.", + "In this course, you'll learn the basic principles of OOP in JavaScript, including the this keyword, prototype chains, constructors, and inheritance." ] }, "functional-programming": { From fc0511bd91fae94cfa1963d3497d7b950e8771a6 Mon Sep 17 00:00:00 2001 From: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com> Date: Wed, 14 Jul 2021 21:02:51 +0530 Subject: [PATCH 180/344] chore(i18n): download curriculum manually (#42835) --- .../create-decimal-numbers-with-javascript.md | 2 +- .../use--for-a-more-concise-conditional.md | 14 +++---- ...ry-expression-for-conditional-rendering.md | 22 +++++----- ...anced-javascript-in-react-render-method.md | 20 ++++----- ...y.filter-to-dynamically-filter-an-array.md | 16 +++---- ...rray.map-to-dynamically-render-elements.md | 26 ++++++------ .../react/use-default-props.md | 10 ++--- ...roptypes-to-define-the-props-you-expect.md | 18 ++++---- .../use-react-to-render-nested-components.md | 16 +++---- .../use-body-parser-to-parse-post-requests.md | 6 ++- .../create-decimal-numbers-with-javascript.md | 2 +- .../react/access-props-using-this.props.md | 4 +- .../react/create-a-react-component.md | 2 +- ...roptypes-to-define-the-props-you-expect.md | 4 +- .../use-body-parser-to-parse-post-requests.md | 8 ++-- .../clean-up-your-project-with-modules.md | 6 +-- .../communicate-by-emitting.md | 22 +++++----- .../create-new-middleware.md | 14 +++---- .../handle-a-disconnect.md | 16 +++---- .../hashing-your-passwords.md | 18 ++++---- .../how-to-use-passport-strategies.md | 18 ++++---- .../set-up-the-environment.md | 32 +++++++------- .../create-decimal-numbers-with-javascript.md | 2 +- .../increment-a-number-with-javascript.md | 18 ++++---- ...-variables-with-the-assignment-operator.md | 10 ++--- .../introducing-else-if-statements.md | 22 +++++----- .../introducing-else-statements.md | 20 ++++----- .../iterate-odd-numbers-with-a-for-loop.md | 14 +++---- ...terate-through-an-array-with-a-for-loop.md | 16 +++---- ...terate-with-javascript-do...while-loops.md | 18 ++++---- .../iterate-with-javascript-for-loops.md | 26 ++++++------ .../iterate-with-javascript-while-loops.md | 16 +++---- .../local-scope-and-functions.md | 16 +++---- .../logical-order-in-if-else-statements.md | 24 +++++------ .../manipulate-arrays-with-pop.md | 18 ++++---- .../manipulate-arrays-with-push.md | 14 +++---- .../manipulate-arrays-with-shift.md | 16 +++---- .../manipulate-arrays-with-unshift.md | 14 +++---- .../manipulating-complex-objects.md | 30 ++++++------- .../modify-array-data-with-indexes.md | 16 +++---- ...-identical-options-in-switch-statements.md | 32 +++++++------- .../multiply-two-decimals-with-javascript.md | 12 +++--- .../multiply-two-numbers-with-javascript.md | 16 +++---- .../nest-one-array-within-another-array.md | 10 ++--- .../basic-javascript/nesting-for-loops.md | 14 +++---- ...sing-values-to-functions-with-arguments.md | 18 ++++---- .../practice-comparing-different-values.md | 22 +++++----- .../basic-javascript/profile-lookup.md | 26 ++++++------ .../quoting-strings-with-single-quotes.md | 22 +++++----- .../basic-javascript/record-collection.md | 32 +++++++------- .../replace-loops-using-recursion.md | 22 +++++----- .../replacing-if-else-chains-with-switch.md | 28 ++++++------- ...urn-a-value-from-a-function-with-return.md | 20 ++++----- .../return-early-pattern-for-functions.md | 28 ++++++------- ...returning-boolean-values-from-functions.md | 16 +++---- ...rom-many-options-with-switch-statements.md | 22 +++++----- .../basic-javascript/shopping-list.md | 16 +++---- .../basic-javascript/stand-in-line.md | 20 ++++----- ...in-one-variable-using-javascript-arrays.md | 14 +++---- ...ing-values-with-the-assignment-operator.md | 16 +++---- ...one-number-from-another-with-javascript.md | 16 +++---- .../testing-objects-for-properties.md | 22 +++++----- .../understand-string-immutability.md | 14 +++---- .../understanding-boolean-values.md | 12 +++--- ...rstanding-case-sensitivity-in-variables.md | 28 ++++++------- ...ndefined-value-returned-from-a-function.md | 23 +++++----- .../understanding-uninitialized-variables.md | 14 +++---- .../updating-object-properties.md | 14 +++---- ...to-find-the-first-character-in-a-string.md | 20 ++++----- ...-to-find-the-last-character-in-a-string.md | 18 ++++---- ...n-to-find-the-nth-character-in-a-string.md | 18 ++++---- ...d-the-nth-to-last-character-in-a-string.md | 18 ++++---- ...se-conditional-logic-with-if-statements.md | 28 ++++++------- ...-multiple-conditional-ternary-operators.md | 20 ++++----- .../use-recursion-to-create-a-countdown.md | 24 +++++------ ...-recursion-to-create-a-range-of-numbers.md | 18 ++++---- .../use-the-conditional-ternary-operator.md | 20 ++++----- .../use-the-parseint-function-with-a-radix.md | 22 +++++----- .../use-the-parseint-function.md | 18 ++++---- .../using-objects-for-lookups.md | 28 ++++++------- .../basic-javascript/word-blanks.md | 20 ++++----- ...rite-reusable-javascript-with-functions.md | 18 ++++---- ...the-wrong-order-when-calling-a-function.md | 10 ++--- ...osing-parenthesis-after-a-function-call.md | 14 +++---- ...-misspelled-variable-and-function-names.md | 18 ++++---- ...mixed-usage-of-single-and-double-quotes.md | 23 +++++----- ...h-off-by-one-errors-when-using-indexing.md | 18 ++++---- ...-parentheses-brackets-braces-and-quotes.md | 12 +++--- ...t-operator-instead-of-equality-operator.md | 18 ++++---- ...e-loops-with-a-valid-terminal-condition.md | 14 +++---- ...en-the-freecodecamp-and-browser-console.md | 22 +++++----- ...-reinitializing-variables-inside-a-loop.md | 14 +++---- ...onsole-to-check-the-value-of-a-variable.md | 14 +++---- ...-typeof-to-check-the-type-of-a-variable.md | 18 ++++---- ...pare-scopes-of-the-var-and-let-keywords.md | 34 +++++++-------- ...plete-a-promise-with-resolve-and-reject.md | 12 +++--- .../es6/create-a-javascript-promise.md | 10 ++--- .../es6/create-a-module-script.md | 14 +++---- ...-an-export-fallback-with-export-default.md | 16 +++---- .../create-strings-using-template-literals.md | 24 +++++------ ...ad-only-variable-with-the-const-keyword.md | 22 +++++----- ...rences-between-the-var-and-let-keywords.md | 22 +++++----- .../handle-a-fulfilled-promise-with-then.md | 14 +++---- .../handle-a-rejected-promise-with-catch.md | 14 +++---- .../es6/import-a-default-export.md | 10 ++--- .../mutate-an-array-declared-with-const.md | 22 +++++----- .../es6/prevent-object-mutation.md | 18 ++++---- .../es6/reuse-javascript-code-using-import.md | 14 +++---- ...t-default-parameters-for-your-functions.md | 18 ++++---- .../use--to-import-everything-from-a-file.md | 10 ++--- ...ns-to-write-concise-anonymous-functions.md | 24 +++++------ ...syntax-to-define-a-constructor-function.md | 28 ++++++------- ...ignment-to-assign-variables-from-arrays.md | 22 +++++----- ...to-assign-variables-from-nested-objects.md | 20 ++++----- ...gnment-to-assign-variables-from-objects.md | 20 ++++----- ...signment-to-extract-values-from-objects.md | 26 ++++++------ ...ass-an-object-as-a-functions-parameters.md | 20 ++++----- ...st-parameter-to-reassign-array-elements.md | 20 ++++----- .../es6/use-export-to-share-a-code-block.md | 14 +++---- ...-setters-to-control-access-to-an-object.md | 42 +++++++++---------- ...rest-parameter-with-function-parameters.md | 22 +++++----- ...ad-operator-to-evaluate-arrays-in-place.md | 22 +++++----- .../write-arrow-functions-with-parameters.md | 24 +++++------ ...-concise-declarative-functions-with-es6.md | 14 +++---- ...rations-using-object-property-shorthand.md | 14 +++---- .../use-body-parser-to-parse-post-requests.md | 6 ++- 126 files changed, 1128 insertions(+), 1124 deletions(-) diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md index fa571c8ae1..fb6e160502 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md @@ -11,7 +11,7 @@ dashedName: create-decimal-numbers-with-javascript También podemos almacenar números decimales en variables. Los números decimales a veces se denominan números de coma flotante o flotantes. -**Nota:** No todos los números reales pueden representarse con precisión en coma flotante. Esto puede llevar a errores de redondeo. [Detalles aquí](https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems). +**Nota:** No todos los números reales pueden representarse con precisión en coma flotante. Esto puede llevar a errores de redondeo. [Detalles aquí](https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems). # --instructions-- diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/use--for-a-more-concise-conditional.md b/curriculum/challenges/espanol/03-front-end-libraries/react/use--for-a-more-concise-conditional.md index 0f13747bc3..5259e6d3e1 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/use--for-a-more-concise-conditional.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/use--for-a-more-concise-conditional.md @@ -8,21 +8,21 @@ dashedName: use--for-a-more-concise-conditional # --description-- -The `if/else` statements worked in the last challenge, but there's a more concise way to achieve the same result. Imagine that you are tracking several conditions in a component and you want different elements to render depending on each of these conditions. If you write a lot of `else if` statements to return slightly different UIs, you may repeat code which leaves room for error. Instead, you can use the `&&` logical operator to perform conditional logic in a more concise way. This is possible because you want to check if a condition is `true`, and if it is, return some markup. Here's an example: +Las sentencias `if/else` funcionaron en el último desafío, pero hay una manera más concisa de lograr el mismo resultado. Imagina que estás rastreando varias condiciones en un componente y deseas que diferentes elementos se rendericen dependiendo de cada una de estas condiciones. Si escribes un montón de sentencias `else if` para devolver UIs ligeramente diferentes, puedes repetir código que deja espacio para el error. En su lugar, puedes usar el operador lógico `&&` para realizar lógica condicional de una manera más concisa. Esto es posible porque quieres comprobar si una condición es `true`, y si es así, devuelve algún código. Aquí hay un ejemplo: ```jsx {condition &&

          markup

          } ``` -If the `condition` is `true`, the markup will be returned. If the condition is `false`, the operation will immediately return `false` after evaluating the `condition` and return nothing. You can include these statements directly in your JSX and string multiple conditions together by writing `&&` after each one. This allows you to handle more complex conditional logic in your `render()` method without repeating a lot of code. +Si la `condition` es `true`, el código será devuelto. Si la condición es `false`, la operación devolverá inmediatamente `false` después de evaluar la `condition` y no devolverá nada. Puedes incluir estas sentencias directamente en tu JSX y encadenar varias condiciones juntas escribiendo `&&` después de cada uno. Esto te permite manejar una lógica condicional más compleja en tu método `render()` sin repetir un montón de código. # --instructions-- -Solve the previous example again, so the `h1` only renders if `display` is `true`, but use the `&&` logical operator instead of an `if/else` statement. +Resuelve el ejemplo anterior de nuevo, de este modo el `h1` solo renderiza si `display` es `true`, pero usa el operador lógico `&&` en lugar de una sentencia `if/else`. # --hints-- -`MyComponent` should exist and render. +`MyComponent` debe existir y renderizar. ```js assert( @@ -33,7 +33,7 @@ assert( ); ``` -When `display` is set to `true`, a `div`, `button`, and `h1` should render. +Cuando `display` se establece en `true`, un `div`, `button`, y `h1` debe renderizarse. ```js async () => { @@ -54,7 +54,7 @@ async () => { }; ``` -When `display` is set to `false`, only a `div` and `button` should render. +Cuando `display` se establece en `false`, solo un `div` y un `button` debe renderizarse. ```js async () => { @@ -75,7 +75,7 @@ async () => { }; ``` -The render method should use the `&&` logical operator to check the condition of `this.state.display`. +El método renderizador debe usar el operador lógico `&&` para comprobar la condición de `this.state.display`. ```js (getUserInput) => assert(getUserInput('index').includes('&&')); diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/use-a-ternary-expression-for-conditional-rendering.md b/curriculum/challenges/espanol/03-front-end-libraries/react/use-a-ternary-expression-for-conditional-rendering.md index 3329290523..006891c7ad 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/use-a-ternary-expression-for-conditional-rendering.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/use-a-ternary-expression-for-conditional-rendering.md @@ -1,6 +1,6 @@ --- id: 5a24c314108439a4d4036187 -title: Use a Ternary Expression for Conditional Rendering +title: Utiliza una expresión ternaria para el renderizado condicional challengeType: 6 forumTopicId: 301414 dashedName: use-a-ternary-expression-for-conditional-rendering @@ -8,7 +8,7 @@ dashedName: use-a-ternary-expression-for-conditional-rendering # --description-- -Before moving on to dynamic rendering techniques, there's one last way to use built-in JavaScript conditionals to render what you want: the ternary operator. The ternary operator is often utilized as a shortcut for `if/else` statements in JavaScript. They're not quite as robust as traditional `if/else` statements, but they are very popular among React developers. One reason for this is because of how JSX is compiled, `if/else` statements can't be inserted directly into JSX code. You might have noticed this a couple challenges ago — when an `if/else` statement was required, it was always *outside* the `return` statement. Ternary expressions can be an excellent alternative if you want to implement conditional logic within your JSX. Recall that a ternary operator has three parts, but you can combine several ternary expressions together. Here's the basic syntax: +Antes de pasar a técnicas de renderizado dinámico, hay una última forma de usar condicionales de JavaScript incorporados para representar lo que quieres: el operador ternario. El operador ternario a menudo es utilizado como un acceso directo para las sentencias `if/else` en JavaScript. No son tan robustas como las sentencias tradicionales `if/else`, pero son muy populares entre los desarrolladores de React. Una de las razones de esto es debido a cómo se compila JSX, las sentencias `if/else` no se pueden insertar directamente en el código JSX. Puede que hayas notado esto hace un par de desafíos, cuando se requirió una sentencia `if/else`, siempre estaba *fuera* de la sentencia `return`. Las expresiones ternarias pueden ser una excelente alternativa si deseas implementar lógica condicional dentro de tu JSX. Recuerda que un operador ternario tiene tres partes, pero puedes combinar varias expresiones ternarias juntas. Aquí está la sintaxis básica: ```jsx condition ? expressionIfTrue : expressionIfFalse; @@ -16,13 +16,13 @@ condition ? expressionIfTrue : expressionIfFalse; # --instructions-- -The code editor has three constants defined within the `CheckUserAge` component's `render()` method. They are called `buttonOne`, `buttonTwo`, and `buttonThree`. Each of these is assigned a simple JSX expression representing a button element. First, initialize the state of `CheckUserAge` with `input` and `userAge` both set to values of an empty string. +El editor de código tiene tres constantes definidas dentro del método `render()` del componente `CheckUserAge`. Estas se llaman `buttonOne`, `buttonTwo` y `buttonThree`. A cada una de estas se le asigna una expresión JSX simple que representa un elemento de botón. Primero, inicializa el estado de `CheckUserAge` con `input` y `userAge` ambos configurados a valores de una cadena vacía. -Once the component is rendering information to the page, users should have a way to interact with it. Within the component's `return` statement, set up a ternary expression that implements the following logic: when the page first loads, render the submit button, `buttonOne`, to the page. Then, when a user enters their age and clicks the button, render a different button based on the age. If a user enters a number less than `18`, render `buttonThree`. If a user enters a number greater than or equal to `18`, render `buttonTwo`. +Una vez que el componente está renderizando información a la página, los usuarios deberían tener una forma de interactuar con ella. Dentro de la declaración `return` del componente, configura una expresión ternaria que implementa la siguiente lógica: cuando la página carga por primera vez, renderiza el botón de envío, `buttonOne`, a la página. Luego, cuando un usuario ingrese su edad y haga clic en el botón, renderiza un botón diferente basado en la edad. Si un usuario introduce un número menor que `18`, renderiza `buttonThree`. Si un usuario introduce un número mayor o igual a `18`, renderiza `buttonTwo`. # --hints-- -The `CheckUserAge` component should render with a single `input` element and a single `button` element. +El componente `CheckUserAge` debe renderizarse con un solo elemento `input` y un solo elemento `button`. ```js assert( @@ -33,7 +33,7 @@ assert( ); ``` -The `CheckUserAge` component's state should be initialized with a property of `userAge` and a property of `input`, both set to a value of an empty string. +El estado del componente `CheckUserAge` debe inicializarse con una propiedad de `userAge` y una propiedad de `input`, ambos establecidos a un valor de una cadena vacía. ```js assert( @@ -42,7 +42,7 @@ assert( ); ``` -When the `CheckUserAge` component is first rendered to the DOM, the `button`'s inner text should be Submit. +Cuando el componente `CheckUserAge` es renderizado por primera vez en el DOM, el texto interno del `button` debe decir "Submit". ```js assert( @@ -51,7 +51,7 @@ assert( ); ``` -When a number of less than 18 is entered into the `input` element and the `button` is clicked, the `button`'s inner text should read `You Shall Not Pass`. +Cuando se introduce un número menor de 18 en el elemento `input` y se hace clic en el `button`, el texto interno del `button` debe decir `You Shall Not Pass`. ```js (() => { @@ -83,7 +83,7 @@ When a number of less than 18 is entered into the `input` element and the `butto })(); ``` -When a number greater than or equal to 18 is entered into the `input` element and the `button` is clicked, the `button`'s inner text should read `You May Enter`. +Cuando se introduce un número mayor o igual a 18 en el elemento `input` y se hace clic en el `button` el texto interno del `button` debe decir `You May Enter`. ```js (() => { @@ -115,7 +115,7 @@ When a number greater than or equal to 18 is entered into the `input` element an })(); ``` -Once a number has been submitted, and the value of the `input` is once again changed, the `button` should return to reading `Submit`. +Una vez que un número ha sido enviado, y el valor del `input` se cambia una vez más, el `button` debe decir `Submit`. ```js (() => { @@ -156,7 +156,7 @@ Once a number has been submitted, and the value of the `input` is once again cha })(); ``` -Your code should not contain any `if/else` statements. +Tu código no debe contener ninguna sentencia `if/else`. ```js assert( diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/use-advanced-javascript-in-react-render-method.md b/curriculum/challenges/espanol/03-front-end-libraries/react/use-advanced-javascript-in-react-render-method.md index d9bccebbf2..934a109e94 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/use-advanced-javascript-in-react-render-method.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/use-advanced-javascript-in-react-render-method.md @@ -1,6 +1,6 @@ --- id: 5a24c314108439a4d4036183 -title: Use Advanced JavaScript in React Render Method +title: Usa JavaScript avanzado en el método render de React challengeType: 6 forumTopicId: 301415 dashedName: use-advanced-javascript-in-react-render-method @@ -8,17 +8,17 @@ dashedName: use-advanced-javascript-in-react-render-method # --description-- -In previous challenges, you learned how to inject JavaScript code into JSX code using curly braces, `{ }`, for tasks like accessing props, passing props, accessing state, inserting comments into your code, and most recently, styling your components. These are all common use cases to put JavaScript in JSX, but they aren't the only way that you can utilize JavaScript code in your React components. +En desafíos anteriores, aprendiste cómo inyectar código JavaScript en código JSX usando llaves, `{ }`, para tareas como acceder a props, pasar props, acceder al state, insertar comentarios en tu código y, más recientemente, diseñar tus componentes. Todos estos son casos de uso común para poner JavaScript en JSX, pero no son la única manera de utilizar código JavaScript en tus componentes React. -You can also write JavaScript directly in your `render` methods, before the `return` statement, ***without*** inserting it inside of curly braces. This is because it is not yet within the JSX code. When you want to use a variable later in the JSX code *inside* the `return` statement, you place the variable name inside curly braces. +También puedes escribir JavaScript directamente en los métodos `render`, antes de la sentencia `return`, ***sin*** insertarlo dentro de llaves. Esto es porque aún no está dentro del código JSX. Cuando quieras utilizar una variable en el código JSX *dentro* de la sentencia `return`, colocas el nombre de la variable dentro de llaves. # --instructions-- -In the code provided, the `render` method has an array that contains 20 phrases to represent the answers found in the classic 1980's Magic Eight Ball toy. The button click event is bound to the `ask` method, so each time the button is clicked a random number will be generated and stored as the `randomIndex` in state. On line 52, delete the string `change me!` and reassign the `answer` const so your code randomly accesses a different index of the `possibleAnswers` array each time the component updates. Finally, insert the `answer` const inside the `p` tags. +En el código proporcionado, el método `render` tiene un arreglo que contiene 20 frases para representar las respuestas encontradas en el clásico juego "Magic Eight Ball" de los años ochenta. El evento clic del botón está vinculado al método `ask`, por lo que cada vez que se haga clic en el botón se generará un número aleatorio y se almacenará como el `randomIndex` en el state. En la línea 52, elimina la cadena `change me!` y reasigna la constante `answer` para que tu código acceda aleatoriamente a un índice diferente del arreglo `possibleAnswers` cada vez que se actualiza el componente. Finalmente, inserta la constante `answer` dentro de las etiquetas `p`. # --hints-- -The `MagicEightBall` component should exist and should render to the page. +El componente `MagicEightBall` debe existir y renderizarse en la página. ```js assert.strictEqual( @@ -28,7 +28,7 @@ assert.strictEqual( ); ``` -`MagicEightBall`'s first child should be an `input` element. +El primer elemento hijo de `MagicEightBall` debe ser un elemento `input`. ```js assert.strictEqual( @@ -40,7 +40,7 @@ assert.strictEqual( ); ``` -`MagicEightBall`'s third child should be a `button` element. +El tercer elemento hijo de `MagicEightBall` debe ser un elemento `button`. ```js assert.strictEqual( @@ -52,7 +52,7 @@ assert.strictEqual( ); ``` -`MagicEightBall`'s state should be initialized with a property of `userInput` and a property of `randomIndex` both set to a value of an empty string. +El estado de `MagicEightBall` debe inicializarse con una propiedad de `userInput` y una propiedad de `randomIndex` juntas establecidas como cadenas de texto vacías. ```js assert( @@ -62,7 +62,7 @@ assert( ); ``` -When `MagicEightBall` is first mounted to the DOM, it should return an empty `p` element. +Cuando `MagicEightBall` se monte por primera vez en el DOM, debe devolver un elemento `p` vacío. ```js assert( @@ -71,7 +71,7 @@ assert( ); ``` -When text is entered into the `input` element and the button is clicked, the `MagicEightBall` component should return a `p` element that contains a random element from the `possibleAnswers` array. +Cuando se introduce texto en el elemento `input` y se hace clic en el botón, el componente `MagicEightBall` debe devolver un elemento `p` que contiene un elemento aleatorio del arreglo `possibleAnswers`. ```js (() => { diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/use-array.filter-to-dynamically-filter-an-array.md b/curriculum/challenges/espanol/03-front-end-libraries/react/use-array.filter-to-dynamically-filter-an-array.md index 9aa54c9672..c376262123 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/use-array.filter-to-dynamically-filter-an-array.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/use-array.filter-to-dynamically-filter-an-array.md @@ -1,6 +1,6 @@ --- id: 5a24c314108439a4d403618c -title: Use Array.filter() to Dynamically Filter an Array +title: Usa Array.filter() para filtrar dinámicamente un arreglo challengeType: 6 forumTopicId: 301416 dashedName: use-array-filter-to-dynamically-filter-an-array @@ -8,7 +8,7 @@ dashedName: use-array-filter-to-dynamically-filter-an-array # --description-- -The `map` array method is a powerful tool that you will use often when working with React. Another method related to `map` is `filter`, which filters the contents of an array based on a condition, then returns a new array. For example, if you have an array of users that all have a property `online` which can be set to `true` or `false`, you can filter only those users that are online by writing: +El método de arreglo `map` es una potente herramienta que puedes usar a menudo al trabajar con React. Otro método relacionado con `map` es `filter`, que filtra el contenido de un arreglo basado en una condición, luego devuelve un nuevo arreglo. Por ejemplo, si tienes un arreglo de usuarios que todos tienen una propiedad `online` que puede establecerse en `true` o `false`, puedes filtrar sólo aquellos usuarios que estén en línea escribiendo: ```js let onlineUsers = users.filter(user => user.online); @@ -16,11 +16,11 @@ let onlineUsers = users.filter(user => user.online); # --instructions-- -In the code editor, `MyComponent`'s `state` is initialized with an array of users. Some users are online and some aren't. Filter the array so you see only the users who are online. To do this, first use `filter` to return a new array containing only the users whose `online` property is `true`. Then, in the `renderOnline` variable, map over the filtered array, and return a `li` element for each user that contains the text of their `username`. Be sure to include a unique `key` as well, like in the last challenges. +En el editor de código, el `state` de `MyComponent` es inicializado con un arreglo de usuarios. Algunos usuarios están conectados y otros no. Filtra el arreglo para que sólo veas a los usuarios que están en línea. Para hacer esto, primero usa `filter` para devolver un nuevo arreglo que contiene solo a los usuarios cuya propiedad `online` es `true`. Luego, en la variable `renderOnline`, asigna sobre el arreglo filtrado, y devuelve un elemento `li` para cada usuario que contiene el texto de su `username`. Asegúrate de incluir también una única `key`, como en los últimos desafíos. # --hints-- -`MyComponent` should exist and render to the page. +`MyComponent` debe existir y renderizarse en la página. ```js assert.strictEqual( @@ -29,7 +29,7 @@ assert.strictEqual( ); ``` -`MyComponent`'s state should be initialized to an array of six users. +El estado de `MyComponent` debe inicializarse a un arreglo de seis usuarios. ```js assert( @@ -40,7 +40,7 @@ assert( ); ``` -`MyComponent` should return a `div`, an `h1`, and then an unordered list containing `li` elements for every user whose online status is set to `true`. +`MyComponent` debe devolver un `div`, un `h1`, y luego una lista desordenada que contiene elementos `li` para cada usuario cuyo estado de conexión se establece en `true`. ```js (() => { @@ -83,7 +83,7 @@ assert( })(); ``` -`MyComponent` should render `li` elements that contain the `username` of each online user. +`MyComponent` debe renderizar elementos `li` que contienen el `username` de cada usuario en línea. ```js (() => { @@ -109,7 +109,7 @@ assert( })(); ``` -Each list item element should have a unique `key` attribute. +Cada elemento de la lista debe tener un atributo `key` único. ```js assert( diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/use-array.map-to-dynamically-render-elements.md b/curriculum/challenges/espanol/03-front-end-libraries/react/use-array.map-to-dynamically-render-elements.md index 0d6cca62f6..b821584e16 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/use-array.map-to-dynamically-render-elements.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/use-array.map-to-dynamically-render-elements.md @@ -1,6 +1,6 @@ --- id: 5a24c314108439a4d403618a -title: Use Array.map() to Dynamically Render Elements +title: Utiliza Array.map() para renderizar dinámicamente los elementos challengeType: 6 forumTopicId: 301417 dashedName: use-array-map-to-dynamically-render-elements @@ -8,21 +8,21 @@ dashedName: use-array-map-to-dynamically-render-elements # --description-- -Conditional rendering is useful, but you may need your components to render an unknown number of elements. Often in reactive programming, a programmer has no way to know what the state of an application is until runtime, because so much depends on a user's interaction with that program. Programmers need to write their code to correctly handle that unknown state ahead of time. Using `Array.map()` in React illustrates this concept. +El renderizado condicional es útil, pero es posible que necesites tus componentes para renderizar un número desconocido de elementos. A menudo en la programación reactiva, un programador no tiene forma de saber cuál es el estado de una aplicación hasta el tiempo de ejecución, porque mucho depende de la interacción de un usuario con ese programa. Los programadores necesitan escribir su código para manejar correctamente ese estado desconocido antes de tiempo. Usar `Array.map()` en React ilustra este concepto. -For example, you create a simple "To Do List" app. As the programmer, you have no way of knowing how many items a user might have on their list. You need to set up your component to dynamically render the correct number of list elements long before someone using the program decides that today is laundry day. +Por ejemplo, crea una aplicación simple "To Do List". Como programador, no tienes forma de saber cuántos elementos puede tener un usuario en su lista. Necesitas configurar tu componente para renderizar dinámicamente el número correcto de elementos de la lista mucho antes de que alguien que use el programa decida que hoy es día de lavandería. # --instructions-- -The code editor has most of the `MyToDoList` component set up. Some of this code should look familiar if you completed the controlled form challenge. You'll notice a `textarea` and a `button`, along with a couple of methods that track their states, but nothing is rendered to the page yet. +El editor de código tiene la mayoría del componente `MyToDoList` configurado. Parte de este código debería parecer familiar si completaste el desafío de formulario controlado. Vas a notar un `textarea` y un `button`, junto con un par de métodos que rastrean sus estados, pero aún no se muestra nada a la página. -Inside the `constructor`, create a `this.state` object and define two states: `userInput` should be initialized as an empty string, and `toDoList` should be initialized as an empty array. Next, delete the comment in the `render()` method next to the `items` variable. In its place, map over the `toDoList` array stored in the component's internal state and dynamically render a `li` for each item. Try entering the string `eat, code, sleep, repeat` into the `textarea`, then click the button and see what happens. +Dentro del `constructor`, crea un objeto `this.state` y define dos estados: `userInput` que debe inicializarse como una cadena vacía, y `toDoList` que debe inicializarse como un arreglo vacío. Luego, elimina el comentario junto a la variable `items` del método `render()`. En su lugar, utiliza la función map() para recorrer el arreglo `toDoList` almacenado en el internal state del componente y renderizar un `li` por cada item. Intenta introducir la cadena `eat, code, sleep, repeat` dentro del `textarea`, haz clic en el botón y ve qué sucede. -**Note:** You may know that all sibling child elements created by a mapping operation like this do need to be supplied with a unique `key` attribute. Don't worry, this is the topic of the next challenge. +**Nota:** Puede que sepas que todos los elementos hijos hermanos creados por una operación map como ésta necesitan poseer un atributo `key` único. No te preocupes, este es el tema de nuestro próximo desafío. # --hints-- -The MyToDoList component should exist and render to the page. +El componente MyToDoList debe existir y mostrarse en la página. ```js assert( @@ -33,7 +33,7 @@ assert( ); ``` -The first child of `MyToDoList` should be a `textarea` element. +El primer hijo de `MyToDoList` debe ser un elemento `textarea`. ```js assert( @@ -47,7 +47,7 @@ assert( ); ``` -The second child of `MyToDoList` should be a `br` element. +El segundo hijo de `MyToDoList` debe ser un elemento `br`. ```js assert( @@ -60,7 +60,7 @@ assert( ); ``` -The third child of `MyToDoList` should be a `button` element. +El tercer hijo de `MyToDoList` debe ser un elemento `button`. ```js assert( @@ -74,7 +74,7 @@ assert( ); ``` -The state of `MyToDoList` should be initialized with `toDoList` as an empty array. +El estado de `MyToDoList` debe inicializarse con un arreglo vacío `toDoList`. ```js assert( @@ -89,7 +89,7 @@ assert( ); ``` -The state of `MyToDoList` should be initialized with `userInput` as an empty string. +El estado de `MyToDoList` debe ser inicializado con una cadena vacía `userInput`. ```js assert( @@ -104,7 +104,7 @@ assert( ); ``` -When the `Create List` button is clicked, the `MyToDoList` component should dynamically return an unordered list that contains a list item element for every item of a comma-separated list entered into the `textarea` element. +Cuando el botón `Create List` es presionado, el componente `MyToDoList` debe devolver dinámicamente una lista desordenada que contenga un artículo por cada elemento de una lista separada por coma dentro del elemento `textarea`. ```js (() => { diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/use-default-props.md b/curriculum/challenges/espanol/03-front-end-libraries/react/use-default-props.md index 1f048ada95..7c7c7a6078 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/use-default-props.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/use-default-props.md @@ -1,6 +1,6 @@ --- id: 5a24c314108439a4d403616b -title: Use Default Props +title: Usa props predeterminadas challengeType: 6 forumTopicId: 301418 dashedName: use-default-props @@ -8,15 +8,15 @@ dashedName: use-default-props # --description-- -React also has an option to set default props. You can assign default props to a component as a property on the component itself and React assigns the default prop if necessary. This allows you to specify what a prop value should be if no value is explicitly provided. For example, if you declare `MyComponent.defaultProps = { location: 'San Francisco' }`, you have defined a location prop that's set to the string `San Francisco`, unless you specify otherwise. React assigns default props if props are undefined, but if you pass `null` as the value for a prop, it will remain `null`. +React también tiene una opción para establecer props predeterminadas. Puedes asignar props predeterminadas a un componente como si fueran una propiedad dentro del propio componente y React asigna la prop predeterminada si es necesario. Esto te permite especificar cuál debe ser el valor de una prop si no se provee un valor específico. Por ejemplo, si declaras `MyComponent.defaultProps = { location: 'San Francisco' }`, has definido una prop de localización que se establece en la cadena `San Francisco`, a menos que especifiques lo contrario. React asigna props predeterminadas si estas no están definidas, pero si pasas el valor `null` como valor para una prop, este permanecerá `null`. # --instructions-- -The code editor shows a `ShoppingCart` component. Define default props on this component which specify a prop `items` with a value of `0`. +El editor de código muestra un componente `ShoppingCart`. Define props predeterminadas en este componente que especifican una prop `items` con un valor de `0`. # --hints-- -The `ShoppingCart` component should render. +El componente `ShoppingCart` debe renderizarse. ```js assert( @@ -27,7 +27,7 @@ assert( ); ``` -The `ShoppingCart` component should have a default prop of `{ items: 0 }`. +El componente `ShoppingCart` debe tener una prop predeterminada de `{ items: 0 }`. ```js assert( diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/use-proptypes-to-define-the-props-you-expect.md b/curriculum/challenges/espanol/03-front-end-libraries/react/use-proptypes-to-define-the-props-you-expect.md index 2c6a725994..3b161791cf 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/use-proptypes-to-define-the-props-you-expect.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/use-proptypes-to-define-the-props-you-expect.md @@ -1,6 +1,6 @@ --- id: 5a24c314108439a4d403616d -title: Use PropTypes to Define the Props You Expect +title: Usa PropTypes para definir las props que esperas challengeType: 6 forumTopicId: 301419 dashedName: use-proptypes-to-define-the-props-you-expect @@ -8,25 +8,25 @@ dashedName: use-proptypes-to-define-the-props-you-expect # --description-- -React provides useful type-checking features to verify that components receive props of the correct type. For example, your application makes an API call to retrieve data that you expect to be in an array, which is then passed to a component as a prop. You can set `propTypes` on your component to require the data to be of type `array`. This will throw a useful warning when the data is of any other type. +React proporciona características útiles de validación de tipos para verificar que los componentes reciban las props del tipo correcto. Por ejemplo, tu aplicación hace una llamada a un API para obtener datos que se esperan que sea un arreglo, el cual es pasado al componente como una prop. Puedes establecer `propTypes` en tu componente para que los datos sean de tipo `array`. Esto arrojará una advertencia útil cuando los datos sean de otro tipo. -It's considered a best practice to set `propTypes` when you know the type of a prop ahead of time. You can define a `propTypes` property for a component in the same way you defined `defaultProps`. Doing this will check that props of a given key are present with a given type. Here's an example to require the type `function` for a prop called `handleClick`: +Se considera una muy buena práctica definir los `propTypes` cuando conoces el tipo de una propiedad con antelación. Puedes definir una propiedad `propTypes` para un componente de la misma manera que defines `defaultProps`. Al hacer esto, se validará que las props de una clave determinada están presentes con un tipo específico. Aquí hay un ejemplo para validar el tipo `function` para una prop llamada `handleClick`: ```js MyComponent.propTypes = { handleClick: PropTypes.func.isRequired } ``` -In the example above, the `PropTypes.func` part checks that `handleClick` is a function. Adding `isRequired` tells React that `handleClick` is a required property for that component. You will see a warning if that prop isn't provided. Also notice that `func` represents `function`. Among the seven JavaScript primitive types, `function` and `boolean` (written as `bool`) are the only two that use unusual spelling. In addition to the primitive types, there are other types available. For example, you can check that a prop is a React element. Please refer to the [documentation](https://reactjs.org/docs/jsx-in-depth.html#specifying-the-react-element-type) for all of the options. +En el ejemplo anterior, la parte de `PropTypes.func` verifica que `handleClick` es una función. Añadir `isRequired` le dice a React que `handleClick` es una propiedad obligatoria para ese componente. Verás una advertencia si no se proporciona esa propiedad. También ten en cuenta que `func` representa `function`. Entre los siete tipos primitivos de JavaScript, `function` y `boolean` (escrito como `bool`) son los únicos dos que utilizan ortografía diferente. Además de los tipos primitivos, hay otros tipos disponibles. Por ejemplo, puedes validar si una prop es un elemento React. Por favor, consulta la [documentación](https://reactjs.org/docs/jsx-in-depth.html#specifying-the-react-element-type) para todas las opciones. -**Note:** As of React v15.5.0, `PropTypes` is imported independently from React, like this: `import PropTypes from 'prop-types';` +**Nota:** A partir de React v15.5.0, `PropTypes` se importa de manera independiente de React, así: `import PropTypes from 'prop-types';` # --instructions-- -Define `propTypes` for the `Items` component to require `quantity` as a prop and verify that it is of type `number`. +Define `propTypes` para el componente `Items` de tal manera que `quantity` sea una prop obligatoria y verificar que sea de tipo `number`. # --hints-- -The `ShoppingCart` component should render. +El componente `ShoppingCart` debe renderizarse. ```js assert( @@ -37,7 +37,7 @@ assert( ); ``` -The `Items` component should render. +El componente `Items` debe renderizarse. ```js assert( @@ -48,7 +48,7 @@ assert( ); ``` -The `Items` component should include a `propTypes` check to require a value for `quantity` and ensure that its value is a number. +El componente `Items` debe incluir una comprobación `propTypes` para requerir un valor para `quantity` y asegurar que su valor es un número. ```js (getUserInput) => diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/use-react-to-render-nested-components.md b/curriculum/challenges/espanol/03-front-end-libraries/react/use-react-to-render-nested-components.md index 3f98507054..634559c216 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/use-react-to-render-nested-components.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/use-react-to-render-nested-components.md @@ -1,6 +1,6 @@ --- id: 5a24c314108439a4d4036165 -title: Use React to Render Nested Components +title: Utiliza React para procesar componentes anidados challengeType: 6 forumTopicId: 301420 dashedName: use-react-to-render-nested-components @@ -8,23 +8,23 @@ dashedName: use-react-to-render-nested-components # --description-- -The last challenge showed a simple way to compose two components, but there are many different ways you can compose components with React. +El último desafío mostró una manera simple de organizar dos componentes, pero hay muchas maneras diferentes de organizar componentes con React. -Component composition is one of React's powerful features. When you work with React, it is important to start thinking about your user interface in terms of components like the App example in the last challenge. You break down your UI into its basic building blocks, and those pieces become the components. This helps to separate the code responsible for the UI from the code responsible for handling your application logic. It can greatly simplify the development and maintenance of complex projects. +La composición de componentes es una de las características más poderosas de React. Cuando trabajas con React, es importante comenzar a pensar en tu interfaz de usuario en términos de componentes, como el ejemplo App del último desafío. Debes dividir tu UI en sus bloques básicos de construcción, y esas piezas se convierten en los componentes. Esto ayuda a separar el código responsable de la interfaz de usuario del código responsable de manejar la lógica de tu aplicación. Esto puede simplificar enormemente el desarrollo y el mantenimiento de proyectos complejos. # --instructions-- -There are two functional components defined in the code editor, called `TypesOfFruit` and `Fruits`. Take the `TypesOfFruit` component and compose it, or *nest* it, within the `Fruits` component. Then take the `Fruits` component and nest it within the `TypesOfFood` component. The result should be a child component, nested within a parent component, which is nested within a parent component of its own! +Hay dos componentes funcionales definidos en el editor de código, llamados `TypesOfFruit` y `Fruits`. Toma el componente `TypesOfFruit` y organízalo, o *anídalo*, dentro del componente `Fruits`. Luego toma el componente `Fruits` y anídalo dentro del componente `TypesOfFood`. El resultado debe ser un componente hijo, anidado dentro de un componente padre, ¡que a su vez está anidado dentro de un componente padre! # --hints-- -The `TypesOfFood` component should return a single `div` element. +El componente `TypesOfFood` debe devolver un solo elemento `div`. ```js assert(Enzyme.shallow(React.createElement(TypesOfFood)).type() === 'div'); ``` -The `TypesOfFood` component should return the `Fruits` component. +El componente `TypesOfFood` debe devolver el componente `Fruits`. ```js assert( @@ -33,7 +33,7 @@ assert( ); ``` -The `Fruits` component should return the `TypesOfFruit` component. +El componente `Fruits` debe devolver el componente `TypesOfFruit`. ```js assert( @@ -42,7 +42,7 @@ assert( ); ``` -The `TypesOfFruit` component should return the `h2` and `ul` elements. +El componente `TypesOfFruit` debe devolver los elementos `h2` y `ul`. ```js assert( diff --git a/curriculum/challenges/espanol/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md b/curriculum/challenges/espanol/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md index 9e0c3a879b..5baf9fc636 100644 --- a/curriculum/challenges/espanol/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md +++ b/curriculum/challenges/espanol/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md @@ -26,9 +26,11 @@ As you can see, the body is encoded like the query string. This is the default f # --instructions-- -Install the `body-parser` module in your `package.json`. Then, `require` it at the top of the file. Store it in a variable named `bodyParser`. The middleware to handle urlencoded data is returned by `bodyParser.urlencoded({extended: false})`. Pass to `app.use()` the function returned by the previous method call. As usual, the middleware must be mounted before all the routes which need it. +Install the `body-parser` module in your `package.json`. Then, `require` it at the top of the file. Store it in a variable named `bodyParser`. The middleware to handle urlencoded data is returned by `bodyParser.urlencoded({extended: false})`. Pass the function returned by the previous method call to `app.use()`. As usual, the middleware must be mounted before all the routes that depend on it. -**Note:** `extended=false` is a configuration option that tells the parser to use the classic encoding. When using it, values can be only strings or arrays. The extended version allows more data flexibility, but it is outmatched by JSON. +**Note:** `extended` is a configuration option that tells `body-parser` which parsing needs to be used. When `extended=false` it uses the classic encoding `querystring` library. When `extended=true` it uses `qs` library for parsing. + +When using `extended=false`, values can be only strings or arrays. The object returned when using `querystring` does not prototypically inherit from the default JavaScript `Object`, which means functions like `hasOwnProperty`, `toString` will not be available. The extended version allows more data flexibility, but it is outmatched by JSON. # --hints-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md index 232da49ce4..936dfa0527 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md @@ -11,7 +11,7 @@ dashedName: create-decimal-numbers-with-javascript Possiamo memorizzare nelle variabili anche i numeri decimali. I numeri decimali a volte sono indicati come numeri in virgola mobile (floating point) o floats. -**Nota:** Non tutti i numeri reali possono essere accuratamente rappresentati in floating point. Ciò può portare a errori di arrotondamento. [Dettagli qui](https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems). +**Nota:** Non tutti i numeri reali possono essere accuratamente rappresentati in floating point. Ciò può portare a errori di arrotondamento. [Dettagli qui](https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems). # --instructions-- diff --git a/curriculum/challenges/italian/03-front-end-libraries/react/access-props-using-this.props.md b/curriculum/challenges/italian/03-front-end-libraries/react/access-props-using-this.props.md index 20da44cd42..941b8bf6a0 100644 --- a/curriculum/challenges/italian/03-front-end-libraries/react/access-props-using-this.props.md +++ b/curriculum/challenges/italian/03-front-end-libraries/react/access-props-using-this.props.md @@ -10,11 +10,11 @@ dashedName: access-props-using-this-props Le ultime sfide hanno mostrato i modi fondamentali per passare le proprietà ai componenti figli. Ma cosa succede se il componente figlio a cui stai passando una prop è un componente di classe ES6, piuttosto che un componente funzionale senza stato? Il componente di classe ES6 utilizza una convenzione leggermente diversa per accedere alle proprietà. -Ogni volta che fai riferimento a un componente di classe all'interno di sé stesso, usi la parola chiave `this`. Per accedere alle proprietà all'interno di un componente di classe, premetti `this` al codice che usi per accedervi. Ad esempio, se un componente di classe ES6 ha una prop chiamata `data`, scriverai `{this.props.data}` in JSX. +Ogni volta che fai riferimento a un componente di classe all'interno di sé stesso, usa la parola chiave `this`. Per accedere alle proprietà all'interno di un componente di classe, premetti `this` al codice che usi per accedervi. Ad esempio, se un componente di classe ES6 ha una prop chiamata `data`, scriverai `{this.props.data}` in JSX. # --instructions-- -Mostra un'istanza del componente `ReturnTempPassword` nel componente padre `ResetPassword`. Qui, dai a `ReturnTempPassword` una prop di `tempPassword` e assegnale un valore stringa di almeno 8 caratteri. All'interno del figlio, `ReturnTempPassword`, accedi alla prop `tempPassword` all'interno dei tag `strong` per assicurarti che l'utente veda la password temporanea. +Mostra un'istanza del componente `ReturnTempPassword` nel componente genitore `ResetPassword`. Qui, dai a `ReturnTempPassword` una prop di `tempPassword` e assegnale un valore stringa di almeno 8 caratteri. All'interno del figlio, `ReturnTempPassword`, accedi alla prop `tempPassword` all'interno dei tag `strong` per assicurarti che l'utente veda la password temporanea. # --hints-- diff --git a/curriculum/challenges/italian/03-front-end-libraries/react/create-a-react-component.md b/curriculum/challenges/italian/03-front-end-libraries/react/create-a-react-component.md index 369cbeb8f5..94c7c82f24 100644 --- a/curriculum/challenges/italian/03-front-end-libraries/react/create-a-react-component.md +++ b/curriculum/challenges/italian/03-front-end-libraries/react/create-a-react-component.md @@ -24,7 +24,7 @@ class Kitten extends React.Component { } ``` -Questo crea una classe ES6 `Kitten` che estende la classe `React.Component`. Così la classe `Kitten` ora ha accesso a molte funzionalità React utili, come lo stato locale e gli agganci del ciclo di vita. Non preoccuparti se non hai ancora familiarità con questi termini, saranno coperti in maggior dettaglio nelle sfide successive. Nota anche che la classe `Kitten` ha un `constructor` definito al suo interno che chiama `super()`. Esso usa `super()` per chiamare il costruttore della classe padre, in questo caso `React.Component`. Il costruttore è un metodo speciale usato durante l'inizializzazione degli oggetti creati con la parola chiave `class`. È buona pratica chiamare il `constructor` di un componente con `super` e passare le `props` ad entrambi. Questo assicura che il componente sia inizializzato correttamente. Per adesso, sappi che è uno standard includere questo codice. Presto vedrai altri usi per il costruttore e le `props`. +Questo crea una classe ES6 `Kitten` che estende la classe `React.Component`. Così la classe `Kitten` ora ha accesso a molte funzionalità React utili, come lo stato locale (local state) e gli agganci del ciclo di vita (lifecycle hook). Non preoccuparti se non hai ancora familiarità con questi termini, saranno coperti in maggior dettaglio nelle sfide successive. Nota anche che la classe `Kitten` ha un `constructor` definito al suo interno che chiama `super()`. Esso usa `super()` per chiamare il costruttore della classe genitore, in questo caso `React.Component`. Il costruttore è un metodo speciale usato durante l'inizializzazione degli oggetti creati con la parola chiave `class`. È buona pratica chiamare il `constructor` di un componente con `super` e passare le `props` ad entrambi. Questo assicura che il componente sia inizializzato correttamente. Per adesso, sappi che è uno standard includere questo codice. Presto vedrai altri usi per il costruttore e le `props`. # --instructions-- diff --git a/curriculum/challenges/italian/03-front-end-libraries/react/use-proptypes-to-define-the-props-you-expect.md b/curriculum/challenges/italian/03-front-end-libraries/react/use-proptypes-to-define-the-props-you-expect.md index 4d7708e23c..ef1e56696b 100644 --- a/curriculum/challenges/italian/03-front-end-libraries/react/use-proptypes-to-define-the-props-you-expect.md +++ b/curriculum/challenges/italian/03-front-end-libraries/react/use-proptypes-to-define-the-props-you-expect.md @@ -8,9 +8,9 @@ dashedName: use-proptypes-to-define-the-props-you-expect # --description-- -React fornisce utili funzioni di verifica del tipo per verificare che i componenti ricevano proprietà del tipo corretto. Ad esempio, la tua applicazione effettua una chiamata API per recuperare dei dati che ti aspetti essere in un array, che viene poi passato a un componente come proprietà. Puoi impostare `propTypes` sul tuo componente per richiedere che i dati siano di tipo `array`. Questo generà un avviso utile quando i dati saranno di qualsiasi altro tipo. +React fornisce utili funzioni di verifica del tipo per verificare che i componenti ricevano proprietà del tipo corretto. Ad esempio, la tua applicazione effettua una chiamata API per recuperare dei dati che ti aspetti essere in un array, che viene poi passato a un componente come proprietà. Puoi impostare `propTypes` sul tuo componente per richiedere che i dati siano di tipo `array`. Questo genera un avviso utile quando i dati saranno di qualsiasi altro tipo. -È considerata una buona pratica impostare `propTypes` quando si conosce il tipo di una prop in anticipo. Puoi definire una proprietà `propTypes` per un componente nello stesso modo in cui hai definito `defaultProps`. In questo modo si verificherà che la prop con una data chiave sia presenti con un dato tipo. Ecco un esempio per richiedere il tipo `function` per una prop chiamata `handleClick`: +È considerata una buona pratica impostare `propTypes` quando si conosce il tipo di una prop in anticipo. Puoi definire una proprietà `propTypes` per un componente nello stesso modo in cui hai definito `defaultProps`. In questo modo verrà verificato che la prop con una data chiave sia presente con un dato tipo. Ecco un esempio per richiedere il tipo `function` per una prop chiamata `handleClick`: ```js MyComponent.propTypes = { handleClick: PropTypes.func.isRequired } diff --git a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md index 84b44fb570..989f5e97ae 100644 --- a/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md +++ b/curriculum/challenges/italian/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md @@ -26,13 +26,15 @@ Come puoi vedere, il corpo è codificato come la query string. Questo è il form # --instructions-- -Installa il modulo `body-parser` nel tuo `package.json`. Poi, richiedilo con `require` all'inizio del file. Memorizzalo in una variabile chiamata `bodyParser`. Il middleware per gestire i dati urlencoded viene restituito da `bodyParser.urlencoded({extended: false})`. Passa a `app.use()` la funzione restituita dalla precedente chiamata del metodo. Come al solito, il middleware deve essere montato prima di tutte le rotte che ne hanno bisogno. +Installa il modulo `body-parser` nel tuo `package.json`. Poi, richiedilo con `require` all'inizio del file. Memorizzalo in una variabile chiamata `bodyParser`. Il middleware per gestire i dati urlencoded viene restituito da `bodyParser.urlencoded({extended: false})`. Pass the function returned by the previous method call to `app.use()`. As usual, the middleware must be mounted before all the routes that depend on it. -**Nota:** `extended=false` è un'opzione di configurazione che dice al parser di usare la codifica classica. Quando lo si utilizza, i valori possono essere solo stringhe o array. La versione estesa consente una maggiore flessibilità dei dati, ma è superata da JSON. +**Note:** `extended` is a configuration option that tells `body-parser` which parsing needs to be used. When `extended=false` it uses the classic encoding `querystring` library. When `extended=true` it uses `qs` library for parsing. + +When using `extended=false`, values can be only strings or arrays. The object returned when using `querystring` does not prototypically inherit from the default JavaScript `Object`, which means functions like `hasOwnProperty`, `toString` will not be available. The extended version allows more data flexibility, but it is outmatched by JSON. # --hints-- -Il middleware 'body-parser' dovrebbe essere montato +The 'body-parser' middleware should be mounted ```js (getUserInput) => diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md index f77aa8dbcd..6c3492069b 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md @@ -24,13 +24,13 @@ Infine, trasferisci tutte le rotte presenti nel tuo server e incollale nei nuovi Continua ad aggiungere percorsi fino a quando non ci saranno più errori e il tuo file server non avrà più neanche una rotta (**ad eccezione della rotta nel blocco catch**)! -Now do the same thing in your auth.js file with all of the things related to authentication such as the serialization and the setting up of the local strategy and erase them from your server file. Be sure to add the dependencies in and call `auth(app, myDataBase)` in the server in the same spot. +Ora fai la stessa cosa nel tuo file auth.js con tutte le cose relative all'autenticazione come la serializzazione e l'impostazione della strategia locale e cancellali dal file del server. Assicurati di aggiungere le dipendenze e invocare `auth(app, myDataBase)` nel server nello stesso punto. -Submit your page when you think you've got it right. If you're running into errors, you can check out an example of the completed project [here](https://gist.github.com/camperbot/2d06ac5c7d850d8cf073d2c2c794cc92). +Invia la tua pagina quando pensi di averlo fatto correttamente. Se dovessi incontrare degli errori, puoi controllare il progetto completato [qui](https://gist.github.com/camperbot/2d06ac5c7d850d8cf073d2c2c794cc92). # --hints-- -Modules should be present. +Dovrebbero essere presenti dei moduli. ```js (getUserInput) => diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/communicate-by-emitting.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/communicate-by-emitting.md index 1b9e03a3b5..c8268914d4 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/communicate-by-emitting.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/communicate-by-emitting.md @@ -1,6 +1,6 @@ --- id: 589fc831f9fc0f352b528e75 -title: Communicate by Emitting +title: Comunicare emettendo challengeType: 2 forumTopicId: 301550 dashedName: communicate-by-emitting @@ -8,27 +8,27 @@ dashedName: communicate-by-emitting # --description-- -Emit is the most common way of communicating you will use. When you emit something from the server to 'io', you send an event's name and data to all the connected sockets. A good example of this concept would be emitting the current count of connected users each time a new user connects! +Emit è il modo più comune di comunicare che utilizzerai. Quando emetti qualcosa dal server a 'io', invii il nome e i dati di un evento a tutti i socket collegati. Un buon esempio di questo concetto sarebbe emettere il numero attuale di utenti connessi ogni volta che un nuovo utente si connette! -Start by adding a variable to keep track of the users, just before where you are currently listening for connections. +Inizia aggiungendo una variabile per tenere traccia degli utenti, poco prima di dove stai ascolta in attesa di connessioni. ```js let currentUsers = 0; ``` -Now, when someone connects, you should increment the count before emitting the count. So, you will want to add the incrementer within the connection listener. +Ora, quando qualcuno si connette, dovresti aumentare il conteggio prima di emetterlo. Quindi, vorrai aggiungere l'incrementatore all'interno del listener di connessione. ```js ++currentUsers; ``` -Finally, after incrementing the count, you should emit the event (still within the connection listener). The event should be named 'user count', and the data should just be the `currentUsers`. +Infine, dopo aver incrementato il conteggio, dovresti emettere l'evento (sempre all'interno del listener di connessione). L'evento dovrebbe essere chiamato 'user count', e i dati dovrebbero essere solo `currentUsers` (utenti attuali). ```js io.emit('user count', currentUsers); ``` -Now, you can implement a way for your client to listen for this event! Similar to listening for a connection on the server, you will use the `on` keyword. +Ora, puoi fare in modo che il tuo client si metta in ascolto in attesa di questo evento! In modo simile ad attendere una connessione sul server, userai la parola chiave `on`. ```js socket.on('user count', function(data) { @@ -36,13 +36,13 @@ socket.on('user count', function(data) { }); ``` -Now, try loading up your app, authenticate, and you should see in your client console '1' representing the current user count! Try loading more clients up, and authenticating to see the number go up. +Ora, prova a caricare la tua app e a fare l'autenticazione: dovresti vedere nella tua console del client un '1' che rappresenta il numero attuale di utenti! Prova a caricare altri client, e autenticati in ognuno di essi per vedere il numero che aumenta. -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/28ef7f1078f56eb48c7b1aeea35ba1f5). +Invia la tua pagina quando pensi di averlo fatto correttamente. Se dovessi incontrare degli errori, puoi controllare il progetto completato fino a questo punto [qui](https://gist.github.com/camperbot/28ef7f1078f56eb48c7b1aeea35ba1f5). # --hints-- -currentUsers should be defined. +currentUsers dovrebbe essere definito. ```js (getUserInput) => @@ -60,7 +60,7 @@ currentUsers should be defined. ); ``` -Server should emit the current user count at each new connection. +Il server dovrebbe emettere il numero attuale di utenti per ogni nuova connessione. ```js (getUserInput) => @@ -78,7 +78,7 @@ Server should emit the current user count at each new connection. ); ``` -Your client should be listening for 'user count' event. +Il tuo client dovrebbe ascoltare per eventi 'user count'. ```js (getUserInput) => diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/create-new-middleware.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/create-new-middleware.md index e34d3a458a..8589454159 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/create-new-middleware.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/create-new-middleware.md @@ -1,6 +1,6 @@ --- id: 5895f70df9fc0f352b528e6a -title: Create New Middleware +title: Creare un nuovo middleware challengeType: 2 forumTopicId: 301551 dashedName: create-new-middleware @@ -8,9 +8,9 @@ dashedName: create-new-middleware # --description-- -As is, any user can just go to `/profile` whether they have authenticated or not, by typing in the url. We want to prevent this, by checking if the user is authenticated first before rendering the profile page. This is the perfect example of when to create a middleware. +Attualmente, ogni utente può andare a `/profile` indipendentemente dal fatto che sia autenticato o meno, semplicemente digitando l'url. Vogliamo evitarlo, controllando che l'utente sia autenticato prima di visualizzare la pagina del profilo. Questo è l'esempio perfetto di quando conviene creare un middleware. -The challenge here is creating the middleware function `ensureAuthenticated(req, res, next)`, which will check if a user is authenticated by calling passport's `isAuthenticated` method on the `request` which, in turn, checks if `req.user` is defined. If it is, then `next()` should be called, otherwise, we can just respond to the request with a redirect to our homepage to login. An implementation of this middleware is: +La sfida consiste nel creare la funzione middleware `ensureAuthenticated(req, res, next)`, che controlla se un utente è autenticato o meno invocando il metodo `isAuthenticated` di passport su `request`, e questo a sua volta controlla se `req.user` è definito. Se lo è, allora `next()` dovrebbe essere invocato, altrimenti, possiamo rispondere alla richiesta con un reindirizzamento alla homepage per fare l'autenticazione. Una implementazione di questo middleware è: ```js function ensureAuthenticated(req, res, next) { @@ -21,7 +21,7 @@ function ensureAuthenticated(req, res, next) { }; ``` -Now add *ensureAuthenticated* as a middleware to the request for the profile page before the argument to the get request containing the function that renders the page. +Ora aggiungi *ensureAuthenticated* come middleware alla richiesta per la pagina del profilo prima dell'argomento della richiesta GET che contiene la funzione che visualizza la pagina. ```js app @@ -31,11 +31,11 @@ app }); ``` -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/ae49b8778cab87e93284a91343da0959). +Invia la tua pagina quando pensi di averlo fatto correttamente. Se dovessi incontrare degli errori, puoi controllare il progetto completato fino a questo punto [qui](https://gist.github.com/camperbot/ae49b8778cab87e93284a91343da0959). # --hints-- -Middleware ensureAuthenticated should be implemented and on our /profile route. +Il middleware ensureAuthenticated dovrebbe essere inplementato sulla rotta /profile. ```js (getUserInput) => @@ -58,7 +58,7 @@ Middleware ensureAuthenticated should be implemented and on our /profile route. ); ``` -A Get request to /profile should correctly redirect to / since we are not authenticated. +Una richiesta Get a /profile dovrebbe reindirizzare a / visto che non siamo autenticati. ```js (getUserInput) => diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/handle-a-disconnect.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/handle-a-disconnect.md index 2873c18ff2..3c31183c8e 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/handle-a-disconnect.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/handle-a-disconnect.md @@ -1,6 +1,6 @@ --- id: 589fc831f9fc0f352b528e76 -title: Handle a Disconnect +title: Gestire una disconnessione challengeType: 2 forumTopicId: 301552 dashedName: handle-a-disconnect @@ -8,9 +8,9 @@ dashedName: handle-a-disconnect # --description-- -You may notice that up to now you have only been increasing the user count. Handling a user disconnecting is just as easy as handling the initial connect, except you have to listen for it on each socket instead of on the whole server. +Potresti notare che fino a questo momento hai solo incremementato il numero degli utenti. Gestire la disconnessione di un utente è semplice come gestire la connessione iniziale, solo che si deve mettersi in ascolto per essa su ogni socket invece che su tutto il server. -To do this, add another listener inside the existing `'connect'` listener that listens for `'disconnect'` on the socket with no data passed through. You can test this functionality by just logging that a user has disconnected to the console. +Per fare questo, aggiungi un altro listener all'interno del listener `'connect'` esistente, in modo che attenda un evento `'disconnect'` sul socket (senza alcun passaggio di dati). È possibile testare questa funzionalità semplicemente scrivendo nella console che un utente si è disconnesso. ```js socket.on('disconnect', () => { @@ -18,15 +18,15 @@ socket.on('disconnect', () => { }); ``` -To make sure clients continuously have the updated count of current users, you should decrease the currentUsers by 1 when the disconnect happens then emit the 'user count' event with the updated count! +Per assicurarti che i client continuino ad avere il numero aggiornato degli utenti connessi, quando avviene una disconnessione dovresti diminuire currentUsers di 1 e emettere l'evento 'user count' con il conteggio aggiornato! -**Note:** Just like `'disconnect'`, all other events that a socket can emit to the server should be handled within the connecting listener where we have 'socket' defined. +**Nota:** Proprio come `'disconnect'`, tutti gli altri eventi che un socket può emettere sul server devono essere gestiti all'interno del listener di connessione dove abbiamo definito 'socket'. -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/ab1007b76069884fb45b215d3c4496fa). +Invia la tua pagina quando pensi di averlo fatto correttamente. Se dovessi incontrare degli errori, puoi controllare il progetto completato fino a questo punto [qui](https://gist.github.com/camperbot/ab1007b76069884fb45b215d3c4496fa). # --hints-- -Server should handle the event disconnect from a socket. +Il server deve gestire l'evento di disconnessione da un socket. ```js (getUserInput) => @@ -40,7 +40,7 @@ Server should handle the event disconnect from a socket. ); ``` -Your client should be listening for 'user count' event. +Il tuo client dovrebbe essere in ascolto per eventi di tipo 'user count'. ```js (getUserInput) => diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/hashing-your-passwords.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/hashing-your-passwords.md index 43459f9438..c639ef50ae 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/hashing-your-passwords.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/hashing-your-passwords.md @@ -1,6 +1,6 @@ --- id: 58a25c98f9fc0f352b528e7f -title: Hashing Your Passwords +title: Hashing delle password challengeType: 2 forumTopicId: 301553 dashedName: hashing-your-passwords @@ -8,13 +8,13 @@ dashedName: hashing-your-passwords # --description-- -Going back to the information security section, you may remember that storing plaintext passwords is *never* okay. Now it is time to implement BCrypt to solve this issue. +Tornando alla sezione sulla sicurezza delle informazioni, potresti ricordare che memorizzare le password non è *mai* una buona cosa. Ora è tempo di implementare BCrypt per risolvere questo problema. -Add `bcrypt@~5.0.0` as a dependency, and require it in your server. You will need to handle hashing in 2 key areas: where you handle registering/saving a new account, and when you check to see that a password is correct on login. +Aggiungi `bcrypt@~5.0.0` come dipendenza, e richiedilo nel tuo server. Dovrai gestire l'hashing in 2 aree chiave: dove gestisci la registrazione/salvataggio di un nuovo account, e quando controlli per vedere se una password è corretta al momento dell'accesso. -Currently on our registration route, you insert a user's password into the database like so: `password: req.body.password`. An easy way to implement saving a hash instead is to add the following before your database logic `const hash = bcrypt.hashSync(req.body.password, 12);`, and replacing the `req.body.password` in the database saving with just `password: hash`. +Attualmente sul nostro percorso di registrazione, inserisci la password di un utente nel database in questo modo: `password: req.body.password`. Un modo semplice per implementare il salvataggio di un hash invece è quello di aggiungere quanto segue prima della logica del database `const hash = bcrypt.hashSync(req.body.password, 12);`, e sostituire `req.body.password` nel database salvando solo `password: hash`. -Finally, on our authentication strategy, we check for the following in our code before completing the process: `if (password !== user.password) { return done(null, false); }`. After making the previous changes, now `user.password` is a hash. Before making a change to the existing code, notice how the statement is checking if the password is **not** equal then return non-authenticated. With this in mind, your code could look as follows to properly check the password entered against the hash: +Infine, nella nostra strategia di autenticazione, controlliamo quanto segue nel nostro codice prima di completare il processo: `if (password !== user.password) { return done(null, false); }`. Dopo aver apportato le modifiche precedenti, `user.password` è diventato un hash. Prima di apportare una modifica al codice esistente, nota come la dichiarazione verifica se la password è **non** uguale, quindi restituisce not-authenticated. Con questo in mente, il codice potrebbe apparire come segue in modo da confrontare correttamente la password inserita con l'hash: ```js if (!bcrypt.compareSync(password, user.password)) { @@ -22,13 +22,13 @@ if (!bcrypt.compareSync(password, user.password)) { } ``` -That is all it takes to implement one of the most important security features when you have to store passwords! +Questo è tutto quello che serve per implementare una delle caratteristiche di sicurezza più importanti quando si devono memorizzare le password! -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/dc16cca09daea4d4151a9c36a1fab564). +Invia la tua pagina quando pensi di averlo fatto correttamente. Se incontri degli errori, puoi controllare il progetto completato fino a questo punto [qui](https://gist.github.com/camperbot/dc16cca09daea4d4151a9c36a1fab564). # --hints-- -BCrypt should be a dependency. +BCrypt dovrebbe essere una dipendenza. ```js (getUserInput) => @@ -47,7 +47,7 @@ BCrypt should be a dependency. ); ``` -BCrypt should be correctly required and implemented. +BCrypt dovrebbe essere correttamente richiesto e implementato. ```js (getUserInput) => diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/how-to-use-passport-strategies.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/how-to-use-passport-strategies.md index ba78302a8c..83a0d93768 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/how-to-use-passport-strategies.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/how-to-use-passport-strategies.md @@ -1,6 +1,6 @@ --- id: 5895f70df9fc0f352b528e69 -title: How to Use Passport Strategies +title: Usare le strategie passport challengeType: 2 forumTopicId: 301555 dashedName: how-to-use-passport-strategies @@ -8,21 +8,21 @@ dashedName: how-to-use-passport-strategies # --description-- -In the `index.pug` file supplied, there is actually a login form. It has previously been hidden because of the inline JavaScript `if showLogin` with the form indented after it. Before `showLogin` as a variable was never defined, so it never rendered the code block containing the form. Go ahead and on the `res.render` for that page add a new variable to the object `showLogin: true`. When you refresh your page, you should then see the form! This form is set up to **POST** on `/login`, so this is where we should set up to accept the POST and authenticate the user. +Nel file `index.pug` fornito, c'è in realtà un modulo di login. In precedenza è stato nascosto a causa del JavaScript in linea `if showLogin` con il modulo indentato dopo di esso. `showLogin` non è mai stato definito come variabile in precedenza, quindi non ha mai presentato il blocco di codice contenente il modulo. Vai avanti e nel `res.render` per quella pagina aggiungi una nuova variabile all'oggetto `showLogin: true`. Quando aggiorni la pagina, dovresti vedere il modulo! Questo modulo è impostato per fare una richiesta **POST** su `/login`, quindi qui è dove dovremmo mettere il codice per accettare il POST e autenticare l'utente. -For this challenge you should add the route `/login` to accept a POST request. To authenticate on this route, you need to add a middleware to do so before then sending a response. This is done by just passing another argument with the middleware before your `function(req,res)` with your response! The middleware to use is `passport.authenticate('local')`. +Per questa sfida dovresti aggiungere la rotta `/login` per accettare una richiesta POST. Per autenticarsi su questo percorso, è necessario aggiungere un middleware per farlo prima di inviare una risposta. Questo viene fatto semplicemente passando un altro argomento con il middleware prima della tua `function(req,res)` con la tua risposta! Il middleware da usare è `passport.authenticate('local')`. -`passport.authenticate` can also take some options as an argument such as: `{ failureRedirect: '/' }` which is incredibly useful, so be sure to add that in as well. The response after using the middleware (which will only be called if the authentication middleware passes) should be to redirect the user to `/profile` and that route should render the view `profile.pug`. +`passport.authenticate` può anche prendere alcune opzioni come un argomento tipo: `{ failureRedirect: '/' }` che è incredibilmente utile, quindi assicurati di aggiungere anche quello. La risposta dopo aver utilizzato il middleware (che verrà chiamato solo se l'autenticazione middleware ha successo) dovrebbe essere quella di reindirizzare l'utente a `/profile` e tale percorso dovrebbe presentare la vista `profile.pug`. -If the authentication was successful, the user object will be saved in `req.user`. +Se l'autenticazione è riuscita, l'oggetto utente verrà salvato in `req.user`. -At this point, if you enter a username and password in the form, it should redirect to the home page `/`, and the console of your server should display `'User {USERNAME} attempted to log in.'`, since we currently cannot login a user who isn't registered. +A questo punto, se inserisci un nome utente e una password nel modulo, esso dovrebbe reindirizzare alla home page `/`, e la console del tuo server dovrebbe mostrare `'User {USERNAME} attempted to log in.'`, dato che al momento non possiamo effettuare il login di un utente che non è registrato. -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/7ad011ac54612ad53188b500c5e99cb9). +Invia la tua pagina quando pensi di averlo fatto correttamente. Se dovessi incontrare degli errori, puoi controllare il progetto completato fino a questo punto [qui](https://gist.github.com/camperbot/7ad011ac54612ad53188b500c5e99cb9). # --hints-- -All steps should be correctly implemented in the server.js. +Tutti i passaggi dovrebbero essere correttamente implementati nel server.js. ```js (getUserInput) => @@ -50,7 +50,7 @@ All steps should be correctly implemented in the server.js. ); ``` -A POST request to /login should correctly redirect to /. +Una richiesta POST a /login dovrebbe reindirizzare correttamente a /. ```js (getUserInput) => diff --git a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md index 9da23f8cac..fd58c660ee 100644 --- a/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md +++ b/curriculum/challenges/italian/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md @@ -1,6 +1,6 @@ --- id: 589fc830f9fc0f352b528e74 -title: Set up the Environment +title: Configurare l'ambiente challengeType: 2 forumTopicId: 301566 dashedName: set-up-the-environment @@ -8,20 +8,20 @@ dashedName: set-up-the-environment # --description-- -The following challenges will make use of the `chat.pug` file. So, in your `routes.js` file, add a GET route pointing to `/chat` which makes use of `ensureAuthenticated`, and renders `chat.pug`, with `{ user: req.user }` passed as an argument to the response. Now, alter your existing `/auth/github/callback` route to set the `req.session.user_id = req.user.id`, and redirect to `/chat`. +Le seguenti sfide utilizzeranno il file `chat.pug`. Così, nel tuo file `routes.js`, aggiugi una rotta GET che punta a `/chat` che fa uso di `ensureAuthenticated`, e fa il rendering di `chat.pug`, con `{ user: req.user }` passato come argomento alla risposta. Adesso, modifica la rotta esistente `/auth/github/callback` per impostare il `req.session.user_id = req.user.id` e reindirizzare a `/chat`. -Add `socket.io@~2.3.0` as a dependency and require/instantiate it in your server defined as follows, with `http` (comes built-in with Nodejs): +Aggiungi `socket.io@~2.3.0` come dipendenza e richiedila/instanziala nel server definito come segue, con `http` (che è già integrato in Nodejs): ```javascript const http = require('http').createServer(app); const io = require('socket.io')(http); ``` -Now that the *http* server is mounted on the *express app*, you need to listen from the *http* server. Change the line with `app.listen` to `http.listen`. +Ora che il server *http* è montato sull'app *express*, devi rimanere in ascolto dal server *http*. Cambia la riga con `app.listen` a `http.listen`. -The first thing needing to be handled is listening for a new connection from the client. The on keyword does just that- listen for a specific event. It requires 2 arguments: a string containing the title of the event that's emitted, and a function with which the data is passed though. In the case of our connection listener, we use *socket* to define the data in the second argument. A socket is an individual client who is connected. +La prima cosa che deve essere gestita è l'ascolto di una nuova connessione dal client. La parola chiave on fa proprio questo: ascolta un evento specifico. Richiede 2 argomenti: una stringa contenente il titolo dell'evento emesso, e una funzione con cui i dati vengono trasmessi. Nel caso del nostro listener di connessione, usiamo *socket* per definire i dati nel secondo argomento. Un socket è un singolo client che è connesso. -To listen for connections to your server, add the following within your database connection: +Per rimanere in ascolto di connessioni al server, aggiungi quanto segue nella connessione al database: ```javascript io.on('connection', socket => { @@ -29,24 +29,24 @@ io.on('connection', socket => { }); ``` -Now for the client to connect, you just need to add the following to your `client.js` which is loaded by the page after you've authenticated: +Ora affinché il client si connetta, devi solo aggiungere quanto segue al tuo `client.js` che viene caricato dalla pagina dopo l'autenticazione: ```js /*global io*/ let socket = io(); ``` -The comment suppresses the error you would normally see since 'io' is not defined in the file. We've already added a reliable CDN to the Socket.IO library on the page in chat.pug. +Il commento sopprime l'errore che normalmente vedresti poiché 'io' non è definito nel file. Abbiamo già aggiunto una CDN affidabile alla libreria Socket.IO sulla pagina in chat.pug. -Now try loading up your app and authenticate and you should see in your server console 'A user has connected'! +Ora prova a caricare la tua app e ad autenticarti: dovresti vedere nella console del tuo server 'A user has connected'! -**Note:**`io()` works only when connecting to a socket hosted on the same url/server. For connecting to an external socket hosted elsewhere, you would use `io.connect('URL');`. +**Nota:**`io()` funziona solo quando ci si connette a un socket ospitato sullo stesso url/server. Per connettersi ad un socket esterno ospitato altrove, si utilizzerebbe `io.connect('URL');`. -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/aae41cf59debc1a4755c9a00ee3859d1). +Invia la tua pagina quando pensi di averlo fatto correttamente. Se dovessi incontrare degli errori, puoi controllare il progetto completato fino a questo punto [qui](https://gist.github.com/camperbot/aae41cf59debc1a4755c9a00ee3859d1). # --hints-- -`socket.io` should be a dependency. +`socket.io` dovrebbe essere una dipendenza. ```js (getUserInput) => @@ -65,7 +65,7 @@ Submit your page when you think you've got it right. If you're running into erro ); ``` -You should correctly require and instantiate `http` as `http`. +Dovresti richiedere e instanziare correttamente `http` come `http`. ```js (getUserInput) => @@ -83,7 +83,7 @@ You should correctly require and instantiate `http` as `http`. ); ``` -You should correctly require and instantiate `socket.io` as `io`. +Dovresti richiedere e instanziare correttamente `socket.io` come `io`. ```js (getUserInput) => @@ -101,7 +101,7 @@ You should correctly require and instantiate `socket.io` as `io`. ); ``` -Socket.IO should be listening for connections. +Socket.IO dovrebbe stare in ascolto di connessioni. ```js (getUserInput) => @@ -119,7 +119,7 @@ Socket.IO should be listening for connections. ); ``` -Your client should connect to your server. +Il tuo client dovrebbe connettersi al tuo server. ```js (getUserInput) => diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md index b768fd118e..844ae82a1f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md @@ -11,7 +11,7 @@ dashedName: create-decimal-numbers-with-javascript Nós também podemos armazenar números decimais em variáveis. Números decimais são referidos as vezes como números de ponto flutuante ou floats. -**Nota:** Nem todos os números reais podem ser representados com precisão no ponto flutuante. Isso pode levar a erros de arredondamento. [Detalhes aqui](https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems). +**Nota:** Nem todos os números reais podem ser representados com precisão no ponto flutuante. Isso pode levar a erros de arredondamento. [Detalhes aqui](https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems). # --instructions-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index 7de50c056e..89afbdab09 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244ac -title: Increment a Number with JavaScript +title: Incremente um Número com JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/ca8GLT9' forumTopicId: 18201 @@ -9,33 +9,33 @@ dashedName: increment-a-number-with-javascript # --description-- -You can easily increment or add one to a variable with the `++` operator. +Você pode facilmente incrementar ou adicionar 1 à variável com o operador `++`. ```js i++; ``` -is the equivalent of +é o equivalente a ```js i = i + 1; ``` -**Note:** The entire line becomes `i++;`, eliminating the need for the equal sign. +**Nota:** A linha inteira se torna `i++;`, eliminando a necessidade do sinal de igual. # --instructions-- -Change the code to use the `++` operator on `myVar`. +Modifique o código usando o operador `++` em `myVar`. # --hints-- -`myVar` should equal `88`. +`myVar` deve ser igual a `88`. ```js assert(myVar === 88); ``` -You should not use the assignment operator. +Você não deve usar o operador de atribuição. ```js assert( @@ -43,13 +43,13 @@ assert( ); ``` -You should use the `++` operator. +Você deve usar o operador `++`. ```js assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code)); ``` -You should not change code above the specified comment. +Você não deve alterar o código acima do comentário especificado. ```js assert(/var myVar = 87;/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md index 83b498c3b2..30d815278c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244a9 -title: Initializing Variables with the Assignment Operator +title: Inicializando Variáveis com o Operador de Atribuição challengeType: 1 videoUrl: 'https://scrimba.com/c/cWJ4Bfb' forumTopicId: 301171 @@ -9,21 +9,21 @@ dashedName: initializing-variables-with-the-assignment-operator # --description-- -It is common to initialize a variable to an initial value in the same line as it is declared. +É comum inicializar a variável com um valor inicial na mesma linha que declarada. ```js var myVar = 0; ``` -Creates a new variable called `myVar` and assigns it an initial value of `0`. +Cria uma nova variável chamada `myVar` e atribui o seu valor inicial como `0`. # --instructions-- -Define a variable `a` with `var` and initialize it to a value of `9`. +Define uma variável `a` com `var` e a inicializa com o valor de `9`. # --hints-- -You should initialize `a` to a value of `9`. +Você deve inicializar `a` para o valor de `9`. ```js assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md index 803a30f9c8..1a14df91ec 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244db -title: Introducing Else If Statements +title: Introduzindo Instruções Else If challengeType: 1 videoUrl: 'https://scrimba.com/c/caeJ2hm' forumTopicId: 18206 @@ -9,7 +9,7 @@ dashedName: introducing-else-if-statements # --description-- -If you have multiple conditions that need to be addressed, you can chain `if` statements together with `else if` statements. +Se você tem múltiplas condições que precisam ser resolvidas, você pode encadear as instruções `if` junto com instruções `else if`. ```js if (num > 15) { @@ -23,23 +23,23 @@ if (num > 15) { # --instructions-- -Convert the logic to use `else if` statements. +Converta a lógica para usar instruções `else if`. # --hints-- -You should have at least two `else` statements +Você deve ter pelo menos duas instruções `else` ```js assert(code.match(/else/g).length > 1); ``` -You should have at least two `if` statements +Você deve ter pelo menos duas instruções `if` ```js assert(code.match(/if/g).length > 1); ``` -You should have closing and opening curly braces for each `if else` code block. +Você deve ter chaves de abertura e fechamento para cada bloco de código de `if else`. ```js assert( @@ -49,31 +49,31 @@ assert( ); ``` -`testElseIf(0)` should return the string `Smaller than 5` +`testElseIf(0)` deve retornar a string `Smaller than 5` ```js assert(testElseIf(0) === 'Smaller than 5'); ``` -`testElseIf(5)` should return the string `Between 5 and 10` +`testElseIf(5)` deve retornar a string `Between 5 and 10` ```js assert(testElseIf(5) === 'Between 5 and 10'); ``` -`testElseIf(7)` should return the string `Between 5 and 10` +`testElseIf(7)` deve retornar a string `Between 5 and 10` ```js assert(testElseIf(7) === 'Between 5 and 10'); ``` -`testElseIf(10)` should return the string `Between 5 and 10` +`testElseIf(10)` deve retornar a string `Between 5 and 10` ```js assert(testElseIf(10) === 'Between 5 and 10'); ``` -`testElseIf(12)` should return the string `Greater than 10` +`testElseIf(12)` deve retornar a string `Greater than 10` ```js assert(testElseIf(12) === 'Greater than 10'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md index d9dfef41b7..4ecaf50d08 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244da -title: Introducing Else Statements +title: Introduzindo Instruções Else challengeType: 1 videoUrl: 'https://scrimba.com/c/cek4Efq' forumTopicId: 18207 @@ -9,7 +9,7 @@ dashedName: introducing-else-statements # --description-- -When a condition for an `if` statement is true, the block of code following it is executed. What about when that condition is false? Normally nothing would happen. With an `else` statement, an alternate block of code can be executed. +Quando uma condição para uma instrução `if` for verdadeiro, o bloco de código seguinte será executado. E quando a condição for falsa? Normalmente nada aconteceria. Com uma instrução `else`, um bloco de código alternativo pode ser executado. ```js if (num > 10) { @@ -21,47 +21,47 @@ if (num > 10) { # --instructions-- -Combine the `if` statements into a single `if/else` statement. +Combine as instruções `if` em uma única instrução `if/else`. # --hints-- -You should only have one `if` statement in the editor +Você deve ter apenas uma instrução `if` no editor ```js assert(code.match(/if/g).length === 1); ``` -You should use an `else` statement +Você deve usar uma instrução `else` ```js assert(/else/g.test(code)); ``` -`testElse(4)` should return the string `5 or Smaller` +`testElse(4)` deve retornar a string `5 or Smaller` ```js assert(testElse(4) === '5 or Smaller'); ``` -`testElse(5)` should return the string `5 or Smaller` +`testElse(5)` deve retornar a string `5 or Smaller` ```js assert(testElse(5) === '5 or Smaller'); ``` -`testElse(6)` should return the string `Bigger than 5` +`testElse(6)` deve retornar a string `Bigger than 5` ```js assert(testElse(6) === 'Bigger than 5'); ``` -`testElse(10)` should return the string `Bigger than 5` +`testElse(10)` deve retornar a string `Bigger than 5` ```js assert(testElse(10) === 'Bigger than 5'); ``` -You should not change the code above or below the specified comments. +Você não deve alterar o código acima ou abaixo dos comentários especificados. ```js assert(/var result = "";/.test(code) && /return result;/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md index bbcc4049a8..2fb9511207 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md @@ -1,6 +1,6 @@ --- id: 56104e9e514f539506016a5c -title: Iterate Odd Numbers With a For Loop +title: Itere Números Ímpares Com um Laço For challengeType: 1 videoUrl: 'https://scrimba.com/c/cm8n7T9' forumTopicId: 18212 @@ -9,9 +9,9 @@ dashedName: iterate-odd-numbers-with-a-for-loop # --description-- -For loops don't have to iterate one at a time. By changing our `final-expression`, we can count by even numbers. +Laços for não tem de iterar um de cada vez. Ao alterar nossa `expressão final`, nós podemos contar os números pares. -We'll start at `i = 0` and loop while `i < 10`. We'll increment `i` by 2 each loop with `i += 2`. +Começaremos em `i = 0` e um laço while `i < 10`. Incrementaremos `i` em 2 a cada iteração com `i += 2`. ```js var ourArray = []; @@ -20,21 +20,21 @@ for (var i = 0; i < 10; i += 2) { } ``` -`ourArray` will now contain `[0,2,4,6,8]`. Let's change our `initialization` so we can count by odd numbers. +`ourArray` agora conterá `[0,2,4,6,8]`. Vamos mudar nossa `inicialização` para que possamos contar por números ímpares. # --instructions-- -Push the odd numbers from 1 through 9 to `myArray` using a `for` loop. +Adicione (push) os números ímpares de 9 até 1 para `myArray` usando um laço `for`. # --hints-- -You should be using a `for` loop for this. +Você deve estar usando um laço `for` para isso. ```js assert(/for\s*\([^)]+?\)/.test(code)); ``` -`myArray` should equal `[1,3,5,7,9]`. +`myArray` deve ser igual a `[1,3,5,7,9]`. ```js assert.deepEqual(myArray, [1, 3, 5, 7, 9]); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index 8dbe697f60..4bb61d94d6 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -1,6 +1,6 @@ --- id: 5675e877dbd60be8ad28edc6 -title: Iterate Through an Array with a For Loop +title: Itere através de um Array com Laço For challengeType: 1 videoUrl: 'https://scrimba.com/c/caeR3HB' forumTopicId: 18216 @@ -9,7 +9,7 @@ dashedName: iterate-through-an-array-with-a-for-loop # --description-- -A common task in JavaScript is to iterate through the contents of an array. One way to do that is with a `for` loop. This code will output each element of the array `arr` to the console: +Uma tarefa comum em JavaScript é para iterar através do conteúdo de um array. Uma forma de fazer isso é com um laço `for`. Esse código irá exibir cada elemento do array `arr` no console: ```js var arr = [10, 9, 8, 7, 6]; @@ -18,33 +18,33 @@ for (var i = 0; i < arr.length; i++) { } ``` -Remember that arrays have zero-based indexing, which means the last index of the array is `length - 1`. Our condition for this loop is `i < arr.length`, which stops the loop when `i` is equal to `length`. In this case the last iteration is `i === 4` i.e. when `i` becomes equal to `arr.length - 1` and outputs `6` to the console. Then `i` increases to `5`, and the loop terminates because `i < arr.length` is `false`. +Lembre-se de que arrays têm indexação baseada em zero, o que significa que o último índice do array é de `length - 1`. Nossa condição para esse laço é `i < arr.length`, a qual interrompe o laço quando `i` é igual a `length`. Nesse caso a última iteração é ` i === 4` i.e. quando `i` se tornar igual a `arr.length - 1` e exibe `6` no console. Em seguida, `i` aumenta para `5`, e o laço é interrompido porque `i < arr.length` é `false`. # --instructions-- -Declare and initialize a variable `total` to `0`. Use a `for` loop to add the value of each element of the `myArr` array to `total`. +Declare e inicialize uma variável `total` como `0`. Use um laço `for` para adicionar o valor de cada elemento do array `myArr` para `total`. # --hints-- -`total` should be declared and initialized to 0. +`total` deve ser declarado e inicializado como 0. ```js assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); ``` -`total` should equal 20. +`total` deve ser igual a 20. ```js assert(total === 20); ``` -You should use a `for` loop to iterate through `myArr`. +Você deve usar um laço `for` para iterar através de `myArr`. ```js assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code)); ``` -You should not attempt to directly assign the value 20 to `total`. +Você não deve tentar atribuir diretamente o valor 20 para `total`. ```js assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md index f4dfc98ba7..cf36b514d5 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md @@ -1,6 +1,6 @@ --- id: 5a2efd662fb457916e1fe604 -title: Iterate with JavaScript Do...While Loops +title: Itere com Laços Do...While JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cDqWGcp' forumTopicId: 301172 @@ -9,7 +9,7 @@ dashedName: iterate-with-javascript-do---while-loops # --description-- -The next type of loop you will learn is called a `do...while` loop. It is called a `do...while` loop because it will first `do` one pass of the code inside the loop no matter what, and then continue to run the loop `while` the specified condition evaluates to `true`. +O próximo tipo de laço que você aprenderá é chamado de laço `do...while`. É chamado um laço `do...while` porque primeiro irá toda vez `fazer (do)`, ou executar, uma vez o bloco de código após a instrução do, não importa o que acontecer, e então continuará a executar o laço `enquanto (while)` a condição for `true`. ```js var ourArray = []; @@ -20,7 +20,7 @@ do { } while (i < 5); ``` -The example above behaves similar to other types of loops, and the resulting array will look like `[0, 1, 2, 3, 4]`. However, what makes the `do...while` different from other loops is how it behaves when the condition fails on the first check. Let's see this in action: Here is a regular `while` loop that will run the code in the loop as long as `i < 5`: +O exemplo acima se comporta de forma similar a outros tipos de laços, e o array resultante se parecerá com `[0,1,2,3,4]`. No entanto, o que torna o laço `do...while` diferente de outros laços é como ele se comporta quando uma condição falha na primeira verificação. Vamos ver isso na prática: Aqui está um laço comum `while` que rodará o código no laço enquanto `i < 5`: ```js var ourArray = []; @@ -31,7 +31,7 @@ while (i < 5) { } ``` -In this example, we initialize the value of `ourArray` to an empty array and the value of `i` to 5. When we execute the `while` loop, the condition evaluates to `false` because `i` is not less than 5, so we do not execute the code inside the loop. The result is that `ourArray` will end up with no values added to it, and it will still look like `[]` when all of the code in the example above has completed running. Now, take a look at a `do...while` loop: +Nesse exemplo, inicializamos o valor de `ourArray` como um array vazio e o valor de `i` sendo 5. Quando executamos o laço `while`, a condição é igual a `false` porque `i` não é menor que 5, portanto nós não executamos o código dentro do laço. O resultado é que `ourArray` terminará sem valores adicionados a ele, e ainda se parecerá com `[]` quando todas as linhas do código no exemplo acima for completamente executadas. Agora, dê uma olhada no laço `do...while`: ```js var ourArray = []; @@ -42,27 +42,27 @@ do { } while (i < 5); ``` -In this case, we initialize the value of `i` to 5, just like we did with the `while` loop. When we get to the next line, there is no condition to evaluate, so we go to the code inside the curly braces and execute it. We will add a single element to the array and then increment `i` before we get to the condition check. When we finally evaluate the condition `i < 5` on the last line, we see that `i` is now 6, which fails the conditional check, so we exit the loop and are done. At the end of the above example, the value of `ourArray` is `[5]`. Essentially, a `do...while` loop ensures that the code inside the loop will run at least once. Let's try getting a `do...while` loop to work by pushing values to an array. +Nesse caso, nós inicializamos o valor de `i` para 5, assim como fizemos com o laço `while`. Quando chegamos na próxima linha, não há condição a ser analisada, então nós vamos ao código dentro das chaves e o executamos. Nós adicionaremos um único elemento ao array e então incrementamos `i` antes de chegarmos a verificação da condição. Quando nós finalmente temos o resultado da condição `i < 5` na última linha, nós notamos que `i` agora é 6, o que não cumpre a verificação da condição, então nós saímos do laço e terminamos. Ao final do exemplo acima, o valor de `ourArray` é `[5]`. Essencialmente, um laço `do...while` garante que o código dentro do laço será executado pelo menos uma vez. Vamos tentar fazer um laço `do...while` funcionar empurrando valores para um array. # --instructions-- -Change the `while` loop in the code to a `do...while` loop so the loop will push only the number `10` to `myArray`, and `i` will be equal to `11` when your code has finished running. +Altere o laço `while` no código para um laço `do...while` para que o laço adicione apenas o número `10` no `myArray` e `i` será igual a `11` quando seu código terminar de rodar. # --hints-- -You should be using a `do...while` loop for this exercise. +Você deve usar um laço `do...while` nesse exercício. ```js assert(code.match(/do/g)); ``` -`myArray` should equal `[10]`. +`myArray` deve ser igual a `[10]`. ```js assert.deepEqual(myArray, [10]); ``` -`i` should equal `11` +`i` deve ser igual a `11` ```js assert.equal(i, 11); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md index a5a0a63719..8e3fa4e4f0 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md @@ -1,6 +1,6 @@ --- id: cf1111c1c11feddfaeb5bdef -title: Iterate with JavaScript For Loops +title: Itere com Laços For JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/c9yNVCe' forumTopicId: 18219 @@ -9,21 +9,21 @@ dashedName: iterate-with-javascript-for-loops # --description-- -You can run the same code multiple times by using a loop. +Você pode rodar o mesmo código várias vezes usando um laço. -The most common type of JavaScript loop is called a `for` loop because it runs for a specific number of times. +O tipo mais comum de laço JavaScript é chamado de laço `for` porque ele é executado por um número especificado de vezes. -For loops are declared with three optional expressions separated by semicolons: +Laços For são declarados com três expressões opcionais separadas por ponto e vírgula: -`for (a; b; c)`, where `a` is the intialization statement, `b` is the condition statement, and `c` is the final expression. +`for (a; b; c)`, onde `a` é a declaração de inicialização, `b` é a declaração de condição, e `c` é a expressão final. -The initialization statement is executed one time only before the loop starts. It is typically used to define and setup your loop variable. +A declaração de inicialização é executada apenas uma vez antes do laço iniciar. Normalmente é usado para definir e configurar sua variável de laço. -The condition statement is evaluated at the beginning of every loop iteration and will continue as long as it evaluates to `true`. When the condition is `false` at the start of the iteration, the loop will stop executing. This means if the condition starts as false, your loop will never execute. +A declaração de condição é verificada no início de cada iteração do laço e irá continuar enquanto seu valor for `true`. Quando a condição for `false` no início da iteração, o laço irá parar de executar. Isso significa que se a condição de início for falsa, seu laço nunca será executado. -The final expression is executed at the end of each loop iteration, prior to the next condition check and is usually used to increment or decrement your loop counter. +A expressão final é executada no final de cada iteração do laço, antes da verificação da próxima condição e normalmente é usada para incrementar ou decrementar o contador do laço. -In the following example we initialize with `i = 0` and iterate while our condition `i < 5` is true. We'll increment `i` by `1` in each loop iteration with `i++` as our final expression. +No exemplo a seguir, inicializamos com `i = 0` e iteramos enquanto nossa condição `i < 5` for verdadeira. Nós incrementaremos `i` em `1` em cada iteração do laço com `i++` como nossa expressão final. ```js var ourArray = []; @@ -32,21 +32,21 @@ for (var i = 0; i < 5; i++) { } ``` -`ourArray` will now have the value `[0,1,2,3,4]`. +`ourArray` agora terá o valor de `[0,1,2,3,4]`. # --instructions-- -Use a `for` loop to push the values 1 through 5 onto `myArray`. +Use o laço `for` para adicionar os valores de 1 até 5 dentro de `myArray`. # --hints-- -You should be using a `for` loop for this. +Você deve usar um laço `for` para isso. ```js assert(/for\s*\([^)]+?\)/.test(code)); ``` -`myArray` should equal `[1,2,3,4,5]`. +`myArray` deve ser igual a `[1,2,3,4,5]`. ```js assert.deepEqual(myArray, [1, 2, 3, 4, 5]); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md index 1352d3e88d..ae7f5ea2fc 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md @@ -1,6 +1,6 @@ --- id: cf1111c1c11feddfaeb1bdef -title: Iterate with JavaScript While Loops +title: Itere com Laços While em JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/c8QbnCM' forumTopicId: 18220 @@ -9,9 +9,9 @@ dashedName: iterate-with-javascript-while-loops # --description-- -You can run the same code multiple times by using a loop. +Você pode rodar o mesmo código várias vezes ao usar um laço. -The first type of loop we will learn is called a `while` loop because it runs while a specified condition is true and stops once that condition is no longer true. +O primeiro tipo de laço que aprenderemos é chamado de laço `while` porque ele irá rodar enquanto uma condição específica for verdadeira e irá parar uma vez que a condição não for mais verdadeira. ```js var ourArray = []; @@ -22,23 +22,23 @@ while(i < 5) { } ``` -In the code example above, the `while` loop will execute 5 times and append the numbers 0 through 4 to `ourArray`. +No código de exemplo acima, o laço `while` executará por 5 vezes e adicionará os números de 0 até 4 ao `ourArray`. -Let's try getting a while loop to work by pushing values to an array. +Vamos tentar fazer um laço while funcionar empurrando valores para um array. # --instructions-- -Add the numbers 5 through 0 (inclusive) in descending order to `myArray` using a `while` loop. +Adicione os números de 5 até 1 (inclusivo) em ordem descendente para `myArray` usando um laço `while`. # --hints-- -You should be using a `while` loop for this. +Você deve usar um laço `while` para isso. ```js assert(code.match(/while/g)); ``` -`myArray` should equal `[5,4,3,2,1,0]`. +`myArray` deve ser igual a `[5,4,3,2,1,0]`. ```js assert.deepEqual(myArray, [5, 4, 3, 2, 1, 0]); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index 21f992cdf6..8264a9ee9d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244bf -title: Local Scope and Functions +title: Escopo Local e Funções challengeType: 1 videoUrl: 'https://scrimba.com/c/cd62NhM' forumTopicId: 18227 @@ -9,9 +9,9 @@ dashedName: local-scope-and-functions # --description-- -Variables which are declared within a function, as well as the function parameters, have local scope. That means they are only visible within that function. +Variáveis que são declaradas dentro de uma função, assim como parâmetros de funções, possuem escopo local. Isso significa que eles são visíveis apenas dentro da função. -Here is a function `myTest` with a local variable called `loc`. +Aqui está uma função `myTest` com uma variável local chamada `loc`. ```js function myTest() { @@ -22,17 +22,17 @@ myTest(); console.log(loc); ``` -The `myTest()` function call will display the string `foo` in the console. The `console.log(loc)` line will throw an error, as `loc` is not defined outside of the function. +A chamada da função `myTest()` irá exibir a string `foo` no console. A linha `console.log(loc)` irá lançar um erro, já que `loc` não foi definido fora da função. # --instructions-- -The editor has two `console.log`s to help you see what is happening. Check the console as you code to see how it changes. Declare a local variable `myVar` inside `myLocalScope` and run the tests. +O editor possui dois `console.log` para te ajudar a ver o que está acontecendo. Verifique o console enquanto codifica para ver como muda. Declare uma variável local `myVar` dentro de `myLocalScope` e rode os testes. -**Note:** The console will still display `ReferenceError: myVar is not defined`, but this will not cause the tests to fail. +**Nota:** O console ainda exibirá `ReferenceError: myVar is not defined`, mas isso não causará falha nos testes. # --hints-- -The code should not contain a global `myVar` variable. +O código não deve conter uma variável global `myVar`. ```js function declared() { @@ -41,7 +41,7 @@ function declared() { assert.throws(declared, ReferenceError); ``` -You should add a local `myVar` variable. +Você deve adicionar a variável local `myVar`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.md index c86a9a9a7c..8765a2f74a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.md @@ -1,6 +1,6 @@ --- id: 5690307fddb111c6084545d7 -title: Logical Order in If Else Statements +title: Ordem Lógica em Instruções If Else challengeType: 1 videoUrl: 'https://scrimba.com/c/cwNvMUV' forumTopicId: 18228 @@ -9,13 +9,13 @@ dashedName: logical-order-in-if-else-statements # --description-- -Order is important in `if`, `else if` statements. +Ordem é importante em instruções `if` e `else if`. -The function is executed from top to bottom so you will want to be careful of what statement comes first. +A função é executada de cima para baixo, então você deve ser cuidados com qual instrução vem primeiro. -Take these two functions as an example. +Tomem essas duas funções como exemplo. -Here's the first: +Aqui está a primeira: ```js function foo(x) { @@ -29,7 +29,7 @@ function foo(x) { } ``` -And the second just switches the order of the statements: +E a segunda apenas altera a ordem das instruções if e else if: ```js function bar(x) { @@ -43,34 +43,34 @@ function bar(x) { } ``` -While these two functions look nearly identical if we pass a number to both we get different outputs. +Embora as duas funções se pareçam praticamente idênticas, se nós passarmos um número para ambos nós teremos saídas diferentes. ```js foo(0) bar(0) ``` -`foo(0)` will return the string `Less than one`, and `bar(0)` will return the string `Less than two`. +`foo(0)` retornará a string `Less than one`, e `bar(0)` retornará a string `Less than two`. # --instructions-- -Change the order of logic in the function so that it will return the correct statements in all cases. +Altere a ordem lógica na função para que retorne as instruções corretas em todos os cenários. # --hints-- -`orderMyLogic(4)` should return the string `Less than 5` +`orderMyLogic(4)` deve retornar a string `Less than 5` ```js assert(orderMyLogic(4) === 'Less than 5'); ``` -`orderMyLogic(6)` should return the string `Less than 10` +`orderMyLogic(6)` deve retornar a string `Less than 10` ```js assert(orderMyLogic(6) === 'Less than 10'); ``` -`orderMyLogic(11)` should return the string `Greater than or equal to 10` +`orderMyLogic(11)` deve retornar a string `Greater than or equal to 10` ```js assert(orderMyLogic(11) === 'Greater than or equal to 10'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md index 0a0cfbe9d7..c2c616e099 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md @@ -1,6 +1,6 @@ --- id: 56bbb991ad1ed5201cd392cc -title: Manipulate Arrays With pop() +title: Manipule Arrays com pop() challengeType: 1 videoUrl: 'https://scrimba.com/c/cRbVZAB' forumTopicId: 18236 @@ -9,11 +9,11 @@ dashedName: manipulate-arrays-with-pop # --description-- -Another way to change the data in an array is with the `.pop()` function. +Outra forma de alterar os dados em um array é com a função `.pop()`. -`.pop()` is used to pop a value off of the end of an array. We can store this popped off value by assigning it to a variable. In other words, `.pop()` removes the last element from an array and returns that element. +`.pop()` é usado para remover um valor do final do array. Nós podemos armazenar esse valor removido ao atribuir a saída da chamada do método a uma variável. Em outras palavras, `.pop()` remove o último elemento de um array e retorna aquele elemento. -Any type of entry can be popped off of an array - numbers, strings, even nested arrays. +Qualquer tipo de entrada pode ser removida de um array - numbers, strings e até mesmo arrays aninhados. ```js var threeArr = [1, 4, 6]; @@ -22,15 +22,15 @@ console.log(oneDown); console.log(threeArr); ``` -The first `console.log` will display the value `6`, and the second will display the value `[1, 4]`. +O primeiro `consol.log` exibirá o valor `6`, e o segundo irá exibir o valor `[1, 4]`. # --instructions-- -Use the `.pop()` function to remove the last item from `myArray`, assigning the popped off value to `removedFromMyArray`. +Use a função `.pop()` para remover o último item de `myArray`, atribuindo o valor removido para `removedFromMyArray`. # --hints-- -`myArray` should only contain `[["John", 23]]`. +`myArray` deve conter apenas `[["John", 23]]`. ```js assert( @@ -44,13 +44,13 @@ assert( ); ``` -You should use `pop()` on `myArray`. +Você deve usar `pop()` em `myArray`. ```js assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code)); ``` -`removedFromMyArray` should only contain `["cat", 2]`. +`removedFromMyArray` deve conter apenas `["cat", 2]`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md index 5770ab00a5..2823dda027 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md @@ -1,6 +1,6 @@ --- id: 56bbb991ad1ed5201cd392cb -title: Manipulate Arrays With push() +title: Manipule Arrays Com push() challengeType: 1 videoUrl: 'https://scrimba.com/c/cnqmVtJ' forumTopicId: 18237 @@ -9,11 +9,11 @@ dashedName: manipulate-arrays-with-push # --description-- -An easy way to append data to the end of an array is via the `push()` function. +Uma forma fácil de adicionar dados no final de um array é através da função `push()`. -`.push()` takes one or more parameters and "pushes" them onto the end of the array. +`.push()` recebe um ou mais parâmetros e "empurra" eles no final do array. -Examples: +Exemplos: ```js var arr1 = [1,2,3]; @@ -23,15 +23,15 @@ var arr2 = ["Stimpson", "J", "cat"]; arr2.push(["happy", "joy"]); ``` -`arr1` now has the value `[1, 2, 3, 4]` and `arr2` has the value `["Stimpson", "J", "cat", ["happy", "joy"]]`. +`arr1` agora tem o valor de `[1, 2, 3, 4]` e `arr2` tem o valor de `["Stimpson", "J", "cat", ["happy", "joy"]]`. # --instructions-- -Push `["dog", 3]` onto the end of the `myArray` variable. +Empurre `["dog", 3]` no final da variável `myArray`. # --hints-- -`myArray` should now equal `[["John", 23], ["cat", 2], ["dog", 3]]`. +`myArray` agora deve ser igual a `[["John", 23], ["cat", 2], ["dog", 3]]`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.md index b2cfc4b051..8815edee07 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.md @@ -1,6 +1,6 @@ --- id: 56bbb991ad1ed5201cd392cd -title: Manipulate Arrays With shift() +title: Manipule Arrays Com shift() challengeType: 1 videoUrl: 'https://scrimba.com/c/cRbVETW' forumTopicId: 18238 @@ -9,26 +9,26 @@ dashedName: manipulate-arrays-with-shift # --description-- -`pop()` always removes the last element of an array. What if you want to remove the first? +`pop()` sempre remove o último elemento de um array. E se você quiser remover o primeiro? -That's where `.shift()` comes in. It works just like `.pop()`, except it removes the first element instead of the last. +É aí que o `.shift()` vem a ser útil. Ele funciona da mesma forma que `.pop()`, exceto que ele remove o primeiro elemento ao invés do último. -Example: +Exemplo: ```js var ourArray = ["Stimpson", "J", ["cat"]]; var removedFromOurArray = ourArray.shift(); ``` -`removedFromOurArray` would have a value of the string `Stimpson`, and `ourArray` would have `["J", ["cat"]]`. +`removedFromOurArray` teria o valor da string `Stimpson` e `ourArray` teria o valor de `["J", ["cat"]]`. # --instructions-- -Use the `.shift()` function to remove the first item from `myArray`, assigning the "shifted off" value to `removedFromMyArray`. +Use a função `.shift()` para remover o primeiro item de `myArray`, atribuindo o valor "removido" para `removedFromMyArray`. # --hints-- -`myArray` should now equal `[["dog", 3]]`. +`myArray` agora deve ser igual a `[["dog", 3]]`. ```js assert( @@ -42,7 +42,7 @@ assert( ); ``` -`removedFromMyArray` should contain `["John", 23]`. +`removedFromMyArray` deve conter `["John", 23]`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md index cf5fd257b8..3c3000a6dd 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md @@ -1,6 +1,6 @@ --- id: 56bbb991ad1ed5201cd392ce -title: Manipulate Arrays With unshift() +title: Manipule Arrays Com unshift() challengeType: 1 videoUrl: 'https://scrimba.com/c/ckNDESv' forumTopicId: 18239 @@ -9,11 +9,11 @@ dashedName: manipulate-arrays-with-unshift # --description-- -Not only can you `shift` elements off of the beginning of an array, you can also `unshift` elements to the beginning of an array i.e. add elements in front of the array. +Não só você pode `remover` elementos do início de um array, como você também pode `adicionar (unshift)` elementos ao início de um array i.e. adiciona elementos na frente do array. -`.unshift()` works exactly like `.push()`, but instead of adding the element at the end of the array, `unshift()` adds the element at the beginning of the array. +`.unshift()` funciona exatamente como `.push()`, mas ao invés de adicionar o elemento ao final do array, `unshift` adiciona o elemento no início do array. -Example: +Exemplo: ```js var ourArray = ["Stimpson", "J", "cat"]; @@ -21,15 +21,15 @@ ourArray.shift(); ourArray.unshift("Happy"); ``` -After the `shift`, `ourArray` would have the value `["J", "cat"]`. After the `unshift`, `ourArray` would have the value `["Happy", "J", "cat"]`. +Após o `shift`, `ourArray` teria o valor `["J","cat"]`. Após o `unshift`, `ourArray` teria o valor `["Happy","J","cat"]`. # --instructions-- -Add `["Paul",35]` to the beginning of the `myArray` variable using `unshift()`. +Adicione `["Paul",35]` ao início da variável `myArray` usando `unshift()`. # --hints-- -`myArray` should now have `[["Paul", 35], ["dog", 3]]`. +`myArray` agora deve ter `[["Paul", 35], ["dog", 3]]`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md index 2be10c422a..3bd40249f4 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244cb -title: Manipulating Complex Objects +title: Manipulando Objetos Complexos challengeType: 1 videoUrl: 'https://scrimba.com/c/c9yNMfR' forumTopicId: 18208 @@ -9,9 +9,9 @@ dashedName: manipulating-complex-objects # --description-- -Sometimes you may want to store data in a flexible Data Structure. A JavaScript object is one way to handle flexible data. They allow for arbitrary combinations of strings, numbers, booleans, arrays, functions, and objects. +Às vezes você pode querer armazenar dados em uma Estrutura de Dados flexível. Um objeto JavaScript é uma forma de lidar com dados flexíveis. Eles permitem combinações arbitrárias de strings, numbers, booleans, arrays, functions e objects. -Here's an example of a complex data structure: +Aqui está um exemplo de estrutura de dados complexas: ```js var ourMusic = [ @@ -29,7 +29,7 @@ var ourMusic = [ ]; ``` -This is an array which contains one object inside. The object has various pieces of metadata about an album. It also has a nested `formats` array. If you want to add more album records, you can do this by adding records to the top level array. Objects hold data in a property, which has a key-value format. In the example above, `"artist": "Daft Punk"` is a property that has a key of `artist` and a value of `Daft Punk`. [JavaScript Object Notation](http://www.json.org/) or `JSON` is a related data interchange format used to store data. +Isto é um array o qual contém um objeto dentro dele. O objeto possui vários pedaços de metadados sobre um album. Também possui um array aninhado `formats`. Se você quiser adicionar mais discos de album, você pode fazer isso ao adicionar os discos no array de alto nível. Objetos armazenam dados em uma propriedade, a qual possui um formato de chave-valor. No exemplo acima, `"artist": "Daft Punk"` é uma propriedade que tem uma chave `artist` e um valor de `Daft Punk`. [Notação de Objeto JavaScript](http://www.json.org/) ou `JSON` é um formato, de interalteração de dados relacionados, usado para armazenar dados. ```json { @@ -45,39 +45,39 @@ This is an array which contains one object inside. The object has various pieces } ``` -**Note:** You will need to place a comma after every object in the array, unless it is the last object in the array. +**Nota:** Você precisará colocar uma vírgula após cada objeto no array, a não ser que for o último objeto no array. # --instructions-- -Add a new album to the `myMusic` array. Add `artist` and `title` strings, `release_year` number, and a `formats` array of strings. +Adicione um novo álbum para o array `myMusic`. Adicione strings: `artist` e `title`, número: `release_year`, e um array de strings: `formats`. # --hints-- -`myMusic` should be an array +`myMusic` deve ser um array ```js assert(Array.isArray(myMusic)); ``` -`myMusic` should have at least two elements +`myMusic` deve ter pelo menos dois elementos ```js assert(myMusic.length > 1); ``` -The elements in the `myMusic` array should be objects +Os elementos no array `myMusic` devem ser objetos ```js myMusic.forEach(object => {assert.typeOf(object, 'object')}) ``` -Your object in `myMusic` should have at least 4 properties +Seu objeto em `myMusic` deve ter pelo menos 4 propriedades ```js myMusic.forEach(object => {assert(Object.keys(object).length > 3); }); ``` -Your object in `myMusic` should contain the property `artist` which is a string +Seu objeto em `myMusic` deve conter a propriedade `artist` a qual é uma string ```js myMusic.forEach(object => { @@ -86,7 +86,7 @@ myMusic.forEach(object => { }) ``` -Your object in `myMusic` should contain the property `title` which is a string +Seu objeto em `myMusic` deve conter a propriedade `title` a qual é uma string ```js myMusic.forEach(object => { @@ -95,7 +95,7 @@ myMusic.forEach(object => { }) ``` -Your object in `myMusic` should contain the property `release_year` which is a number +Seu objeto em `myMusic` deve conter a propriedade `release_year` a qual é um número ```js myMusic.forEach(object => { @@ -104,7 +104,7 @@ myMusic.forEach(object => { }) ``` -Your object in `myMusic` should contain a `formats` property which is an array +Seu objeto em `myMusic` deve conter a propriedade `formats` a qual é um array ```js myMusic.forEach(object => { @@ -113,7 +113,7 @@ myMusic.forEach(object => { }) ``` -`formats` should be an array of strings with at least two elements +`formats` deve ser um array de strings com pelo menos dois elementos ```js myMusic.forEach(object => { diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md index 3c32397583..f3e84c455a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md @@ -1,6 +1,6 @@ --- id: cf1111c1c11feddfaeb8bdef -title: Modify Array Data With Indexes +title: Modifique Dados de Array Com Índices challengeType: 1 videoUrl: 'https://scrimba.com/c/czQM4A8' forumTopicId: 18241 @@ -9,26 +9,26 @@ dashedName: modify-array-data-with-indexes # --description-- -Unlike strings, the entries of arrays are mutable and can be changed freely. +Diferente de strings, as entradas de um array são mutáveis e pode ser modificadas livremente. -**Example** +**Exemplo** ```js var ourArray = [50,40,30]; ourArray[0] = 15; ``` -`ourArray` now has the value `[15, 40, 30]`. +`ourArray` agora tem o valor `[15, 40, 30]`. -**Note:** There shouldn't be any spaces between the array name and the square brackets, like `array [0]`. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code. +**Nota:** Não deve ter espaços entre o nome do array e os colchetes, como `array [0]`. Embora JavaScript é capaz de processar isso corretamente, isso pode causar confusão em outros programadores lendo o seu código. # --instructions-- -Modify the data stored at index `0` of `myArray` to a value of `45`. +Modifique o dado armazenado no índice `0` de `myArray` para um valor de `45`. # --hints-- -`myArray` should now be `[45,64,99]`. +`myArray` agora deve ser `[45,64,99]`. ```js assert( @@ -47,7 +47,7 @@ assert( ); ``` -You should be using correct index to modify the value in `myArray`. +Você deve usar o índice correto para modificar o valor em `myArray`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md index ad2c7e1643..e120501acc 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244df -title: Multiple Identical Options in Switch Statements +title: Várias Opções Idênticas em Instruções Switch challengeType: 1 videoUrl: 'https://scrimba.com/c/cdBKWCV' forumTopicId: 18242 @@ -9,7 +9,7 @@ dashedName: multiple-identical-options-in-switch-statements # --description-- -If the `break` statement is omitted from a `switch` statement's `case`, the following `case` statement(s) are executed until a `break` is encountered. If you have multiple inputs with the same output, you can represent them in a `switch` statement like this: +Se a instrução `break` for omitida de uma instrução `case` de um `switch`, as instruções seguintes `case` são executadas até que seja encontrado um `break`. Se você tem várias entradas com a mesma saída, você pode representá-los em uma instrução `switch` da seguinte forma: ```js var result = ""; @@ -24,80 +24,80 @@ switch(val) { } ``` -Cases for 1, 2, and 3 will all produce the same result. +Todos os casos para 1, 2 e 3 irão produzir o mesmo resultado. # --instructions-- -Write a switch statement to set `answer` for the following ranges: +Escreva uma instrução para definir `answer` para os seguintes intervalos: `1-3` - `Low` `4-6` - `Mid` `7-9` - `High` -**Note:** You will need to have a `case` statement for each number in the range. +**Nota:** Você precisará ter uma instrução `case` para cada número no intervalo. # --hints-- -`sequentialSizes(1)` should return the string `Low` +`sequentialSizes(1)` deve retornar a string `Low` ```js assert(sequentialSizes(1) === 'Low'); ``` -`sequentialSizes(2)` should return the string `Low` +`sequentialSizes(2)` deve retornar a string `Low` ```js assert(sequentialSizes(2) === 'Low'); ``` -`sequentialSizes(3)` should return the string `Low` +`sequentialSizes(3)` deve retornar a string `Low` ```js assert(sequentialSizes(3) === 'Low'); ``` -`sequentialSizes(4)` should return the string `Mid` +`sequentialSizes(4)` deve retornar a string `Mid` ```js assert(sequentialSizes(4) === 'Mid'); ``` -`sequentialSizes(5)` should return the string `Mid` +`sequentialSizes(5)` deve retornar a string `Mid` ```js assert(sequentialSizes(5) === 'Mid'); ``` -`sequentialSizes(6)` should return the string `Mid` +`sequentialSizes(6)` deve retornar a string `Mid` ```js assert(sequentialSizes(6) === 'Mid'); ``` -`sequentialSizes(7)` should return the string `High` +`sequentialSizes(7)` deve retornar a string `High` ```js assert(sequentialSizes(7) === 'High'); ``` -`sequentialSizes(8)` should return the string `High` +`sequentialSizes(8)` deve retornar a string `High` ```js assert(sequentialSizes(8) === 'High'); ``` -`sequentialSizes(9)` should return the string `High` +`sequentialSizes(9)` deve retornar a string `High` ```js assert(sequentialSizes(9) === 'High'); ``` -You should not use any `if` or `else` statements +Você não deve usar nenhuma das instruções `if` ou `else` ```js assert(!/else/g.test(code) || !/if/g.test(code)); ``` -You should have nine `case` statements +Você deve ter nove instruções `case` ```js assert(code.match(/case/g).length === 9); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md index 2a502314bb..082bd3b036 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md @@ -1,6 +1,6 @@ --- id: bd7993c9c69feddfaeb7bdef -title: Multiply Two Decimals with JavaScript +title: Multiplique Dois Decimais com JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/ce2GeHq' forumTopicId: 301173 @@ -9,23 +9,23 @@ dashedName: multiply-two-decimals-with-javascript # --description-- -In JavaScript, you can also perform calculations with decimal numbers, just like whole numbers. +Em JavaScript, você também pode realizar cálculos com números decimais, assim como com números inteiros. -Let's multiply two decimals together to get their product. +Vamos multiplicar dois decimais juntos para obter o produto deles. # --instructions-- -Change the `0.0` so that product will equal `5.0`. +Altere o `0.0` para que o produto seja igual a `5.0`. # --hints-- -The variable `product` should equal `5.0`. +A variável `product` deve ser igual `5.0`. ```js assert(product === 5.0); ``` -You should use the `*` operator +Você deve usar o operador `*` ```js assert(/\*/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md index a67c6a1d38..c00701db67 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md @@ -1,6 +1,6 @@ --- id: cf1231c1c11feddfaeb5bdef -title: Multiply Two Numbers with JavaScript +title: Multiplique Dois Números com JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cP3y3Aq' forumTopicId: 18243 @@ -9,31 +9,31 @@ dashedName: multiply-two-numbers-with-javascript # --description-- -We can also multiply one number by another. +Nós também podemos multiplicar um número por outro. -JavaScript uses the `*` symbol for multiplication of two numbers. +JavaScript usa o símbolo `*` para multiplicação de dois números. -**Example** +**Exemplo** ```js myVar = 13 * 13; ``` -`myVar` would have the value `169`. +`myVar` teria o valor `169`. # --instructions-- -Change the `0` so that product will equal `80`. +Altere o `0` para que o produto seja igual a `80`. # --hints-- -The variable `product` should be equal to 80. +A variável `product` deve ser igual a 80. ```js assert(product === 80); ``` -You should use the `*` operator. +Você deve usar o operador `*`. ```js assert(/\*/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md index e49ac053d0..105ee54565 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md @@ -1,6 +1,6 @@ --- id: cf1111c1c11feddfaeb7bdef -title: Nest one Array within Another Array +title: Aninhe um Array com Outro Array challengeType: 1 videoUrl: 'https://scrimba.com/c/crZQZf8' forumTopicId: 18247 @@ -9,21 +9,21 @@ dashedName: nest-one-array-within-another-array # --description-- -You can also nest arrays within other arrays, like below: +Você também pode aninhar arrays dentro de outros arrays, como abaixo: ```js [["Bulls", 23], ["White Sox", 45]] ``` -This is also called a multi-dimensional array. +Isso é chamado um array multidimensional. # --instructions-- -Create a nested array called `myArray`. +Crie um array aninhado chamado de `myArray`. # --hints-- -`myArray` should have at least one array nested within another array. +`myArray` deve ter pelo menos um array aninhado dentro de outro array. ```js assert(Array.isArray(myArray) && myArray.some(Array.isArray)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.md index 8b9042e06f..91f21bdee9 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244e1 -title: Nesting For Loops +title: Aninhando Laços For challengeType: 1 videoUrl: 'https://scrimba.com/c/cRn6GHM' forumTopicId: 18248 @@ -9,7 +9,7 @@ dashedName: nesting-for-loops # --description-- -If you have a multi-dimensional array, you can use the same logic as the prior waypoint to loop through both the array and any sub-arrays. Here is an example: +Se você possui um array multidimensional, você pode usar a mesma lógica no ponto de passagem anterior para iterar através ambos os arrays e qualquer sub-arrays. Aqui está um exemplo: ```js var arr = [ @@ -22,21 +22,21 @@ for (var i=0; i < arr.length; i++) { } ``` -This outputs each sub-element in `arr` one at a time. Note that for the inner loop, we are checking the `.length` of `arr[i]`, since `arr[i]` is itself an array. +Isso exibi no console cada sub elemento dentro de `arr`, um de cada vez. Note que para o laço interno, nós estamos verificando a propriedade `.length` de `arr[i]`, desde que `arr[i]` também é um array. # --instructions-- -Modify function `multiplyAll` so that it returns the product of all the numbers in the sub-arrays of `arr`. +Modifique a função `multiplyAll` para que retorne o produto de todos os números nos sub arrays de `arr`. # --hints-- -`multiplyAll([[1],[2],[3]])` should return `6` +`multiplyAll([[1],[2],[3]])` deve retornar `6` ```js assert(multiplyAll([[1], [2], [3]]) === 6); ``` -`multiplyAll([[1,2],[3,4],[5,6,7]])` should return `5040` +`multiplyAll([[1,2],[3,4],[5,6,7]])` deve retornar `5040` ```js assert( @@ -48,7 +48,7 @@ assert( ); ``` -`multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])` should return `54` +`multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])` deve retornar `54` ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md index 62795ccd42..fc65faab93 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244bd -title: Passing Values to Functions with Arguments +title: Passando Valores para Funções com Argumentos challengeType: 1 videoUrl: 'https://scrimba.com/c/cy8rahW' forumTopicId: 18254 @@ -9,9 +9,9 @@ dashedName: passing-values-to-functions-with-arguments # --description-- -Parameters are variables that act as placeholders for the values that are to be input to a function when it is called. When a function is defined, it is typically defined along with one or more parameters. The actual values that are input (or "passed") into a function when it is called are known as arguments. +Parâmetros são variáveis que atuam como espaços reservados para os valores que são passados para uma função, quando ela é chamada. Quando uma função é definida, normalmente ela é definida junto com um ou mais parâmetros. Os valores reais que são entradas de (ou "passadas" para) uma função quando ela é chamada são conhecidos como argumentos. -Here is a function with two parameters, `param1` and `param2`: +Aqui está uma função com dois parâmetros, `param1` e `param2`: ```js function testFun(param1, param2) { @@ -19,21 +19,21 @@ function testFun(param1, param2) { } ``` -Then we can call `testFun` like this: `testFun("Hello", "World");`. We have passed two string arguments, `Hello` and `World`. Inside the function, `param1` will equal the string `Hello` and `param2` will equal the string `World`. Note that you could call `testFun` again with different arguments and the parameters would take on the value of the new arguments. +Então podemos chamar o `testFun` dessa forma: `testFun("Hello", "World");`. Passamos dois argumentos do tipo string, `Hello` e `World`. Dentro da função, `param1` será igual à string `Hello` e `param2` será igual à string `World`. Note que você poderia chamar o `testFun` novamente com diferentes argumentos e os parâmetros assumiriam o valor dos novos argumentos. # --instructions-- -
          1. Create a function called functionWithArgs that accepts two arguments and outputs their sum to the dev console.
          2. Call the function with two numbers as arguments.
          +
          1. Crie uma função chamada functionWithArgs que aceita dois argumentos e exibe seus valores no console de desenvolvimento.
          2. Chame a função com dois números como argumentos.
          # --hints-- -`functionWithArgs` should be a function. +`functionWithArgs` deve ser uma função. ```js assert(typeof functionWithArgs === 'function'); ``` -`functionWithArgs(1,2)` should output `3`. +`functionWithArgs(1,2)` deve exibir no console `3`. ```js if (typeof functionWithArgs === 'function') { @@ -44,7 +44,7 @@ if (typeof functionWithArgs === 'function') { assert(logOutput == 3); ``` -`functionWithArgs(7,9)` should output `16`. +`functionWithArgs(7,9)` deve exibir no console `16`. ```js if (typeof functionWithArgs === 'function') { @@ -55,7 +55,7 @@ if (typeof functionWithArgs === 'function') { assert(logOutput == 16); ``` -You should call `functionWithArgs` with two numbers after you define it. +Você deve chamar a função `functionWithArgs` com dois números depois de defini-la. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md index 020af1ac5f..501c47d924 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md @@ -1,6 +1,6 @@ --- id: 599a789b454f2bbd91a3ff4d -title: Practice comparing different values +title: Pratique comparar diferentes valores challengeType: 1 videoUrl: 'https://scrimba.com/c/cm8PqCa' forumTopicId: 301174 @@ -9,42 +9,42 @@ dashedName: practice-comparing-different-values # --description-- -In the last two challenges, we learned about the equality operator (`==`) and the strict equality operator (`===`). Let's do a quick review and practice using these operators some more. +Nos últimos dois desafios, aprendemos sobre o operador de igualdade (`==`) e o operador de igualdade estrita (`===`). Vamos fazer uma breve revisão e praticar usando esses operadores mais uma vez. -If the values being compared are not of the same type, the equality operator will perform a type conversion, and then evaluate the values. However, the strict equality operator will compare both the data type and value as-is, without converting one type to the other. +Se os valores sendo comparados não são do mesmo tipo, o operador de igualdade irá fazer a conversão de tipo e, então, avaliar os valores. No entanto, o operador de igualdade estrita irá comparar ambos os tipos de dados e os valores, sem converter de um tipo para outro. -**Examples** +**Exemplos** -`3 == '3'` returns `true` because JavaScript performs type conversion from string to number. `3 === '3'` returns false because the types are different and type conversion is not performed. +`3 == '3'` retorna `true` porque JavaScript faz a conversão de tipo de string para número. `3 === '3'` retorna falso porque os tipos são diferentes e não é feita a conversão de tipo. -**Note:** In JavaScript, you can determine the type of a variable or a value with the `typeof` operator, as follows: +**Nota:** Em JavaScript, você pode determinar o tipo de uma variável ou de um valor, com o operador `typeof`, como se segue: ```js typeof 3 typeof '3' ``` -`typeof 3` returns the string `number`, and `typeof '3'` returns the string `string`. +`typeof 3` retorna a string `number` e `typeof '3'` retorna a string `string`. # --instructions-- -The `compareEquality` function in the editor compares two values using the equality operator. Modify the function so that it returns the string `Equal` only when the values are strictly equal. +A função `compareEquality` no editor compara dois valores usando o operador de igualdade. Modifique a função para que ela retorne a string `Equal` apenas quando os valores forem estritamente iguais. # --hints-- -`compareEquality(10, "10")` should return the string `Not Equal` +`compareEquality(10, "10")` deve retornar a string `Not Equal` ```js assert(compareEquality(10, '10') === 'Not Equal'); ``` -`compareEquality("20", 20)` should return the string `Not Equal` +`compareEquality("20", 20)` deve retornar a string `Not Equal` ```js assert(compareEquality('20', 20) === 'Not Equal'); ``` -You should use the `===` operator +Você deve usar o operador `===` ```js assert(code.match(/===/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md index 310597ad6f..1efd723f71 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md @@ -1,6 +1,6 @@ --- id: 5688e62ea601b2482ff8422b -title: Profile Lookup +title: Busca de Perfil challengeType: 1 videoUrl: 'https://scrimba.com/c/cDqW2Cg' forumTopicId: 18259 @@ -9,27 +9,27 @@ dashedName: profile-lookup # --description-- -We have an array of objects representing different people in our contacts lists. +Nós temos um array de objetos representando pessoas diferentes nas nossas listas de contatos. -A `lookUpProfile` function that takes `name` and a property (`prop`) as arguments has been pre-written for you. +Uma função `lookUpProfile`, que recebe `name` e uma propriedade (`prop`) como argumentos, foi pré-escrita para você. -The function should check if `name` is an actual contact's `firstName` and the given property (`prop`) is a property of that contact. +A função deve verificar se `name` é o `firstName` (primeiro nome) de um contato e se a propriedade passada (`prop`) é uma propriedade daquele contato. -If both are true, then return the "value" of that property. +Se ambos forem verdadeiros, então retorne o "valor" daquela propriedade. -If `name` does not correspond to any contacts then return the string `No such contact`. +Se `name` não corresponder a nenhum dos contatos, então retorne a string `No such contact`. -If `prop` does not correspond to any valid properties of a contact found to match `name` then return the string `No such property`. +Se `prop` não corresponder a nenhuma propriedade válida de um contato encontrado para coincidir com `name` então retorne a string `No such property`. # --hints-- -`lookUpProfile("Kristian", "lastName")` should return the string `Vos` +`lookUpProfile("Kristian", "lastName")` deve retornar a string `Vos` ```js assert(lookUpProfile('Kristian', 'lastName') === 'Vos'); ``` -`lookUpProfile("Sherlock", "likes")` should return `["Intriguing Cases", "Violin"]` +`lookUpProfile("Sherlock", "likes")` deve retornar `["Intriguing Cases", "Violin"]` ```js assert.deepEqual(lookUpProfile('Sherlock', 'likes'), [ @@ -38,25 +38,25 @@ assert.deepEqual(lookUpProfile('Sherlock', 'likes'), [ ]); ``` -`lookUpProfile("Harry", "likes")` should return an array +`lookUpProfile("Harry", "likes")` deve retornar um array ```js assert(typeof lookUpProfile('Harry', 'likes') === 'object'); ``` -`lookUpProfile("Bob", "number")` should return the string `No such contact` +`lookUpProfile("Bob", "number")` deve retornar a string `No such contact` ```js assert(lookUpProfile('Bob', 'number') === 'No such contact'); ``` -`lookUpProfile("Bob", "potato")` should return the string `No such contact` +`lookUpProfile("Bob", "potato")` deve retornar a string `No such contact` ```js assert(lookUpProfile('Bob', 'potato') === 'No such contact'); ``` -`lookUpProfile("Akira", "address")` should return the string `No such property` +`lookUpProfile("Akira", "address")` deve retornar a string `No such property` ```js assert(lookUpProfile('Akira', 'address') === 'No such property'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index 0947fbe41a..837e0cc640 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244b4 -title: Quoting Strings with Single Quotes +title: Cercando uma String com Aspas Simples challengeType: 1 videoUrl: 'https://scrimba.com/c/cbQmnhM' forumTopicId: 18260 @@ -9,41 +9,41 @@ dashedName: quoting-strings-with-single-quotes # --description-- -String values in JavaScript may be written with single or double quotes, as long as you start and end with the same type of quote. Unlike some other programming languages, single and double quotes work the same in JavaScript. +Valores de String em JavaScript podem ser escritas com aspas simples ou duplas, desde que você comece e termine com o mesmo tipo de aspas. Diferente de outras linguagens de programação, aspas simples e duplas funcionam da mesma forma em JavaScript. ```js doubleQuoteStr = "This is a string"; singleQuoteStr = 'This is also a string'; ``` -The reason why you might want to use one type of quote over the other is if you want to use both in a string. This might happen if you want to save a conversation in a string and have the conversation in quotes. Another use for it would be saving an `` tag with various attributes in quotes, all within a string. +O motivo pelo qual você pode querer usar um tipo de aspas no lugar da outra, é se você vir a querer usar ambas em uma string. Isso pode acontecer se você quiser salvar uma conversa em uma string e ter a conversa entre aspas. Outro uso para isso seria salvar uma tag `` com vários atributos em aspas, tudo dentro de uma string. ```js conversation = 'Finn exclaims to Jake, "Algebraic!"'; ``` -However, this becomes a problem if you need to use the outermost quotes within it. Remember, a string has the same kind of quote at the beginning and end. But if you have that same quote somewhere in the middle, the string will stop early and throw an error. +Porém, isso se torna um problema se você precisar usar as aspas mais extremas dentro dela. Lembre-se, uma string tem o mesmo tipo de aspas no início e no final. Mas se você tem aquela mesma aspa em algum lugar no meio, a string irá terminar mais cedo e lançará um erro. ```js goodStr = 'Jake asks Finn, "Hey, let\'s go on an adventure?"'; badStr = 'Finn responds, "Let's go!"'; ``` -Here `badStr` will throw an error. +Aqui `badStr` lançará um erro. -In the goodStr above, you can use both quotes safely by using the backslash `\` as an escape character. +Na string goodStr acima, você pode usar ambas as aspas com segurança ao usar a barra invertida `\` como um caractere de escapamento. -**Note:** The backslash `\` should not be confused with the forward slash `/`. They do not do the same thing. +**Nota:** A barra invertida `\` não deve ser confundida com a barra comum `/`. Elas não fazem a mesma coisa. # --instructions-- -Change the provided string to a string with single quotes at the beginning and end and no escape characters. +Altere a string fornecida para uma string com aspas simples no início e no final e sem caracteres de escapamento. -Right now, the `` tag in the string uses double quotes everywhere. You will need to change the outer quotes to single quotes so you can remove the escape characters. +Nesse momento, a tag `` na string usa aspas duplas em todo canto. Você precisará alterar as aspas mais externas em aspas simples, para que você possa remover os caracteres de escapamento. # --hints-- -You should remove all the backslashes (`\`). +Você deve remover todas as barras invertidas (`\`). ```js assert( @@ -54,7 +54,7 @@ assert( ); ``` -You should have two single quotes `'` and four double quotes `"`. +Você deve ter duas aspas simples `'` e quatro aspas duplas `"`. ```js assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md index 97c82e2e49..9fa2c4909b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244cf -title: Record Collection +title: Coleção de Disco challengeType: 1 forumTopicId: 18261 dashedName: record-collection @@ -8,21 +8,21 @@ dashedName: record-collection # --description-- -You are given an object literal representing a part of your musical album collection. Each album has a unique id number as its key and several other properties. Not all albums have complete information. +Você recebeu um objeto literal representando uma parte da sua coleção de álbuns musicais. Cada álbum possui um número de id único como sua chave e diversas outras propriedades. Nem todos os álbuns possuem informações completas. -You start with an `updateRecords` function that takes an object literal, `records`, containing the musical album collection, an `id`, a `prop` (like `artist` or `tracks`), and a `value`. Complete the function using the rules below to modify the object passed to the function. +Você começa com uma função `updateRecords` que recebe um objeto literal, `records`, contendo a coleção de álbuns musicais, um `id`, uma prop(like `artist` ou `tracks`) e um `vlaue`. Complete a função usando as regras abaixo para modificar o objeto passado para a função. -- Your function must always return the entire record collection object. -- If `prop` isn't `tracks` and `value` isn't an empty string, update or set that album's `prop` to `value`. -- If `prop` is `tracks` but the album doesn't have a `tracks` property, create an empty array and add `value` to it. -- If `prop` is `tracks` and `value` isn't an empty string, add `value` to the end of the album's existing `tracks` array. -- If `value` is an empty string, delete the given `prop` property from the album. +- Sua função precisa sempre retornar o objeto de coleção de discos completo. +- Se `prop` não for `tracks` e `value` não for uma string vazia, atualize ou defina aquela `prop` do album como `value`. +- Se `prop` for `tracks` mas o álbum não tiver uma propriedade `tracks`, crie um array vazio e adicione o `value` nesse array. +- Se `prop` for `tracks` e `value` não for uma string vazia, adicione `value` ao final do array existente de `tracks` do álbum. +- Se `value` for uma string vazia, remova a propriedade `prop` recebida do álbum. -**Note:** A copy of the `recordCollection` object is used for the tests. +**Nota:** Uma cópia do objeto `recordCollection` é usada para testes. # --hints-- -After `updateRecords(recordCollection, 5439, "artist", "ABBA")`, `artist` should be the string `ABBA` +Após `updateRecords(recordCollection, 5439, "artist", "ABBA")`, `artist` deve ser aa string `ABBA` ```js assert( @@ -31,7 +31,7 @@ assert( ); ``` -After `updateRecords(recordCollection, 5439, "tracks", "Take a Chance on Me")`, `tracks` should have the string `Take a Chance on Me` as the last element. +Após `updateRecords(recordCollection, 5439, "tracks", "Take a Chance on Me")`, `tracks` deve ter a string `Take a Chance on Me` como último elemento. ```js assert( @@ -41,14 +41,14 @@ assert( ); ``` -After `updateRecords(recordCollection, 2548, "artist", "")`, `artist` should not be set +Após `updateRecords(recordCollection, 2548, "artist", "")`, `artist` não deve ser definido ```js updateRecords(_recordCollection, 2548, 'artist', ''); assert(!_recordCollection[2548].hasOwnProperty('artist')); ``` -After `updateRecords(recordCollection, 1245, "tracks", "Addicted to Love")`, `tracks` should have the string `Addicted to Love` as the last element. +Após `updateRecords(recordCollection, 1245, "tracks", "Addicted to Love")`, `tracks` deve ter a string `Addicted to Love` como o último elemento. ```js assert( @@ -58,7 +58,7 @@ assert( ); ``` -After `updateRecords(recordCollection, 2468, "tracks", "Free")`, `tracks` should have the string `1999` as the first element. +Após `updateRecords(recordCollection, 2468, "tracks", "Free")`, `tracks` deve ter a string `1999` como o último elemento. Após. ```js assert( @@ -68,14 +68,14 @@ assert( ); ``` -After `updateRecords(recordCollection, 2548, "tracks", "")`, `tracks` should not be set +Após `updateRecords(recordCollection, 2548, "tracks", "")`, `tracks` não deve ser definido ```js updateRecords(_recordCollection, 2548, 'tracks', ''); assert(!_recordCollection[2548].hasOwnProperty('tracks')); ``` -After `updateRecords(recordCollection, 1245, "albumTitle", "Riptide")`, `albumTitle` should be the string `Riptide` +Após `updateRecords(recordCollection, 1245, "albumTitle", "Riptide")`, `albumTitle` deve ser a string `Riptide` ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index b7b76c9e4f..dca3c2396b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -1,6 +1,6 @@ --- id: 5cfa3679138e7d9595b9d9d4 -title: Replace Loops using Recursion +title: Substituir Laços com Recursividade challengeType: 1 videoUrl: >- https://www.freecodecamp.org/news/how-recursion-works-explained-with-flowcharts-and-a-video-de61f40cb7f9/ @@ -10,7 +10,7 @@ dashedName: replace-loops-using-recursion # --description-- -Recursion is the concept that a function can be expressed in terms of itself. To help understand this, start by thinking about the following task: multiply the first `n` elements of an array to create the product of those elements. Using a `for` loop, you could do this: +Recursividade é o conceito de que uma função pode ser chamada por ela mesmo. Para ajudar a entender isso, comece a pensar sobre a seguinte tarefa: multiplique os primeiros `n` elementos de um array para criar o produto desses elementos. Usando um laço `for`, você poderia fazer isso: ```js function multiply(arr, n) { @@ -22,7 +22,7 @@ Recursion is the concept that a function can be expressed in terms of itself. To } ``` -However, notice that `multiply(arr, n) == multiply(arr, n - 1) * arr[n - 1]`. That means you can rewrite `multiply` in terms of itself and never need to use a loop. +No entanto, note que `multiply(arr, n) == multiply(arr, n - 1) * arr[n - 1]`. Isso significa que você pode rescreve `multiply` dentro da própria função e nunca precisar de usar um laço. ```js function multiply(arr, n) { @@ -34,35 +34,35 @@ However, notice that `multiply(arr, n) == multiply(arr, n - 1) * arr[n - 1]`. Th } ``` -The recursive version of `multiply` breaks down like this. In the base case, where `n <= 0`, it returns 1. For larger values of `n`, it calls itself, but with `n - 1`. That function call is evaluated in the same way, calling `multiply` again until `n <= 0`. At this point, all the functions can return and the original `multiply` returns the answer. +A versão recursiva de `multiply` fica dessa forma. No caso de base, onde `n <= 0`, ele retorna 1. Para valores maiores de `n`, a função chama a si mesmo, mas com `n - 1`. Essa chamada da função é avaliada da mesma forma, chamando `multiply` novamente até que `n <= 0`. Nesse ponto, todas as funções podem retornar e a função `multiply` original retorna a resposta. -**Note:** Recursive functions must have a base case when they return without calling the function again (in this example, when `n <= 0`), otherwise they can never finish executing. +**Nota:** Funções recursivas precisam ter um caso base quando elas retornam sem chamar a função novamente (nesse exemplo, quando `n <= 0`), caso contrário, elas nunca irão parar de executar. # --instructions-- -Write a recursive function, `sum(arr, n)`, that returns the sum of the first `n` elements of an array `arr`. +Escreva uma função recursiva, `sum(arr, n)`, que retorna a soma dos primeiros `n` elementos de um array `arr`. # --hints-- -`sum([1], 0)` should equal 0. +`sum([1], 0)` deve ser igual a 0. ```js assert.equal(sum([1], 0), 0); ``` -`sum([2, 3, 4], 1)` should equal 2. +`sum([2, 3, 4], 1)` deve ser igual a 2. ```js assert.equal(sum([2, 3, 4], 1), 2); ``` -`sum([2, 3, 4, 5], 3)` should equal 9. +`sum([2, 3, 4, 5], 3)` deve ser igual a 9. ```js assert.equal(sum([2, 3, 4, 5], 3), 9); ``` -Your code should not rely on any kind of loops (`for` or `while` or higher order functions such as `forEach`, `map`, `filter`, or `reduce`.). +Seu código não deve depender de nenhum laço (`for` ou `while` ou funções de ordem superior como as funções `forEach`, `map`, `filter` ou `reduce`.). ```js assert( @@ -70,7 +70,7 @@ assert( ); ``` -You should use recursion to solve this problem. +Você deve usar recursividade para resolver o problema. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md index 02dc869675..d9573d31c9 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244e0 -title: Replacing If Else Chains with Switch +title: Substituir Cadeias de If Else por Switch challengeType: 1 videoUrl: 'https://scrimba.com/c/c3JE8fy' forumTopicId: 18266 @@ -9,7 +9,7 @@ dashedName: replacing-if-else-chains-with-switch # --description-- -If you have many options to choose from, a `switch` statement can be easier to write than many chained `if`/`else if` statements. The following: +Se você tiver muitas opções para escolher, uma instrução `switch` pode ser mais fácil de escrever do que muitas instruções `if`/`else if` encadeadas. O seguinte: ```js if (val === 1) { @@ -21,7 +21,7 @@ if (val === 1) { } ``` -can be replaced with: +pode ser substituído por: ```js switch(val) { @@ -38,65 +38,65 @@ switch(val) { # --instructions-- -Change the chained `if`/`else if` statements into a `switch` statement. +Altere a cadeia de instruções `if`/`else if` em um comando `switch`. # --hints-- -You should not use any `else` statements anywhere in the editor +Você não deve usar nenhuma instrução `else` em nenhum lugar no editor ```js assert(!/else/g.test(code)); ``` -You should not use any `if` statements anywhere in the editor +Você não deve usar nenhuma instrução `if` em nenhum lugar no editor ```js assert(!/if/g.test(code)); ``` -You should have at least four `break` statements +Você deve ter pelo menos instruções `break` ```js assert(code.match(/break/g).length >= 4); ``` -`chainToSwitch("bob")` should be the string `Marley` +`chainToSwitch("bob")` deve ser a string `Marley` ```js assert(chainToSwitch('bob') === 'Marley'); ``` -`chainToSwitch(42)` should be the string `The Answer` +`chainToSwitch(42)` deve ser a string `The Answer` ```js assert(chainToSwitch(42) === 'The Answer'); ``` -`chainToSwitch(1)` should be the string `There is no #1` +`chainToSwitch(1)` deve ser a string `There is no #1` ```js assert(chainToSwitch(1) === 'There is no #1'); ``` -`chainToSwitch(99)` should be the string `Missed me by this much!` +`chainToSwitch(99)` deve ser a string `Missed me by this much!` ```js assert(chainToSwitch(99) === 'Missed me by this much!'); ``` -`chainToSwitch(7)` should be the string `Ate Nine` +`chainToSwitch(7)` deve ser a string `Ate Nine` ```js assert(chainToSwitch(7) === 'Ate Nine'); ``` -`chainToSwitch("John")` should be `""` (empty string) +`chainToSwitch("John")` deve ser `""` (string vazia) ```js assert(chainToSwitch('John') === ''); ``` -`chainToSwitch(156)` should be `""` (empty string) +`chainToSwitch(156)` deve ser `""` (string vazia) ```js assert(chainToSwitch(156) === ''); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md index 7384c9b5cf..a185e8e5c5 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244c2 -title: Return a Value from a Function with Return +title: Retorne um Valor de uma Função com Return challengeType: 1 videoUrl: 'https://scrimba.com/c/cy87wue' forumTopicId: 18271 @@ -9,9 +9,9 @@ dashedName: return-a-value-from-a-function-with-return # --description-- -We can pass values into a function with arguments. You can use a `return` statement to send a value back out of a function. +Nós podemos passar valores para uma função com argumentos. Você pode usar uma instrução `return` para enviar um valor para fora de uma função. -**Example** +**Exemplo** ```js function plusThree(num) { @@ -20,35 +20,35 @@ function plusThree(num) { var answer = plusThree(5); ``` -`answer` has the value `8`. +`answer` tem o valor de `8`. -`plusThree` takes an argument for `num` and returns a value equal to `num + 3`. +`plusThree` recebe um argumento para `num` e retorna um valor igual a `num + 3`. # --instructions-- -Create a function `timesFive` that accepts one argument, multiplies it by `5`, and returns the new value. +Crie uma função `timesFive` que aceita um argumento, multiplica ele por `5` e retorna o novo valor. # --hints-- -`timesFive` should be a function +`timesFive` deve ser uma função ```js assert(typeof timesFive === 'function'); ``` -`timesFive(5)` should return `25` +`timesFive(5)` deve retornar `25` ```js assert(timesFive(5) === 25); ``` -`timesFive(2)` should return `10` +`timesFive(2)` deve retornar `10` ```js assert(timesFive(2) === 10); ``` -`timesFive(0)` should return `0` +`timesFive(0)` deve retornar `0` ```js assert(timesFive(0) === 0); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md index 6cec2141cf..025aabb0ba 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244c4 -title: Return Early Pattern for Functions +title: Retornar o Padrão Inicial para Funções challengeType: 1 videoUrl: 'https://scrimba.com/c/cQe39Sq' forumTopicId: 18272 @@ -9,9 +9,9 @@ dashedName: return-early-pattern-for-functions # --description-- -When a `return` statement is reached, the execution of the current function stops and control returns to the calling location. +Quando uma instrução `return` é alcançada, a execução da função atual para e retorna o código para o local da chamada da função. -**Example** +**Exemplo** ```js function myFun() { @@ -22,54 +22,54 @@ function myFun() { myFun(); ``` -The above will display the string `Hello` in the console, and return the string `World`. The string `byebye` will never display in the console, because the function exits at the `return` statement. +O código acima exibirá no console a string `Hello`, e retorna a string `World`. A string `byebye` nunca irá ser exibida no console, porque a função termina na instrução `return`. # --instructions-- -Modify the function `abTest` so that if `a` or `b` are less than `0` the function will immediately exit with a value of `undefined`. +Modifique a função `abTest` para que se `a` ou `b` forem menores que `0` a função irá imediatamente terminar retornando o valor de `undefined`. -**Hint** -Remember that [`undefined` is a keyword](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables), not a string. +**Dica** +Lembre-se que [`undefined` é uma palavra-chave](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables) e não uma string. # --hints-- -`abTest(2,2)` should return a number +`abTest(2,2)` deve retornar um número ```js assert(typeof abTest(2, 2) === 'number'); ``` -`abTest(2,2)` should return `8` +`abTest(2,2)` deve retornar `8` ```js assert(abTest(2, 2) === 8); ``` -`abTest(-2,2)` should return `undefined` +`abTest(-2,2)` deve retornar `undefined` ```js assert(abTest(-2, 2) === undefined); ``` -`abTest(2,-2)` should return `undefined` +`abTest(2,-2)` deve retornar `undefined` ```js assert(abTest(2, -2) === undefined); ``` -`abTest(2,8)` should return `18` +`abTest(2,8)` deve retornar `18` ```js assert(abTest(2, 8) === 18); ``` -`abTest(3,3)` should return `12` +`abTest(3,3)` deve retornar `12` ```js assert(abTest(3, 3) === 12); ``` -`abTest(0,0)` should return `0` +`abTest(0,0)` deve retornar `0` ```js assert(abTest(0, 0) === 0); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index 93e720df7c..293702088c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -1,6 +1,6 @@ --- id: 5679ceb97cbaa8c51670a16b -title: Returning Boolean Values from Functions +title: Retornando Valores Booleanos das Funções challengeType: 1 videoUrl: 'https://scrimba.com/c/cp62qAQ' forumTopicId: 18273 @@ -9,9 +9,9 @@ dashedName: returning-boolean-values-from-functions # --description-- -You may recall from [Comparison with the Equality Operator](/learn/javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator) that all comparison operators return a boolean `true` or `false` value. +Você pode se lembrar de [Comparação com o Operador de Igualdade](/learn/javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator) que todas os operadores de comparação retornam um valor booleano `true` ou `false`. -Sometimes people use an `if/else` statement to do a comparison, like this: +As vezes as pessoas usam uma instrução `if/else` para fazer uma comparação, dessa forma: ```js function isEqual(a,b) { @@ -23,7 +23,7 @@ function isEqual(a,b) { } ``` -But there's a better way to do this. Since `===` returns `true` or `false`, we can return the result of the comparison: +Mas há uma forma melhor de fazer isso. Já que `===` retorna `true` ou `false`, podemos retornar o resultado da comparação: ```js function isEqual(a,b) { @@ -33,23 +33,23 @@ function isEqual(a,b) { # --instructions-- -Fix the function `isLess` to remove the `if/else` statements. +Corrija a função `isLess` para remover as instruções `if/else`. # --hints-- -`isLess(10,15)` should return `true` +`isLess(10,15)` deve retornar `true` ```js assert(isLess(10, 15) === true); ``` -`isLess(15,10)` should return `false` +`isLess(15,10)` deve retornar `false` ```js assert(isLess(15, 10) === false); ``` -You should not use any `if` or `else` statements +Você não deve usar nenhuma das instruções `if` ou `else` ```js assert(!/if|else/g.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md index 81ea5ba048..e210b72bb5 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244dd -title: Selecting from Many Options with Switch Statements +title: Selecionando de Muitas Opções com Instruções Switch challengeType: 1 videoUrl: 'https://scrimba.com/c/c4mv4fm' forumTopicId: 18277 @@ -9,9 +9,9 @@ dashedName: selecting-from-many-options-with-switch-statements # --description-- -If you have many options to choose from, use a switch statement. A `switch` statement tests a value and can have many case statements which define various possible values. Statements are executed from the first matched `case` value until a `break` is encountered. +Se você possui muitas opções pra escolher, use uma instrução switch. Uma instrução `switch` testa um valor e pode ter muitas instruções case as quais definem os diversos valores possíveis. Instruções são executadas desde o primeiro `case` correspondente até que encontre um `break`. -Here is an example of a `switch` statement: +Aqui está um exemplo de uma instrução `switch`: ```js switch(lowercaseLetter) { @@ -24,11 +24,11 @@ switch(lowercaseLetter) { } ``` -`case` values are tested with strict equality (`===`). The `break` tells JavaScript to stop executing statements. If the `break` is omitted, the next statement will be executed. +Valores `case` são testados com o operador de igualdade estrita (`===`). O `break` diz ao JavaScript parar a execução das instruções. Se o `break` for omitido, a próxima instrução case será executada. # --instructions-- -Write a switch statement which tests `val` and sets `answer` for the following conditions: +Escreva uma instrução switch que testa `val` e define `answer` para as seguintes condições: `1` - `alpha` `2` - `beta` `3` - `gamma` @@ -36,37 +36,37 @@ Write a switch statement which tests `val` and sets `answer` for the following c # --hints-- -`caseInSwitch(1)` should have a value of the string `alpha` +`caseInSwitch(1)` deve ter o valor da string `alpha` ```js assert(caseInSwitch(1) === 'alpha'); ``` -`caseInSwitch(2)` should have a value of the string `beta` +`caseInSwitch(2)` deve ter o valor da string `beta` ```js assert(caseInSwitch(2) === 'beta'); ``` -`caseInSwitch(3)` should have a value of the string `gamma` +`caseInSwitch(3)` deve ter o valor da string `gamma` ```js assert(caseInSwitch(3) === 'gamma'); ``` -`caseInSwitch(4)` should have a value of the string `delta` +`caseInSwitch(4)` deve ter o valor da string `delta` ```js assert(caseInSwitch(4) === 'delta'); ``` -You should not use any `if` or `else` statements +Você não deve usar nenhuma instrução `if` ou `else` ```js assert(!/else/g.test(code) || !/if/g.test(code)); ``` -You should have at least 3 `break` statements +Você deve ter pelo menos 3 instruções `break` ```js assert(code.match(/break/g).length > 2); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md index 3652235f7a..2457a55522 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244bc -title: Shopping List +title: Lista de Compras challengeType: 1 videoUrl: 'https://scrimba.com/c/c9MEKHZ' forumTopicId: 18280 @@ -9,37 +9,37 @@ dashedName: shopping-list # --description-- -Create a shopping list in the variable `myList`. The list should be a multi-dimensional array containing several sub-arrays. +Crie uma lista de compras na variável `myList`. A lista deve ser um array multidimensional contendo diversos sub arrays. -The first element in each sub-array should contain a string with the name of the item. The second element should be a number representing the quantity i.e. +O primeiro elemento em cada sub array deve conter uma string com o nome do item. O segundo elemento deve ser um número representando a quantidade i.e. ```js ["Chocolate Bar", 15] ``` -There should be at least 5 sub-arrays in the list. +Deve ter pelo menos 5 sub arrays na lista. # --hints-- -`myList` should be an array. +`myList` deve ser um array. ```js assert(isArray); ``` -The first elements in each of your sub-arrays should all be strings. +Os primeiros elementos em cada um dos seus sub arrays devem ser todos strings. ```js assert(hasString); ``` -The second elements in each of your sub-arrays should all be numbers. +Os segundos elementos em cada um de seus sub arrays devem ser todos números. ```js assert(hasNumber); ``` -You should have at least 5 items in your list. +Você deve ter pelo menos 5 items na sua lista. ```js assert(count > 4); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md index 1d882d80d6..200ea4bf4f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244c6 -title: Stand in Line +title: Fique na Linha challengeType: 1 videoUrl: 'https://scrimba.com/c/ca8Q8tP' forumTopicId: 18307 @@ -9,41 +9,41 @@ dashedName: stand-in-line # --description-- -In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue. +Na Ciência da Computação uma fila é uma estrutura de dados abstrata onde itens são mantidos em ordem. Novos itens podem ser adicionados no final da fila e itens mais antigos são removidos do início da fila. -Write a function `nextInLine` which takes an array (`arr`) and a number (`item`) as arguments. +Escreva a função `nextInLine` a qual recebe um array (`arr`) e um número (`item`) como argumentos. -Add the number to the end of the array, then remove the first element of the array. +Adicione o número no final do array e então remova o primeiro elemento do array. -The `nextInLine` function should then return the element that was removed. +A função `nextInLine` deve, em seguida, retornar o elemento que foi removido. # --hints-- -`nextInLine([], 5)` should return a number. +`nextInLine([], 5)` deve retornar um número. ```js assert.isNumber(nextInLine([], 5)); ``` -`nextInLine([], 1)` should return `1` +`nextInLine([], 1)` deve retonar `1` ```js assert(nextInLine([], 1) === 1); ``` -`nextInLine([2], 1)` should return `2` +`nextInLine([2], 1)` deve retornar `2` ```js assert(nextInLine([2], 1) === 2); ``` -`nextInLine([5,6,7,8,9], 1)` should return `5` +`nextInLine([5,6,7,8,9], 1)` deve retornar `5` ```js assert(nextInLine([5, 6, 7, 8, 9], 1) === 5); ``` -After `nextInLine(testArr, 10)`, `testArr[4]` should be `10` +Após `nextInLine(testArr, 10)`, `testArr[4]` deve ser `10` ```js nextInLine(testArr, 10); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md index cb67e6fa45..9d7cf11c90 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md @@ -1,6 +1,6 @@ --- id: bd7993c9c69feddfaeb8bdef -title: Store Multiple Values in one Variable using JavaScript Arrays +title: Armazene Múltiplos Valores em uma Variável usando Arrays JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/crZQWAm' forumTopicId: 18309 @@ -9,9 +9,9 @@ dashedName: store-multiple-values-in-one-variable-using-javascript-arrays # --description-- -With JavaScript `array` variables, we can store several pieces of data in one place. +Com as variáveis de `array` em JavaScript, podemos armazenar diversos pedaços de dados em um único lugar. -You start an array declaration with an opening square bracket, end it with a closing square bracket, and put a comma between each entry, like this: +Você começa uma declaração de um array com a abertura de um colchetes, terminando com o fechamento do colchetes e colocando vírgula entre cada entrada, dessa forma: ```js var sandwich = ["peanut butter", "jelly", "bread"] @@ -19,23 +19,23 @@ var sandwich = ["peanut butter", "jelly", "bread"] # --instructions-- -Modify the new array `myArray` so that it contains both a string and a number (in that order). +Modifique o novo array `myArray` para que contenha ambos uma string e um número (nessa ordem). # --hints-- -`myArray` should be an array. +`myArray` deve ser um array. ```js assert(typeof myArray == 'object'); ``` -The first item in `myArray` should be a string. +O primeiro item de `myArray` deve ser uma string. ```js assert(typeof myArray[0] !== 'undefined' && typeof myArray[0] == 'string'); ``` -The second item in `myArray` should be a number. +O segundo item de `myArray` deve ser um número. ```js assert(typeof myArray[1] !== 'undefined' && typeof myArray[1] == 'number'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md index 8c946f1c2d..34e3742a1b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244a8 -title: Storing Values with the Assignment Operator +title: Armazenando Valores com o Operador de Atribuição challengeType: 1 videoUrl: 'https://scrimba.com/c/cEanysE' forumTopicId: 18310 @@ -9,36 +9,36 @@ dashedName: storing-values-with-the-assignment-operator # --description-- -In JavaScript, you can store a value in a variable with the assignment operator (`=`). +Em JavaScript, você pode armazenar um valor em uma variável com o operador de atribuição (`=`). ```js myVariable = 5; ``` -This assigns the `Number` value `5` to `myVariable`. +Isso atribui o valor de `Number` `5` para `myVariable`. -If there are any calculations to the right of the `=` operator, those are performed before the value is assigned to the variable on the left of the operator. +Se há qualquer cálculo a direita do operador `=`, esses cálculos são executados antes do valor ser atribuído à variável na esquerda do operador. ```js var myVar; myVar = 5; ``` -First, this code creates a variable named `myVar`. Then, the code assigns `5` to `myVar`. Now, if `myVar` appears again in the code, the program will treat it as if it is `5`. +Primeiro, esse código cria uma variável chamada `myVar`. Em seguida, o código atribui `5` para `myVar`. Agora, se `myVar` aparece novamente no código, o programa irá tratar como se fosse `5`. # --instructions-- -Assign the value `7` to variable `a`. +Atribua o valor `7` para a variável `a`. # --hints-- -You should not change code above the specified comment. +Você não deve alterar o código acima do comentário especificado. ```js assert(/var a;/.test(code)); ``` -`a` should have a value of 7. +`a` deve ter o valor de 7. ```js assert(typeof a === 'number' && a === 7); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md index 295cab9988..c25b62ca3b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md @@ -1,6 +1,6 @@ --- id: cf1111c1c11feddfaeb4bdef -title: Subtract One Number from Another with JavaScript +title: Subtraia Um Número de Outro com JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/cP3yQtk' forumTopicId: 18314 @@ -9,30 +9,30 @@ dashedName: subtract-one-number-from-another-with-javascript # --description-- -We can also subtract one number from another. +Nós também podemos subtrair um número de outro. -JavaScript uses the `-` symbol for subtraction. +JavaScript usa o símbolo `-` para subtração. -**Example** +**Exemplo** ```js myVar = 12 - 6; ``` -`myVar` would have the value `6`. +`myVar` teria o valor `6`. # --instructions-- -Change the `0` so the difference is `12`. +Altere o `0` para que a variável difference seja igual a `12`. # --hints-- -The variable `difference` should be equal to 12. +A variável `difference` deve ser igual a 12. ```js assert(difference === 12); ``` -You should only subtract one number from 45. +Você só deve subtrair um número de 45. ```js assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code))); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md index 8266e86836..7586ba3f4e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md @@ -1,6 +1,6 @@ --- id: 567af2437cbaa8c51670a16c -title: Testing Objects for Properties +title: Testando Objetos por Propriedades challengeType: 1 videoUrl: 'https://scrimba.com/c/c6Wz4ySr' forumTopicId: 18324 @@ -9,9 +9,9 @@ dashedName: testing-objects-for-properties # --description-- -Sometimes it is useful to check if the property of a given object exists or not. We can use the `.hasOwnProperty(propname)` method of objects to determine if that object has the given property name. `.hasOwnProperty()` returns `true` or `false` if the property is found or not. +Às vezes é útil verificar se a propriedade de um determinado objeto existe ou não. Podemos usar o método de objetos `.hasOwnProperty(propname)` para determinar se aquele objeto possui o nome de propriedade fornecido. `.hasOwnProperty()` retorna `true` ou `false` se a propriedade for encontrada ou não. -**Example** +**Exemplo** ```js var myObj = { @@ -22,15 +22,15 @@ myObj.hasOwnProperty("top"); myObj.hasOwnProperty("middle"); ``` -The first `hasOwnProperty` returns `true`, while the second returns `false`. +O primeiro `hasOwnProperty` retorna `true`, enquanto o segundo retorna `false`. # --instructions-- -Modify the function `checkObj` to test if an object passed to the function (`obj`) contains a specific property (`checkProp`). If the property is found, return that property's value. If not, return `"Not Found"`. +Modifique a função `checkObj` para verificar se um objeto passado para a função (`obj`) contém uma propriedade específica (`checkProp`). Se a propriedade for encontrada, retorne o valor da propriedade. Se não, retorne `"Not Found"`. # --hints-- -`checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift")` should return the string `pony`. +`checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift")` deve retornar a string `pony`. ```js assert( @@ -38,7 +38,7 @@ assert( ); ``` -`checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet")` should return the string `kitten`. +`checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet")` deve retornar a string `kitten`. ```js assert( @@ -46,7 +46,7 @@ assert( ); ``` -`checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "house")` should return the string `Not Found`. +`checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "house")` deve retornar a string `Not Found`. ```js assert( @@ -55,19 +55,19 @@ assert( ); ``` -`checkObj({city: "Seattle"}, "city")` should return the string `Seattle`. +`checkObj({city: "Seattle"}, "city")` deve retornar a string `Seattle`. ```js assert(checkObj({ city: 'Seattle' }, 'city') === 'Seattle'); ``` -`checkObj({city: "Seattle"}, "district")` should return the string `Not Found`. +`checkObj({city: "Seattle"}, "district")` deve retornar a string `Not Found`. ```js assert(checkObj({ city: 'Seattle' }, 'district') === 'Not Found'); ``` -`checkObj({pet: "kitten", bed: "sleigh"}, "gift")` should return the string `Not Found`. +`checkObj({pet: "kitten", bed: "sleigh"}, "gift")` deve retornar a string `Not Found`. ```js assert(checkObj({ pet: 'kitten', bed: 'sleigh' }, 'gift') === 'Not Found'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index 89597062f4..0e6c0ea640 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244ba -title: Understand String Immutability +title: Entendendo a Imutabilidade das Strings challengeType: 1 videoUrl: 'https://scrimba.com/c/cWPVaUR' forumTopicId: 18331 @@ -9,16 +9,16 @@ dashedName: understand-string-immutability # --description-- -In JavaScript, `String` values are immutable, which means that they cannot be altered once created. +Em JavaScript, valores `String` são imutáveis, o que significa que elas não podem ser alteradas após serem criadas. -For example, the following code: +Por exemplo, o código a seguir: ```js var myStr = "Bob"; myStr[0] = "J"; ``` -cannot change the value of `myStr` to `Job`, because the contents of `myStr` cannot be altered. Note that this does *not* mean that `myStr` cannot be changed, just that the individual characters of a string literal cannot be changed. The only way to change `myStr` would be to assign it with a new string, like this: +não é possível alterar o valor de `myStr` para `Job`, porque o conteúdo de `myStr` não pode ser alterado. Note que isso *não* significa que `myStr` não pode ser alterado, apenas que os caracteres individuais de uma string literal não pode ser alterado. A única forma de alterar `myStr` seria atribuindo-a com uma nova string, dessa forma: ```js var myStr = "Bob"; @@ -27,17 +27,17 @@ myStr = "Job"; # --instructions-- -Correct the assignment to `myStr` so it contains the string value of `Hello World` using the approach shown in the example above. +Corrija a atribuição para `myStr` para que contenha o valor `Hello World` (string) usando a abordagem mostrada no exemplo acima. # --hints-- -`myStr` should have a value of the string `Hello World`. +`myStr` deve ter o valor da string `HelloWorld`. ```js assert(myStr === 'Hello World'); ``` -You should not change the code above the specified comment. +Você não deve alterar o código acima do comentário especificado. ```js assert(/myStr = "Jello World"/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md index 5086886e64..2a31d61fc4 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md @@ -1,6 +1,6 @@ --- id: bd7123c9c441eddfaeb5bdef -title: Understanding Boolean Values +title: Entendendo Valores Booleanos challengeType: 1 videoUrl: 'https://scrimba.com/c/c9Me8t4' forumTopicId: 301176 @@ -9,23 +9,23 @@ dashedName: understanding-boolean-values # --description-- -Another data type is the Boolean. Booleans may only be one of two values: `true` or `false`. They are basically little on-off switches, where `true` is on and `false` is off. These two states are mutually exclusive. +Outro tipo de dado é o Boolean. Booleanos podem ser apenas dois valores: `true` ou `false`. Eles basicamente são interruptores pequenos, onde `true` é ligado e `false` é desligado. Esses dois estados são mutuamente exclusivos. -**Note:** Boolean values are never written with quotes. The strings `"true"` and `"false"` are not Boolean and have no special meaning in JavaScript. +**Nota:** Valores booleanos nunca são escritos com aspas. As strings `"true"` e `"false"` não são Booleanos e não tem nenhum significado especial em JavaScript. # --instructions-- -Modify the `welcomeToBooleans` function so that it returns `true` instead of `false` when the run button is clicked. +Modifique a função `welcomeToBooleans` para que retorne `true` ao invés de `false` quando o botão de correr for clicado. # --hints-- -The `welcomeToBooleans()` function should return a Boolean (`true` or `false`) value. +A função `welcomeToBooleans()` deve retornar um valor Booleano (`true` ou `false`). ```js assert(typeof welcomeToBooleans() === 'boolean'); ``` -`welcomeToBooleans()` should return `true`. +`welcomeToBooleans()` deve retornar `true`. ```js assert(welcomeToBooleans() === true); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md index 93c8577ac6..ff184caf95 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244ab -title: Understanding Case Sensitivity in Variables +title: Entendendo a Sensibilidade a Caracteres Maiúsculos e Minúsculos em Variáveis challengeType: 1 videoUrl: 'https://scrimba.com/c/cd6GDcD' forumTopicId: 18334 @@ -9,15 +9,15 @@ dashedName: understanding-case-sensitivity-in-variables # --description-- -In JavaScript all variables and function names are case sensitive. This means that capitalization matters. +Em JavaScript todas os nomes de variáveis e funções são sensíveis a caracteres maiúsculos e minúsculos. Isso significa que a capitalização importa. -`MYVAR` is not the same as `MyVar` nor `myvar`. It is possible to have multiple distinct variables with the same name but different casing. It is strongly recommended that for the sake of clarity, you *do not* use this language feature. +`MYVAR` não é o mesmo que `MyVar` nem `myvar`. É possível ter diversas variáveis distintas com o mesmo nome mas com capitalização diferente. É extremamente recomendado pelo bem da clareza, que você *não* use esse recurso da linguagem. -**Best Practice** +**Melhores Práticas** -Write variable names in JavaScript in camelCase. In camelCase, multi-word variable names have the first word in lowercase and the first letter of each subsequent word is capitalized. +Escreva nomes de variáveis em JavaScript em camelCase. Em camelCase, nomes de variáveis com mais de uma palavra possuem a primeira palavra toda em minúscula e a primeira letra de cada palavra subsequente capitalizada. -**Examples:** +**Exemplos:** ```js var someVariable; @@ -27,19 +27,19 @@ var thisVariableNameIsSoLong; # --instructions-- -Modify the existing declarations and assignments so their names use camelCase. +Modifique as declarações e atribuições existentes para que seus nomes usem camelCase. -Do not create any new variables. +Não crie nenhuma variável nova. # --hints-- -`studlyCapVar` should be defined and have a value of `10`. +`studlyCapVar` deve ser definido e ter um valor de `10`. ```js assert(typeof studlyCapVar !== 'undefined' && studlyCapVar === 10); ``` -`properCamelCase` should be defined and have a value of the string `A String`. +`properCamelCase` deve ser definida e ter o valor da string `A String`. ```js assert( @@ -47,25 +47,25 @@ assert( ); ``` -`titleCaseOver` should be defined and have a value of `9000`. +`titleCaseOver` deve ser definida e ter o valor de `9000`. ```js assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000); ``` -`studlyCapVar` should use camelCase in both declaration and assignment sections. +`studlyCapVar` deve usar camelCase em ambas as seções de declaração e atribuição. ```js assert(code.match(/studlyCapVar/g).length === 2); ``` -`properCamelCase` should use camelCase in both declaration and assignment sections. +`properCamelCase` deve usar camelCase em ambas as seções de declaração e atribuição. ```js assert(code.match(/properCamelCase/g).length === 2); ``` -`titleCaseOver` should use camelCase in both declaration and assignment sections. +`titleCaseOver` deve usar camelCase em ambas as seções de declaração e atribuição. ```js assert(code.match(/titleCaseOver/g).length === 2); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md index bf8bd5a27a..29733771a7 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md @@ -1,6 +1,6 @@ --- id: 598e8944f009e646fc236146 -title: Understanding Undefined Value returned from a Function +title: Entendendo Valor Undefined retornado de uma Função challengeType: 1 videoUrl: 'https://scrimba.com/c/ce2p7cL' forumTopicId: 301177 @@ -9,9 +9,9 @@ dashedName: understanding-undefined-value-returned-from-a-function # --description-- -A function can include the `return` statement but it does not have to. In the case that the function doesn't have a `return` statement, when you call it, the function processes the inner code but the returned value is `undefined`. +Uma função pode incluir a instrução `return` mas ela não precisa fazer isso. No caso de a função não ter uma instrução `return`, quando você chamá-la, a função processa o código interno, mas o valor retornado é `undefined`. -**Example** +**Exemplo** ```js var sum = 0; @@ -21,39 +21,38 @@ function addSum(num) { addSum(3); ``` -`addSum` is a function without a `return` statement. The function will change the global `sum` variable but the returned value of the function is `undefined`. +`addSum` é uma função sem uma instrução `return`. A função irá alterar a variável global `sum`, mas o valor retornado da função é `undefined`. # --instructions-- -Create a function `addFive` without any arguments. This function adds 5 to the `sum` variable, but its returned value is `undefined`. +Crie uma função `addFive` sem qualquer argumento. Essa função adiciona 5 à variávelsum`, mas o valor retornado é undefined`. # --hints-- -`addFive` should be a function. +`addFive` deve ser uma função. ```js assert(typeof addFive === 'function'); ``` -Once both functions have run, the `sum` should be equal to `8`. +Uma vez que ambas as funções são executadas, a `soma` deve ser igual a `8`. ```js assert(sum === 8); ``` -Returned value from `addFive` should be `undefined`. +Valor retornado de `addFive` deve ser `undefined`. ```js assert(addFive() === undefined); ``` -Inside the `addFive` function, you should add `5` to the `sum` variable. +Dentro da função `addFive`, você deve adicionar `5` à variável `sum.

          -```js -assert( +
          assert(
             __helpers.removeWhiteSpace(addFive.toString()).match(/sum=sum\+5|sum\+=5/)
           );
          -```
          +`
          # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index b51f61753d..a75bc37078 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244aa -title: Understanding Uninitialized Variables +title: Entendendo Variáveis Não Inicializadas challengeType: 1 videoUrl: 'https://scrimba.com/c/cBa2JAL' forumTopicId: 18335 @@ -9,33 +9,33 @@ dashedName: understanding-uninitialized-variables # --description-- -When JavaScript variables are declared, they have an initial value of `undefined`. If you do a mathematical operation on an `undefined` variable your result will be `NaN` which means "Not a Number". If you concatenate a string with an `undefined` variable, you will get a literal string of `undefined`. +Quando as variáveis de JavaScript são declaradas, elas têm um valor inicial de `undefined`. Se você fizer uma operação matemática em uma variável `undefined`, seu resultado será `NaN`, o que significa que "Não é um número". Se você concatenar uma string com uma variável `undefined`, você receberá uma string literal de `undefined`. # --instructions-- -Initialize the three variables `a`, `b`, and `c` with `5`, `10`, and `"I am a"` respectively so that they will not be `undefined`. +Inicialize as três variáveis `a`, `b` e `c` com `5`, `10`, e `"Sou a"` respectivamente para que eles não sejam `undefined`. # --hints-- -`a` should be defined and evaluated to have the value of `6`. +`a` deve ser definido e avaliado para ter o valor de `6`. ```js assert(typeof a === 'number' && a === 6); ``` -`b` should be defined and evaluated to have the value of `15`. +`b` deve ser definido e avaliado para ter o valor de `15`. ```js assert(typeof b === 'number' && b === 15); ``` -`c` should not contain `undefined` and should have a value of the string `I am a String!` +`c` não deve conter `undefined` e deve ter o valor da string `eu sou uma String!` ```js assert(!/undefined/.test(c) && c === 'I am a String!'); ``` -You should not change code below the specified comment. +Você não deve mudar o código abaixo do comentário especificado. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md index 3ea895350d..3d192bd4ca 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md @@ -1,6 +1,6 @@ --- id: 56bbb991ad1ed5201cd392d1 -title: Updating Object Properties +title: Atualizando Propriedades do Objeto challengeType: 1 videoUrl: 'https://scrimba.com/c/c9yEJT4' forumTopicId: 18336 @@ -9,9 +9,9 @@ dashedName: updating-object-properties # --description-- -After you've created a JavaScript object, you can update its properties at any time just like you would update any other variable. You can use either dot or bracket notation to update. +Depois de criar um objeto JavaScript, você pode atualizar suas propriedades a qualquer momento, como você atualizaria qualquer outra variável. Você pode usar notação do ponto ou colchete para atualizar. -For example, let's look at `ourDog`: +Por exemplo, vamos dar uma olhada em `ourDog`: ```js var ourDog = { @@ -22,21 +22,21 @@ var ourDog = { }; ``` -Since he's a particularly happy dog, let's change his name to the string `Happy Camper`. Here's how we update his object's name property: `ourDog.name = "Happy Camper";` or `ourDog["name"] = "Happy Camper";` Now when we evaluate `ourDog.name`, instead of getting `Camper`, we'll get his new name, `Happy Camper`. +Como ele é um cachorro particularmente feliz, vamos mudar seu nome para o texto `Happy Camper`. Veja como atualizamos a propriedade name do objeto: `ourDog.name = "Happy Camper";` ou `ourDog["name"] = "Happy Camper";` Agora, quando avaliamos `ourDog.name`, em vez de obter `Camper`, teremos seu novo nome, `Happy Camper`. # --instructions-- -Update the `myDog` object's name property. Let's change her name from `Coder` to `Happy Coder`. You can use either dot or bracket notation. +Atualize a propriedade name do objeto `myDog`. Vamos alterar o valor da propriedade name dela de `Coder` para `Happy Coder`. Você pode usar notação de ponto ou de colchetes. # --hints-- -You should update `myDog`'s `name` property to equal the string `Happy Coder`. +Você deve atualizar a propriedade `name` de `myDog` para ser igual a `Happy Coder`. ```js assert(/happy coder/gi.test(myDog.name)); ``` -You should not edit the `myDog` definition. +Você não deve editar a definição de `myDog`. ```js assert(/"name": "Coder"/.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md index 840f6fc61f..c69bcb8ac2 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md @@ -1,6 +1,6 @@ --- id: bd7123c9c549eddfaeb5bdef -title: Use Bracket Notation to Find the First Character in a String +title: Use Notação de Colchetes para Encontrar o Primeiro Caractere em uma String challengeType: 1 videoUrl: 'https://scrimba.com/c/ca8JwhW' forumTopicId: 18341 @@ -9,36 +9,36 @@ dashedName: use-bracket-notation-to-find-the-first-character-in-a-string # --description-- -Bracket notation is a way to get a character at a specific index within a string. +Notação de Colchetes é uma forma de pegar um caractere no índice especificado dentro de uma string. -Most modern programming languages, like JavaScript, don't start counting at 1 like humans do. They start at 0. This is referred to as Zero-based indexing. +A maioria das linguagens de programações modernas, como JavaScript, não começa contando do 1 como humanos fazem. Eles começam no 0. Isso é referido como indexação baseada em zero. -For example, the character at index 0 in the word `Charles` is `C`. So if `var firstName = "Charles"`, you can get the value of the first letter of the string by using `firstName[0]`. +Por exemplo, o caractere no índice 0 da palavra `Charles` é `C`. Então se `var firstName = "Charles"`, você pode pegar o valor da primeira letra da string usando `firstName[0]`. -Example: +Exemplo: ```js var firstName = "Charles"; var firstLetter = firstName[0]; ``` -`firstLetter` would have a value of the string `C`. +`firstLetter` teria o valor da string `C`. # --instructions-- -Use bracket notation to find the first character in the `lastName` variable and assign it to `firstLetterOfLastName`. +Use notação de colchetes para encontrar o primeiro caractere na variável `lastName` e atribua a letra para a variável `firstLetterOfLastName`. -**Hint:** Try looking at the example above if you get stuck. +**Dica:** Tente olhar o exemplo acima se você ficar travado. # --hints-- -The `firstLetterOfLastName` variable should have the value of `L`. +A variável `firstLetterOfLastName` deve ter o valor de `L`. ```js assert(firstLetterOfLastName === 'L'); ``` -You should use bracket notation. +Você deve usar a notação de colchetes. ```js assert(code.match(/firstLetterOfLastName\s*?=\s*?lastName\[.*?\]/)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md index 92b8f64187..e99a4a234d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md @@ -1,6 +1,6 @@ --- id: bd7123c9c451eddfaeb5bdef -title: Use Bracket Notation to Find the Last Character in a String +title: Use Notação de Colchetes para Encontrar o Último Caractere em uma String challengeType: 1 videoUrl: 'https://scrimba.com/c/cBZQGcv' forumTopicId: 18342 @@ -9,34 +9,34 @@ dashedName: use-bracket-notation-to-find-the-last-character-in-a-string # --description-- -In order to get the last letter of a string, you can subtract one from the string's length. +Em ordem para pegar a última letra de uma string, você pode subtrair um do tamanho da string. -For example, if `var firstName = "Ada"`, you can get the value of the last letter of the string by using `firstName[firstName.length - 1]`. +Por exemplo, se `var firstName = "Ada"`, você pode pegar o valor da última letra da string ao usar `firstName[firstName.length - 1]`. -Example: +Exemplo: ```js var firstName = "Ada"; var lastLetter = firstName[firstName.length - 1]; ``` -`lastLetter` would have a value of the string `a`. +`lastLetter` teria o valor da string `a`. # --instructions-- -Use bracket notation to find the last character in the `lastName` variable. +Use notação de colchetes para descobrir o último caracter na variável `lastName`. -**Hint:** Try looking at the example above if you get stuck. +**Dica:** Tente olhar o exemplo acima se você ficar travado. # --hints-- -`lastLetterOfLastName` should be the letter `e`. +`lastLetterOfLastName` deve ser a letra `e`. ```js assert(lastLetterOfLastName === 'e'); ``` -You should use `.length` to get the last letter. +Você deve usar `.length` para pegar a última letra. ```js assert(code.match(/\.length/g).length > 0); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md index a7823188ae..5d4aaf06c3 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md @@ -1,6 +1,6 @@ --- id: bd7123c9c450eddfaeb5bdef -title: Use Bracket Notation to Find the Nth Character in a String +title: Use Notação de Colchetes para Encontrar o Nº Caractere em uma String challengeType: 1 videoUrl: 'https://scrimba.com/c/cWPVJua' forumTopicId: 18343 @@ -9,34 +9,34 @@ dashedName: use-bracket-notation-to-find-the-nth-character-in-a-string # --description-- -You can also use bracket notation to get the character at other positions within a string. +Você também pode usar notação de colchetes para pegar caracteres em outras posições em uma string. -Remember that computers start counting at `0`, so the first character is actually the zeroth character. +Lembre-se que computadores começam contando do `0`, então o primeiro caractere é na verdade o caractere na posição 0. -Example: +Exemplo: ```js var firstName = "Ada"; var secondLetterOfFirstName = firstName[1]; ``` -`secondLetterOfFirstName` would have a value of the string `d`. +`secondLetterOfFirstName` teria o valor da string `d`. # --instructions-- -Let's try to set `thirdLetterOfLastName` to equal the third letter of the `lastName` variable using bracket notation. +Vamos tentar definir `thirdLetterOfLastName` para ser igual a terceira letra da variável `lastName` usando notação de colchetes. -**Hint:** Try looking at the example above if you get stuck. +**Dica:** Tente olhar o exemplo acima se você ficar travado. # --hints-- -The `thirdLetterOfLastName` variable should have the value of `v`. +A variável `thirdLetterOfLastName` deve ter o valor de `v`. ```js assert(thirdLetterOfLastName === 'v'); ``` -You should use bracket notation. +Você deve usar notação de colchetes. ```js assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md index 912b0b3b6b..24dd900ed4 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md @@ -1,6 +1,6 @@ --- id: bd7123c9c452eddfaeb5bdef -title: Use Bracket Notation to Find the Nth-to-Last Character in a String +title: Use Notação de Colchetes para Descobrir o Nº Antes do Ultimo em uma String challengeType: 1 videoUrl: 'https://scrimba.com/c/cw4vkh9' forumTopicId: 18344 @@ -9,34 +9,34 @@ dashedName: use-bracket-notation-to-find-the-nth-to-last-character-in-a-string # --description-- -You can use the same principle we just used to retrieve the last character in a string to retrieve the Nth-to-last character. +Você pode usar o mesmo princípio que nós acabamos de usar para recuperar o último caractere em uma string, para recuperar o Nº antes do último caractere. -For example, you can get the value of the third-to-last letter of the `var firstName = "Augusta"` string by using `firstName[firstName.length - 3]` +Por exemplo, você pode pegar o valor da antepenúltima letra da string `var fistName = "Augusta` usando `firstName[firstName.length -3]` -Example: +Exemplo: ```js var firstName = "Augusta"; var thirdToLastLetter = firstName[firstName.length - 3]; ``` -`thirdToLastLetter` would have a value of the string `s`. +`thirdToLastLetter` teria o valor da string `s`. # --instructions-- -Use bracket notation to find the second-to-last character in the `lastName` string. +Use notação de colchetes para descobrir o penúltimo caractere na string `lastName`. -**Hint:** Try looking at the example above if you get stuck. +**Dica:** Tente olhar o exemplo acima se você ficar travado. # --hints-- -`secondToLastLetterOfLastName` should be the letter `c`. +`secondToLastLetterOfLastName` deve ser a letra `c`. ```js assert(secondToLastLetterOfLastName === 'c'); ``` -You should use `.length` to get the second last letter. +Você deve usar `.length` para pegar a penúltima letra. ```js assert(code.match(/\.length/g).length > 0); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.md index 53ecda52a4..8767fa44b9 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.md @@ -1,6 +1,6 @@ --- id: cf1111c1c12feddfaeb3bdef -title: Use Conditional Logic with If Statements +title: Use Lógica Condicional com Instruções If challengeType: 1 videoUrl: 'https://scrimba.com/c/cy87mf3' forumTopicId: 18348 @@ -9,15 +9,15 @@ dashedName: use-conditional-logic-with-if-statements # --description-- -`If` statements are used to make decisions in code. The keyword `if` tells JavaScript to execute the code in the curly braces under certain conditions, defined in the parentheses. These conditions are known as `Boolean` conditions and they may only be `true` or `false`. +Instruções `If` são usadas para tomar decisões no código. A palavra-chave `if` diz ao JavaScript para executar o código nas chaves sob certas condições, definidas nos parênteses. Essas condições são conhecidas como condições `Boolean` e elas só podem ser `true` ou `false`. -When the condition evaluates to `true`, the program executes the statement inside the curly braces. When the Boolean condition evaluates to `false`, the statement inside the curly braces will not execute. +Quando a condição for `true`, o programa executara as instruções dentro das chaves. Quando a condição booleana for `false`, as instruções dentro das chaves não serão executadas. -**Pseudocode** +**Pseudocódigo** -
          if (condition is true) {
            statement is executed
          }
          +
          if (condição é verdadeira) {
          instrução é executada
          }
          -**Example** +**Exemplo** ```js function test (myCondition) { @@ -30,41 +30,41 @@ test(true); test(false); ``` -`test(true)` returns the string `It was true`, and `test(false)` returns the string `It was false`. +`test(true)` retorna a string `It was true` e `test(false)` retorna a string `It was false`. -When `test` is called with a value of `true`, the `if` statement evaluates `myCondition` to see if it is `true` or not. Since it is `true`, the function returns `It was true`. When we call `test` with a value of `false`, `myCondition` is *not* `true` and the statement in the curly braces is not executed and the function returns `It was false`. +Quando `test` é chamado com o valor `true`, a instrução `if` avalia `myCondition` para verificar se é `true` ou não. Já que é `true`, a função retorna `It was true`. Quando chamamos `test` com um valor de `false`, `myCondition` *não é* `true` e a instrução nas chaves não é executada e a função retorna `It was false`. # --instructions-- -Create an `if` statement inside the function to return `Yes, that was true` if the parameter `wasThatTrue` is `true` and return `No, that was false` otherwise. +Crie uma instrução `if` dentro da função para retornar `Yes, that was true` se o parâmetro `wasThatTrue` for `true` e retorne `No, that was false` caso contrário. # --hints-- -`trueOrFalse` should be a function +`trueOrFalse` deve ser uma função ```js assert(typeof trueOrFalse === 'function'); ``` -`trueOrFalse(true)` should return a string +`trueOrFalse(true)` deve retornar uma string ```js assert(typeof trueOrFalse(true) === 'string'); ``` -`trueOrFalse(false)` should return a string +`trueOrFalse(false)` deve retornar uma string ```js assert(typeof trueOrFalse(false) === 'string'); ``` -`trueOrFalse(true)` should return the string `Yes, that was true` +`trueOrFalse(true)` deve retornar a string `Yes, that was true` ```js assert(trueOrFalse(true) === 'Yes, that was true'); ``` -`trueOrFalse(false)` should return the string `No, that was false` +`trueOrFalse(false)` deve retornar a string `No, that was false` ```js assert(trueOrFalse(false) === 'No, that was false'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md index 4852147339..2cf5c4b0ca 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md @@ -1,6 +1,6 @@ --- id: 587d7b7e367417b2b2512b21 -title: Use Multiple Conditional (Ternary) Operators +title: Usar Operadores de Múltiplas Condições (Ternário) challengeType: 1 videoUrl: 'https://scrimba.com/c/cyWJBT4' forumTopicId: 301179 @@ -9,9 +9,9 @@ dashedName: use-multiple-conditional-ternary-operators # --description-- -In the previous challenge, you used a single conditional operator. You can also chain them together to check for multiple conditions. +No desafio anterior, você usou um único operador condicional. Você também pode encadear eles juntos para verificar por múltiplas condições. -The following function uses `if`, `else if`, and `else` statements to check multiple conditions: +A seguinte função usa as instruções `if`, `else if` e `else` para verificar múltiplas condições: ```js function findGreaterOrEqual(a, b) { @@ -27,7 +27,7 @@ function findGreaterOrEqual(a, b) { } ``` -The above function can be re-written using multiple conditional operators: +A função acima pode ser rescrita usando operadores de múltiplas condições (operador ternário): ```js function findGreaterOrEqual(a, b) { @@ -37,7 +37,7 @@ function findGreaterOrEqual(a, b) { } ``` -It is considered best practice to format multiple conditional operators such that each condition is on a separate line, as shown above. Using multiple conditional operators without proper indentation may make your code hard to read. For example: +É considerado a melhor prática para formatar operadores de múltiplas condições, tal que cada condição está em uma linha separada, como mostrada acima. Usando operadores de múltiplas condições sem a indentação adequada pode dificultar a leitura do seu código. Por exemplo: ```js function findGreaterOrEqual(a, b) { @@ -47,29 +47,29 @@ function findGreaterOrEqual(a, b) { # --instructions-- -In the `checkSign` function, use multiple conditional operators - following the recommended format used in `findGreaterOrEqual` - to check if a number is positive, negative or zero. The function should return `positive`, `negative` or `zero`. +Na função `checkSign`, use operadores de múltiplas condições - seguindo o formato recomendado usado em `findGreaterOrEqual` - para verificar se um número é positivo, negativo ou zero. A função deve retornar `positive`, `negative` ou `zero`. # --hints-- -`checkSign` should use multiple conditional operators +`checkSign` deve usar operadores de múltiplas condições ```js assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code)); ``` -`checkSign(10)` should return the string `positive`. Note that capitalization matters +`checkSign(10)` deve retornar a string `positive`. Observe que a capitalização importa ```js assert(checkSign(10) === 'positive'); ``` -`checkSign(-12)` should return the string `negative`. Note that capitalization matters +`checkSign(-12)` deve retornar a string `negative`. Observe que a capitalização importa ```js assert(checkSign(-12) === 'negative'); ``` -`checkSign(0)` should return the string `zero`. Note that capitalization matters +`checkSign(0)` deve retornar a string `zero`. Observe que a capitalização importa ```js assert(checkSign(0) === 'zero'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index c5e30c4680..e992662ea1 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -1,6 +1,6 @@ --- id: 5cd9a70215d3c4e65518328f -title: Use Recursion to Create a Countdown +title: Use Recursividade para Criar uma Contagem Regressiva challengeType: 1 forumTopicId: 305925 dashedName: use-recursion-to-create-a-countdown @@ -8,11 +8,11 @@ dashedName: use-recursion-to-create-a-countdown # --description-- -In a [previous challenge](/learn/javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion), you learned how to use recursion to replace a `for` loop. Now, let's look at a more complex function that returns an array of consecutive integers starting with `1` through the number passed to the function. +Em um [desafio anterior](/learn/javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion), você aprendeu como usar recursividade para substituir laços `for`. Agora, vamos analisar uma função mais complexa, a qual retorna um array de inteiros consecutivos começando com `1` até o número passado para a função. -As mentioned in the previous challenge, there will be a base case. The base case tells the recursive function when it no longer needs to call itself. It is a simple case where the return value is already known. There will also be a recursive call which executes the original function with different arguments. If the function is written correctly, eventually the base case will be reached. +Como mencionado no desafio anterior, haverá um caso base. O caso base diz a função recursiva quando ela não precisa mais chamar a si. É um simples caso onde o valor de retorno já é conhecido. Também haverá uma chamada recursiva a qual executa a função original com argumentos diferentes. Se a função for escrita corretamente, eventualmente o caso base será alcançado. -For example, say you want to write a recursive function that returns an array containing the numbers `1` through `n`. This function will need to accept an argument, `n`, representing the final number. Then it will need to call itself with progressively smaller values of `n` until it reaches `1`. You could write the function as follows: +Por exemplo, vamos dizer que você quer escrever uma função recursiva que retorna um array contendo os números de `1` até `n`. Essa função precisará aceitar um argumento, `n`, representando o número final. Então ela precisará chamar a si mesmo como valores progressivamente menores de `n` até que alcance `1`. Você poderia escrever a função da seguinte forma: ```javascript function countup(n) { @@ -27,35 +27,35 @@ function countup(n) { console.log(countup(5)); ``` -The value `[1, 2, 3, 4, 5]` will be displayed in the console. +O valor `[1, 2, 3, 4, 5]` será exibido no console. -At first, this seems counterintuitive since the value of `n` *decreases*, but the values in the final array are *increasing*. This happens because the push happens last, after the recursive call has returned. At the point where `n` is pushed into the array, `countup(n - 1)` has already been evaluated and returned `[1, 2, ..., n - 1]`. +Inicialmente, isso se parece contra-intuitivo já que o valor de `n` *diminui*, mas os valores no array final estão *em ordem crescente*. Isso acontece porque a adição no array (push) acontece por último, após a chamada recursiva ter retornado. No ponto onde `n` é adicionado ao array, `countup(n - 1)` já foi avaliado e retornou `[1, 2, ..., n -1]`. # --instructions-- -We have defined a function called `countdown` with one parameter (`n`). The function should use recursion to return an array containing the integers `n` through `1` based on the `n` parameter. If the function is called with a number less than 1, the function should return an empty array. For example, calling this function with `n = 5` should return the array `[5, 4, 3, 2, 1]`. Your function must use recursion by calling itself and must not use loops of any kind. +Definimos uma função chamada `countdown` com um parâmetro (`n`). A função deve usar recursividade para retornar um array contendo inteiros `n` até `1` baseado no parâmetro `n`. Se a função é chamada com um número menor que 1, a função deve retornar um array vazio. Por exemplo, chamando essa função com `n = 5` deve retornar o array `[5, 4, 3, 2, 1]`. Sua função precisa usar recursividade ao chamar ela mesma e não deve usar laços de qualquer tipo. # --hints-- -`countdown(-1)` should return an empty array. +`countdown(-1)` deve retornar um array vazio. ```js assert.isEmpty(countdown(-1)); ``` -`countdown(10)` should return `[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]` +`countdown(10)` deve retornar `[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]` ```js assert.deepStrictEqual(countdown(10), [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]); ``` -`countdown(5)` should return `[5, 4, 3, 2, 1]` +`countdown(5)` deve retornar `[5, 4, 3, 2, 1]` ```js assert.deepStrictEqual(countdown(5), [5, 4, 3, 2, 1]); ``` -Your code should not rely on any kind of loops (`for`, `while` or higher order functions such as `forEach`, `map`, `filter`, and `reduce`). +Seu código não deve depender de nenhum tipo de laço (`for`, `while` ou outras funções superiores como `forEach`, `map`, `filter` e `reduce`). ```js assert( @@ -63,7 +63,7 @@ assert( ); ``` -You should use recursion to solve this problem. +Você deve usar recursividade para resolver esse problema. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 3859da1fba..9f13e031c9 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -1,6 +1,6 @@ --- id: 5cc0bd7a49b71cb96132e54c -title: Use Recursion to Create a Range of Numbers +title: Use Recursividade para Criar um Intervalo de Números challengeType: 1 forumTopicId: 301180 dashedName: use-recursion-to-create-a-range-of-numbers @@ -8,21 +8,21 @@ dashedName: use-recursion-to-create-a-range-of-numbers # --description-- -Continuing from the previous challenge, we provide you another opportunity to create a recursive function to solve a problem. +Continuando do desafio anterior, nós o fornecemos outra oportunidade para criar uma função recursiva para resolver um problema. # --instructions-- -We have defined a function named `rangeOfNumbers` with two parameters. The function should return an array of integers which begins with a number represented by the `startNum` parameter and ends with a number represented by the `endNum` parameter. The starting number will always be less than or equal to the ending number. Your function must use recursion by calling itself and not use loops of any kind. It should also work for cases where both `startNum` and `endNum` are the same. +Definimos uma função chamada `rangeOfNumbers` com dois parâmetros. A função deve retornar um array de inteiros a qual começa com um número representado pelo parâmetro `startNum` e terminar com um número representado pelo parâmetro `endNum`. O número inicial sempre será menor ou igual ao número final. Sua função precisa usar recursividade ao chamar ela mesma e não depender de nenhum tipo de laço. Também deve funcionar para casos onde ambos `startNum` e `endNum` forem o mesmo. # --hints-- -Your function should return an array. +Sua função deve retornar um array. ```js assert(Array.isArray(rangeOfNumbers(5, 10))); ``` -Your code should not use any loop syntax (`for` or `while` or higher order functions such as `forEach`, `map`, `filter`, or `reduce`). +Seu código não deve depender de nenhum laço (`for` ou `while` ou funções de ordem superior como as funções `forEach`, `map`, `filter` ou `reduce`). ```js assert( @@ -30,7 +30,7 @@ assert( ); ``` -`rangeOfNumbers` should use recursion (call itself) to solve this challenge. +`rangeOfNumbers` deve usar recursão (chamar a si) para resolver este desafio. ```js assert( @@ -38,19 +38,19 @@ assert( ); ``` -`rangeOfNumbers(1, 5)` should return `[1, 2, 3, 4, 5]`. +`rangeOfNumbers(1, 5)` deve retornar `[1, 2, 3, 4, 5]`. ```js assert.deepStrictEqual(rangeOfNumbers(1, 5), [1, 2, 3, 4, 5]); ``` -`rangeOfNumbers(6, 9)` should return `[6, 7, 8, 9]`. +`rangeOfNumbers(6, 9)` deve retornar `[6, 7, 8, 9]`. ```js assert.deepStrictEqual(rangeOfNumbers(6, 9), [6, 7, 8, 9]); ``` -`rangeOfNumbers(4, 4)` should return `[4]`. +`rangeOfNumbers(4, 4)` deve retornar `[4]`. ```js assert.deepStrictEqual(rangeOfNumbers(4, 4), [4]); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index cd7ab8e504..8cde9517d9 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -1,6 +1,6 @@ --- id: 587d7b7e367417b2b2512b24 -title: Use the Conditional (Ternary) Operator +title: Use o Operador Condicional (ternário) challengeType: 1 forumTopicId: 301181 dashedName: use-the-conditional-ternary-operator @@ -8,11 +8,11 @@ dashedName: use-the-conditional-ternary-operator # --description-- -The conditional operator, also called the ternary operator, can be used as a one line if-else expression. +O operador condicional, também chamado de operador ternário, pode ser usado como uma expressão if-else de uma linha. -The syntax is `a ? b : c`, where `a` is the condition, `b` is the code to run when the condition returns `true`, and `c` is the code to run when the condition returns `false`. +A sintaxe é `a ? b : c`, onde `a` é a condição, `b` é o código executado quando a condição retorna `true` e `c` é o código executado quando a condição retorna `false`. -The following function uses an `if/else` statement to check a condition: +A função a seguir usa a instrução `if/else` para verificar uma condição: ```js function findGreater(a, b) { @@ -25,7 +25,7 @@ function findGreater(a, b) { } ``` -This can be re-written using the conditional operator: +Isto pode ser reescrito usando o operador condicional: ```js function findGreater(a, b) { @@ -35,29 +35,29 @@ function findGreater(a, b) { # --instructions-- -Use the conditional operator in the `checkEqual` function to check if two numbers are equal or not. The function should return either the string `Equal` or the string `Not Equal`. +Use o operador condicional na função `checkEqual` para verificar se dois números são iguais ou não. A função deve retornar ou a string `Equal` ou a string `Not Equal`. # --hints-- -`checkEqual` should use the conditional operator +`checkEqual` deve usar o operador condicional ```js assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code)); ``` -`checkEqual(1, 2)` should return the string `Not Equal` +`checkEqual(1, 2)` deve retornar a string `Not Equal` ```js assert(checkEqual(1, 2) === 'Not Equal'); ``` -`checkEqual(1, 1)` should return the string `Equal` +`checkEqual(1, 1)` deve retornar a string `Equal` ```js assert(checkEqual(1, 1) === 'Equal'); ``` -`checkEqual(1, -1)` should return the string `Not Equal` +`checkEqual(1, -1)` deve retornar a string `Not Equal` ```js assert(checkEqual(1, -1) === 'Not Equal'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md index 6bcf64b6c0..941d57b45f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md @@ -1,6 +1,6 @@ --- id: 587d7b7e367417b2b2512b22 -title: Use the parseInt Function with a Radix +title: Use a Função parseInt com um Radix challengeType: 1 videoUrl: 'https://scrimba.com/c/c6K4Kh3' forumTopicId: 301182 @@ -9,53 +9,53 @@ dashedName: use-the-parseint-function-with-a-radix # --description-- -The `parseInt()` function parses a string and returns an integer. It takes a second argument for the radix, which specifies the base of the number in the string. The radix can be an integer between 2 and 36. +A função `parseInt()` analisa uma string e retorna um inteiro. É preciso um segundo argumento para o radix, que especifica a base do número na string. O radix pode ser um inteiro entre 2 e 36. -The function call looks like: +A chamada da função se parece com: ```js parseInt(string, radix); ``` -And here's an example: +E aqui um exemplo: ```js var a = parseInt("11", 2); ``` -The radix variable says that `11` is in the binary system, or base 2. This example converts the string `11` to an integer `3`. +A variável radix diz que `11` está no sistema binário, ou base 2. Esse exemplo converte a string `11` para um inteiro `3`. # --instructions-- -Use `parseInt()` in the `convertToInteger` function so it converts a binary number to an integer and returns it. +Use `parseInt()` na função `convertToInteger` para que ela converta um número binário em um inteiro e o retorne. # --hints-- -`convertToInteger` should use the `parseInt()` function +`convertToInteger` deve usar a função `parseInt()` ```js assert(/parseInt/g.test(code)); ``` -`convertToInteger("10011")` should return a number +`convertToInteger("10011")` deve retornar um número ```js assert(typeof convertToInteger('10011') === 'number'); ``` -`convertToInteger("10011")` should return 19 +`convertToInteger("10011")` deve retornar 19 ```js assert(convertToInteger('10011') === 19); ``` -`convertToInteger("111001")` should return 57 +`convertToInteger("111001")` deve retornar 57 ```js assert(convertToInteger('111001') === 57); ``` -`convertToInteger("JamesBond")` should return `NaN` +`convertToInteger("JamesBond")` deve retornar `NaN` ```js assert.isNaN(convertToInteger('JamesBond')); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md index 901019fa34..71838f3cb4 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md @@ -1,6 +1,6 @@ --- id: 587d7b7e367417b2b2512b23 -title: Use the parseInt Function +title: Use a função parseInt challengeType: 1 videoUrl: 'https://scrimba.com/c/cm83LSW' forumTopicId: 301183 @@ -9,45 +9,45 @@ dashedName: use-the-parseint-function # --description-- -The `parseInt()` function parses a string and returns an integer. Here's an example: +A função `parseInt()` analisa uma string e retorna um inteiro. Aqui está um exemplo: ```js var a = parseInt("007"); ``` -The above function converts the string `007` to the integer `7`. If the first character in the string can't be converted into a number, then it returns `NaN`. +A função acima converte a string `007` para o inteiro `7`. Se o primeiro caractere na string não pode ser convertido em um número, então ele retorna `NaN`. # --instructions-- -Use `parseInt()` in the `convertToInteger` function so it converts the input string `str` into an integer, and returns it. +Use `parseInt()` na função `convertToInteger` para que ela converta a string de entrada `str` em um inteiro e a retorne. # --hints-- -`convertToInteger` should use the `parseInt()` function +`convertToInteger` deve usar a função `parseInt()` ```js assert(/parseInt/g.test(code)); ``` -`convertToInteger("56")` should return a number +`convertToInteger("56")` deve retornar um número ```js assert(typeof convertToInteger('56') === 'number'); ``` -`convertToInteger("56")` should return 56 +`convertToInteger("56")` deve retornar 56 ```js assert(convertToInteger('56') === 56); ``` -`convertToInteger("77")` should return 77 +`convertToInteger("77")` deve retornar 77 ```js assert(convertToInteger('77') === 77); ``` -`convertToInteger("JamesBond")` should return `NaN` +`convertToInteger("JamesBond")` deve retornar `NaN` ```js assert.isNaN(convertToInteger('JamesBond')); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index 5d9f1071db..fe9113d2e6 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244ca -title: Using Objects for Lookups +title: Usando Objetos para Pesquisas challengeType: 1 videoUrl: 'https://scrimba.com/c/cdBk8sM' forumTopicId: 18373 @@ -9,9 +9,9 @@ dashedName: using-objects-for-lookups # --description-- -Objects can be thought of as a key/value storage, like a dictionary. If you have tabular data, you can use an object to lookup values rather than a `switch` statement or an `if/else` chain. This is most useful when you know that your input data is limited to a certain range. +Objetos podem ser pensados como armazenamento de chave/valor, como um dicionário. Se você tem um dado tabular, você pode usar um objeto para pesquisar valores ao invés de uma instrução `switch` ou uma cadeia de `if/else`. Isso é mais útil quando você sabe que o seu dado de entrada é limitado para um certo intervalo. -Here is an example of a simple reverse alphabet lookup: +Aqui está um exemplo de uma simples pesquisa reversa no alfabeto: ```js var alpha = { @@ -31,63 +31,63 @@ var value = 2; alpha[value]; ``` -`alpha[2]` is the string `Y`, `alpha[24]` is the string `C`, and `alpha[value]` is the string `Y`. +`alpha[2]` é a string `Y`, `alpha[24]` é a string `C` e `alpha[value]` é a string `Y`. # --instructions-- -Convert the switch statement into an object called `lookup`. Use it to look up `val` and assign the associated string to the `result` variable. +Converta a instrução switch em um objeto chamado `lookup`. Use ele para pesquisar por `val` e atribua a string associada para a variável `result`. # --hints-- -`phoneticLookup("alpha")` should equal the string `Adams` +`phoneticLookup("alpha")` deve ser igual a string `Adams` ```js assert(phoneticLookup('alpha') === 'Adams'); ``` -`phoneticLookup("bravo")` should equal the string `Boston` +`phoneticLookup("bravo")` deve ser igual a string `Boston` ```js assert(phoneticLookup('bravo') === 'Boston'); ``` -`phoneticLookup("charlie")` should equal the string `Chicago` +`phoneticLookup("charlie")` deve ser igual a string `Chicago` ```js assert(phoneticLookup('charlie') === 'Chicago'); ``` -`phoneticLookup("delta")` should equal the string `Denver` +`phoneticLookup("delta")` deve ser igual a string `Denver` ```js assert(phoneticLookup('delta') === 'Denver'); ``` -`phoneticLookup("echo")` should equal the string `Easy` +`phoneticLookup("echo")` deve ser igual a string `Easy` ```js assert(phoneticLookup('echo') === 'Easy'); ``` -`phoneticLookup("foxtrot")` should equal the string `Frank` +`phoneticLookup("foxtrot")` deve ser igual a string `Frank` ```js assert(phoneticLookup('foxtrot') === 'Frank'); ``` -`phoneticLookup("")` should equal `undefined` +`phoneticLookup("")` deve ser igual a `undefined` ```js assert(typeof phoneticLookup('') === 'undefined'); ``` -You should not modify the `return` statement +Você não deve modificar a instrução `return` ```js assert(code.match(/return\sresult;/)); ``` -You should not use `case`, `switch`, or `if` statements +Você não deve usar as instruções `case`, `switch` ou `if` ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index 18f4e82445..5655a2fb30 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -9,11 +9,11 @@ dashedName: word-blanks # --description-- -We will now use our knowledge of strings to build a "[Mad Libs](https://en.wikipedia.org/wiki/Mad_Libs)" style word game we're calling "Word Blanks". You will create an (optionally humorous) "Fill in the Blanks" style sentence. +Nós iremos agora usar nosso conhecimento de strings para criar um "[Mad Libs](https://en.wikipedia.org/wiki/Mad_Libs)" estilo de jogo de palavras que chamamos de "Palavras em Branco". Você irá criar uma frase no estilo "Preencha os Espaços em Branco" (opcionalmente humorosa). -In a "Mad Libs" game, you are provided sentences with some missing words, like nouns, verbs, adjectives and adverbs. You then fill in the missing pieces with words of your choice in a way that the completed sentence makes sense. +Em um jogo "Mad Libs", você recebe frases com algumas palavras faltando, como substantivos, verbos, adjetivos e advérbios. Você então irá preencher os pedaços faltantes com palavras de sua escolha em uma forma que a frase completa faça sentido. -Consider this sentence - It was really **\_\_\_\_**, and we **\_\_\_\_** ourselves **\_\_\_\_**. This sentence has three missing pieces- an adjective, a verb and an adverb, and we can add words of our choice to complete it. We can then assign the completed sentence to a variable as follows: +Considere a frase - Era realmente **\_\_\_\_** e nós **\_\_\_\_** nós mesmos **\_\_\_\_**. Essa sentença possui três pedaços faltando - um adjetivo, um verbo e um advérbio, e nós podemos adicionar palavras de nossa escolha para completar. Em seguida, podemos atribuir a frase completa para uma variável como se segue: ```js var sentence = "It was really " + "hot" + ", and we " + "laughed" + " ourselves " + "silly" + "."; @@ -21,21 +21,21 @@ var sentence = "It was really " + "hot" + ", and we " + "laughed" + " ourselves # --instructions-- -In this challenge, we provide you with a noun, a verb, an adjective and an adverb. You need to form a complete sentence using words of your choice, along with the words we provide. +Nesse desafio, nós fornecemos a você um substantivo, um verbo, um adjetivo e um advérbio. Você precisar formular uma frase completa usando palavras de sua escolha, junto com as palavras que nós fornecemos. -You will need to use the string concatenation operator `+` to build a new string, using the provided variables: `myNoun`, `myAdjective`, `myVerb`, and `myAdverb`. You will then assign the formed string to the `wordBlanks` variable. You should not change the words assigned to the variables. +Você precisará usar o operador de concatenação de string `+` para criar uma nova string, usando as variáveis fornecidas: `myNoun`, `myAdjective`, `myVerb` e `myAdverb`. Em seguida, você atribuirá a string formada para a variável `wordBlanks`. Você não deve alterar as palavras atribuídas às variáveis. -You will also need to account for spaces in your string, so that the final sentence has spaces between all the words. The result should be a complete sentence. +Você também precisará se responsabilizar por espaços em sua string, para que na frase final possua espaços entre todas as palavras. O resultado não deve ser uma frase completa. # --hints-- -`wordBlanks` should be a string. +`wordBlanks` deve ser uma string. ```js assert(typeof wordBlanks === 'string'); ``` -You should not change the values assigned to `myNoun`, `myVerb`, `myAdjective` or `myAdverb`. +Você não deve alterar os valores atribuídos a `myNoun`, `myVerb`, `myAdjective` ou `myAdverb`. ```js assert( @@ -46,7 +46,7 @@ assert( ); ``` -You should not directly use the values `dog`, `ran`, `big`, or `quickly` to create `wordBlanks`. +Você não deve usar diretamente os valores `dog`, `ran`, `big` ou `quickly` para criar `wordBlanks`. ```js const newCode = removeAssignments(code); @@ -58,7 +58,7 @@ assert( ); ``` -`wordBlanks` should contain all of the words assigned to the variables `myNoun`, `myVerb`, `myAdjective` and `myAdverb` separated by non-word characters (and any additional words in your madlib). +`wordBlanks` deve conter todas as palavras atribuídas às variáveis `myNoun`, `myVerb`, `myAdjective` e `myAdverb` separadas por caracteres que não sejam palavras (e qualquer palavra adicional na sua madlib). ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md index 2a62b70ea4..633de5cddf 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md @@ -1,6 +1,6 @@ --- id: 56bbb991ad1ed5201cd392cf -title: Write Reusable JavaScript with Functions +title: Escreva JavaScript Reutilizável com Funções challengeType: 1 videoUrl: 'https://scrimba.com/c/cL6dqfy' forumTopicId: 18378 @@ -9,9 +9,9 @@ dashedName: write-reusable-javascript-with-functions # --description-- -In JavaScript, we can divide up our code into reusable parts called functions. +Em JavaScript, nós podemos dividir nosso código em partes reutilizáveis chamadas de functions. -Here's an example of a function: +Aqui está um exemplo de uma função: ```js function functionName() { @@ -19,34 +19,34 @@ function functionName() { } ``` -You can call or invoke this function by using its name followed by parentheses, like this: `functionName();` Each time the function is called it will print out the message `Hello World` on the dev console. All of the code between the curly braces will be executed every time the function is called. +Você pode chamar ou invocar essa função ao usar seu nome seguido de parênteses, da seguinte forma: `functionName();` Cada vez que a função é chamada irá imprimir no console a mensagem `Hello World`. Todo o código entre as chaves será executado toda vez que uma função for chamada. # --instructions--
          1. - Create a function called reusableFunction which prints the string Hi World to the dev console. + Crie uma função chamada reusableFunction que imprime a string Hi World no console.
          2. - Call the function. + Chame a função.
          # --hints-- -`reusableFunction` should be a function. +`reusableFunction` deve ser uma função. ```js assert(typeof reusableFunction === 'function'); ``` -If `reusableFunction` is called, it should output the string `Hi World` to the console. +Se `reusableFunction` é chamada, deve exibir no console a string `Hi World`. ```js assert(testConsole()); ``` -You should call `reusableFunction` once it is defined. +Você deve chamar `reusableFunction` uma vez que for definida. ```js const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString()); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md index 7aea16b1e6..92f0e4ed65 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md @@ -1,6 +1,6 @@ --- id: 587d7b85367417b2b2512b3a -title: Catch Arguments Passed in the Wrong Order When Calling a Function +title: Capture Argumentos Passados na Ordem Errada Quando Chamando uma Função challengeType: 1 forumTopicId: 301184 dashedName: catch-arguments-passed-in-the-wrong-order-when-calling-a-function @@ -8,21 +8,21 @@ dashedName: catch-arguments-passed-in-the-wrong-order-when-calling-a-function # --description-- -Continuing the discussion on calling functions, the next bug to watch out for is when a function's arguments are supplied in the incorrect order. If the arguments are different types, such as a function expecting an array and an integer, this will likely throw a runtime error. If the arguments are the same type (all integers, for example), then the logic of the code won't make sense. Make sure to supply all required arguments, in the proper order to avoid these issues. +Continuando a discussão sobre chamada de funções, o próximo bug para prestar atenção é quando os argumentos de uma função são fornecidos na ordem incorreta. Se os argumentos forem de diferentes tipos, tal como uma função esperando um array e um inteiro, isso irá provavelmente lançar um erro de tempo de execução. Se os argumentos são do mesmo tipo (todos os inteiros, por exemplo), então a lógica do código não fará sentido. Certifique-se de fornecer todos os argumentos exigidos, na ordem adequada para evitar esses problemas. # --instructions-- -The function `raiseToPower` raises a base to an exponent. Unfortunately, it's not called properly - fix the code so the value of `power` is the expected 8. +A função `raiseToPower` eleva uma base para um expoente. Infelizmente, não é chamada corretamente - corrija o código para que o valor de `power` seja o esperado 8. # --hints-- -Your code should fix the variable `power` so it equals 2 raised to the 3rd power, not 3 raised to the 2nd power. +Seu código deve corrigir a variável `power` para que seja igual a 2 elevado a 3ª potência, e não 3 elevado a 2ª potência. ```js assert(power == 8); ``` -Your code should use the correct order of the arguments for the `raiseToPower` function call. +Seu código deve usar a ordem correta dos argumentos para a chamada da função `raiseToPower`. ```js assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index 83f757ada1..e33256bed7 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -1,6 +1,6 @@ --- id: 587d7b85367417b2b2512b39 -title: Catch Missing Open and Closing Parenthesis After a Function Call +title: Capture Abertura e Fechamento de Parênteses Faltantes Após uma Chamada de Função challengeType: 1 forumTopicId: 301185 dashedName: catch-missing-open-and-closing-parenthesis-after-a-function-call @@ -8,9 +8,9 @@ dashedName: catch-missing-open-and-closing-parenthesis-after-a-function-call # --description-- -When a function or method doesn't take any arguments, you may forget to include the (empty) opening and closing parentheses when calling it. Often times the result of a function call is saved in a variable for other use in your code. This error can be detected by logging variable values (or their types) to the console and seeing that one is set to a function reference, instead of the expected value the function returns. +Quando uma função ou método não recebe nenhum parâmetro, você pode esquecer de incluir a abertura e fechamento de parênteses (vazio) ao chamá-la. Frequentemente, o resultado de uma chamada de função é salva em uma variável para outro uso em seu código. Esse erro pode ser detectado ao exibir no console os valores das variáveis (ou seus tipos) e verificar que uma variável está definida para uma referência de uma função, ao invés do valor esperado que a função retorna. -The variables in the following example are different: +As variáveis no seguinte exemplo são diferentes: ```js function myFunction() { @@ -20,21 +20,21 @@ let varOne = myFunction; let varTwo = myFunction(); ``` -Here `varOne` is the function `myFunction`, and `varTwo` is the string `You rock!`. +Aqui `varOne` é a função `myFunction` e `varTwo` é a string `You rock!`. # --instructions-- -Fix the code so the variable `result` is set to the value returned from calling the function `getNine`. +Corrija o código para que a variável `result` seja definida para o valor retornado da chamada da função `getNine`. # --hints-- -Your code should fix the variable `result` so it is set to the number that the function `getNine` returns. +Seu código deve corrigir a variável `result` para que seja definida para o número que a função `getNine` retorna. ```js assert(result == 9); ``` -Your code should call the `getNine` function. +Seu código deve chamar a função `getNine`. ```js assert(code.match(/getNine\(\)/g).length == 2); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index cdadad8534..37833cf704 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -1,6 +1,6 @@ --- id: 587d7b84367417b2b2512b35 -title: Catch Misspelled Variable and Function Names +title: Capture Nomes de Variáveis e Funções Com Erros Ortográficos challengeType: 1 forumTopicId: 301186 dashedName: catch-misspelled-variable-and-function-names @@ -8,41 +8,41 @@ dashedName: catch-misspelled-variable-and-function-names # --description-- -The `console.log()` and `typeof` methods are the two primary ways to check intermediate values and types of program output. Now it's time to get into the common forms that bugs take. One syntax-level issue that fast typers can commiserate with is the humble spelling error. +Os métodos `console.log()` e `typeof` são duas formas primárias para verificar valores intermediários e tipos de saída do programa. Agora é hora entrar nas formas comuns que um bug assume. Um problema de nível de sintaxe que digitadores rápidos podem ter passado é o humilde erro de digitação incorreta. -Transposed, missing, or mis-capitalized characters in a variable or function name will have the browser looking for an object that doesn't exist - and complain in the form of a reference error. JavaScript variable and function names are case-sensitive. +Caracteres deslocados, faltando ou capitalizado erroneamente em um nome de variável ou função fará com que o navegador procure por um objeto que não existe - e reclamará na forma de um erro de referência. Variáveis e funções JavaScript são sensíveis a caracteres maiúsculos e minúsculos. # --instructions-- -Fix the two spelling errors in the code so the `netWorkingCapital` calculation works. +Corrija os dois erros de ortografia no código para que o cálculo `netWorkingCapital` funcione. # --hints-- -Check the spelling of the two variables used in the netWorkingCapital calculation, the console output should show that "Net working capital is: 2". +Verifique a ortografia das duas variáveis usadas no cálculo de netWorkingCapital, a saída do console deve mostrar que "Net working capital is: 2". ```js assert(netWorkingCapital === 2); ``` -There should be no instances of mis-spelled variables in the code. +Não deve haver instâncias de variáveis com ortografia incorretas no código. ```js assert(!code.match(/recievables/g)); ``` -The `receivables` variable should be declared and used properly in the code. +A variável `receivables` deve ser declarada e usada corretamente no código. ```js assert(code.match(/receivables/g).length == 2); ``` -There should be no instances of mis-spelled variables in the code. +Não deve haver instâncias de variáveis com ortografia incorretas no código. ```js assert(!code.match(/payable;/g)); ``` -The `payables` variable should be declared and used properly in the code. +A variável `payables` deve ser declarada e usada corretamente no código. ```js assert(code.match(/payables/g).length == 2); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index 90d6fcd958..7eb7499ebb 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -1,6 +1,6 @@ --- id: 587d7b84367417b2b2512b37 -title: Catch Mixed Usage of Single and Double Quotes +title: Identificar Uso Misto de Aspas Simples e Duplas challengeType: 1 forumTopicId: 301188 dashedName: catch-mixed-usage-of-single-and-double-quotes @@ -8,21 +8,20 @@ dashedName: catch-mixed-usage-of-single-and-double-quotes # --description-- -JavaScript allows the use of both single (`'`) and double (`"`) quotes to declare a string. Deciding which one to use generally comes down to personal preference, with some exceptions. +JavaScript nos permite o uso de ambas as aspas simples (`') e duplas (") para declarar uma string. Decidir qual delas usar geralmente é uma questão de preferência pessoal, com algumas exceções.

          -Having two choices is great when a string has contractions or another piece of text that's in quotes. Just be careful that you don't close the string too early, which causes a syntax error. +

          Ter duas opções é ótimo quando uma string possui contrações ou outros pedaços de texto que estão entre aspas. Apenas tome cuidado para que você não feche uma string muito cedo, o que causa erro de sintaxe.

          -Here are some examples of mixing quotes: +

          Aqui estão alguns exemplos de mistura de aspas:

          -```js -const grouchoContraction = "I've had a perfectly wonderful evening, but this wasn't it."; +
          const grouchoContraction = "I've had a perfectly wonderful evening, but this wasn't it.";
           const quoteInString = "Groucho Marx once said 'Quote me as saying I was mis-quoted.'";
           const uhOhGroucho = 'I've had a perfectly wonderful evening, but this wasn't it.';
          -```
          +`
          -The first two are correct, but the third is incorrect. +As duas primeiras estão corretas, mas a terceira não. -Of course, it is okay to use only one style of quotes. You can escape the quotes inside the string by using the backslash (`\`) escape character: +Claro, não há problema usar apenas um estilo de aspas. Você pode escapar as aspas dentro de uma string ao usar o caractere barra invertida (\
          ): ```js const allSameQuotes = 'I\'ve had a perfectly wonderful evening, but this wasn\'t it.'; @@ -30,17 +29,17 @@ const allSameQuotes = 'I\'ve had a perfectly wonderful evening, but this wasn\'t # --instructions-- -Fix the string so it either uses different quotes for the `href` value, or escape the existing ones. Keep the double quote marks around the entire string. +Corrija a string para que ou use aspas diferentes para o valor de `href` ou escape as aspas existentes. Mantenha as aspas duplas ao redor de toda a string. # --hints-- -Your code should fix the quotes around the `href` value `#Home` by either changing or escaping them. +Seu código deve corrigir as aspas em torno do valor de `href`: `#Home` ao mudar ou escapar elas. ```js assert(code.match(/
          /g)); ``` -Your code should keep the double quotes around the entire string. +Seu código deve manter as aspas duplas ao redor de toda a string. ```js assert(code.match(/"

          .*?<\/p>";/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index 1b22696596..4cada8fd6a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -1,6 +1,6 @@ --- id: 587d7b86367417b2b2512b3b -title: Catch Off By One Errors When Using Indexing +title: Capture Erros de Fora Por Um Quando Usando Indexação challengeType: 1 forumTopicId: 301189 dashedName: catch-off-by-one-errors-when-using-indexing @@ -8,9 +8,9 @@ dashedName: catch-off-by-one-errors-when-using-indexing # --description-- -Off by one errors (sometimes called OBOE) crop up when you're trying to target a specific index of a string or array (to slice or access a segment), or when looping over the indices of them. JavaScript indexing starts at zero, not one, which means the last index is always one less than the length of the item. If you try to access an index equal to the length, the program may throw an "index out of range" reference error or print `undefined`. +Off by one errors (erros de fora por um) (as vezes chamado OBOE) surge quando você está tentando acessar um índice específico de uma string ou array (para fatiar ou acessar um segmento), ou quando você está iterando sobre seus índices. A indexação de JavaScript começa em zero e não um, o que significa que o último índice sempre será o tamanho do item menos 1 (array.length - 1). Se você estiver tentando acessar um índice igual ao tamanho, o programa pode lançar uma referência do erro "index out of range" ou imprimir `undefined`. -When you use string or array methods that take index ranges as arguments, it helps to read the documentation and understand if they are inclusive (the item at the given index is part of what's returned) or not. Here are some examples of off by one errors: +Quando você usa métodos de string ou array que recebem intervalos de índices como argumentos, auxilia na leitura da documentação e compreender se eles são inclusivos (o item no índice especificado é parte do que é retornado) ou não. Aqui estão alguns exemplos de erros de fora por um: ```js let alphabet = "abcdefghijklmnopqrstuvwxyz"; @@ -26,33 +26,33 @@ for (let k = 0; k < len; k++) { } ``` -The first example here loops one too many times, and the second loops one too few times (missing the first index, 0). The third example is correct. +O primeiro exemplo itera uma vez a mais (i <= len) e o segundo itera uma vez a menos por começar do índice 1 (let j = 1). O terceiro exemplo está certo. # --instructions-- -Fix the two indexing errors in the following function so all the numbers 1 through 5 are printed to the console. +Corrija os dois erros de índices nas funções seguintes para que todos os números de 1 até 5 sejam exibidos no console. # --hints-- -Your code should set the initial condition of the loop so it starts at the first index. +Seu código deve definir a condição inicial do laço para começar do primeiro índice. ```js assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` -Your code should fix the initial condition of the loop so that the index starts at 0. +Seu código deve corrigir a condição inicial do laço para que o índice comece em 0. ```js assert(!code.match(/i\s?=\s*?1\s*?;/g)); ``` -Your code should set the terminal condition of the loop so it stops at the last index. +Seu código deve definir a condição de parada do laço, a fim de parar no último índice. ```js assert(code.match(/i\s*?<\s*?len\s*?;/g).length == 1); ``` -Your code should fix the terminal condition of the loop so that it stops at 1 before the length. +Seu código deve corrigir a condição de parada do laço, a fim de parar no tamanho menos 1. ```js assert(!code.match(/i\s*?<=\s*?len;/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index 42ad053023..e92432850a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -1,6 +1,6 @@ --- id: 587d7b84367417b2b2512b36 -title: 'Catch Unclosed Parentheses, Brackets, Braces and Quotes' +title: 'Identifique Parênteses, Colchetes, Chaves e Aspas Sem Fechamento' challengeType: 1 forumTopicId: 301190 dashedName: catch-unclosed-parentheses-brackets-braces-and-quotes @@ -8,23 +8,23 @@ dashedName: catch-unclosed-parentheses-brackets-braces-and-quotes # --description-- -Another syntax error to be aware of is that all opening parentheses, brackets, curly braces, and quotes have a closing pair. Forgetting a piece tends to happen when you're editing existing code and inserting items with one of the pair types. Also, take care when nesting code blocks into others, such as adding a callback function as an argument to a method. +Outro erro de sintaxe para estar ciente é que todas as aberturas de parênteses, colchetes, chaves e aspas têm um par de fechamento. Esquecer um pedaço tende a acontecer quando você está editando um código existente e inserindo itens com um dos tipos de pares. Também, tenha cuidado ao aninhar blocos de código em outros, como adicionar uma função de callback como um argumento a um método. -One way to avoid this mistake is as soon as the opening character is typed, immediately include the closing match, then move the cursor back between them and continue coding. Fortunately, most modern code editors generate the second half of the pair automatically. +Uma maneira de evitar esse erro é assim que o caractere de abertura é digitado, imediatamente inclua o caractere de fechamento, mova o cursor entre eles e continue programando. Felizmente, a maioria dos editores de código modernos geram a segunda parte do par automaticamente. # --instructions-- -Fix the two pair errors in the code. +Corrija os dois erros de pares no código. # --hints-- -Your code should fix the missing piece of the array. +Seu código deve corrigir o pedaço que falta do array. ```js assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` -Your code should fix the missing piece of the `.reduce()` method. The console output should show that `Sum of array values is: 6`. +Seu código deve corrigir o pedaço que falta do método `.reduce()`. A saída no console deve mostrar que `Sum of array value is: 6`. ```js assert(arraySum === 6); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index 7fea55d185..04ff1b50ea 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -1,6 +1,6 @@ --- id: 587d7b85367417b2b2512b38 -title: Catch Use of Assignment Operator Instead of Equality Operator +title: Identifique Uso do Operador de Atribuição ao invés do Operador de Igualdade challengeType: 1 forumTopicId: 301191 dashedName: catch-use-of-assignment-operator-instead-of-equality-operator @@ -8,13 +8,13 @@ dashedName: catch-use-of-assignment-operator-instead-of-equality-operator # --description-- -Branching programs, i.e. ones that do different things if certain conditions are met, rely on `if`, `else if`, and `else` statements in JavaScript. The condition sometimes takes the form of testing whether a result is equal to a value. +Programas de ramificação, ou seja, programas que fazem coisas diferentes se certas condições forem atendidas, dependem de instruções `i`, `else if` e `else` em JavaScript. Às vezes a condição verifica se um resultado é igual a um valor. -This logic is spoken (in English, at least) as "if x equals y, then ..." which can literally translate into code using the `=`, or assignment operator. This leads to unexpected control flow in your program. +Essa lógica é fala da seguinte forma: "se x for igual a y, então ..." o que pode literalmente ser traduzido para código usando o `=`, ou operador de atribuição. Isso leva a um controle de fluxo inesperado no seu programa. -As covered in previous challenges, the assignment operator (`=`) in JavaScript assigns a value to a variable name. And the `==` and `===` operators check for equality (the triple `===` tests for strict equality, meaning both value and type are the same). +Como abordado nos desafios anteriores, o operador de atribuição (`=`) em JavaScript, atribui um valor para o nome de uma variável. E os operadores `==` e `===` verificam pela igualdade (o triplo `===` testa por igualdade estrita, significando que ambos os valores e o tipo de dado são os mesmos). -The code below assigns `x` to be 2, which evaluates as `true`. Almost every value on its own in JavaScript evaluates to `true`, except what are known as the "falsy" values: `false`, `0`, `""` (an empty string), `NaN`, `undefined`, and `null`. +O código abaixo atribui `x` para ser 2, o que tem como resultado `true`. Quase todo valor por si só em JavaScript são avaliados como `true`, exceto com o que são conhecidos como valores falsos: `false`, `0`, `""` (uma string vazia), `NaN`, `undefined` e `null`. ```js let x = 1; @@ -26,21 +26,21 @@ if (x = y) { } ``` -In this example, the code block within the `if` statement will run for any value of `y`, unless `y` is falsy. The `else` block, which we expect to run here, will not actually run. +Nesse exemplo, o bloco de código dentro da instrução `if` irá rodar para qualquer valor de `y`, a não ser que `y` seja falso. O bloco de `else`, que nós esperamos ser executado aqui, não irá realmente rodar. # --instructions-- -Fix the condition so the program runs the right branch, and the appropriate value is assigned to `result`. +Corrija a condição para que o programa rode na ramificação correta e o valor apropriado seja atribuído a `result`. # --hints-- -Your code should fix the condition so it checks for equality, instead of using assignment. +Seu código deve corrigir a condição para que verifique pela igualdade, ao invés de usar atribuição. ```js assert(result == 'Not equal!'); ``` -The condition should use either `==` or `===` to test for equality. +A condição deve usar `==` ou `===` para verificar a igualdade. ```js assert(code.match(/x\s*?===?\s*?y/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md index 9455e13645..306d7c2115 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md @@ -1,6 +1,6 @@ --- id: 587d7b86367417b2b2512b3d -title: Prevent Infinite Loops with a Valid Terminal Condition +title: Previna Laços Infinitos com uma Condição de Término Válida challengeType: 1 forumTopicId: 301192 dashedName: prevent-infinite-loops-with-a-valid-terminal-condition @@ -8,9 +8,9 @@ dashedName: prevent-infinite-loops-with-a-valid-terminal-condition # --description-- -The final topic is the dreaded infinite loop. Loops are great tools when you need your program to run a code block a certain number of times or until a condition is met, but they need a terminal condition that ends the looping. Infinite loops are likely to freeze or crash the browser, and cause general program execution mayhem, which no one wants. +O tópico final é o temido laço infinito. Laços são ótimas ferramentas quando você precisa que o seu programa rode um bloco de código uma quantidade exata de vezes ou até que uma condição seja atendida, mas eles precisam de uma condição de parada que finalize esse laço. Laços infinitos têm alta probabilidade de congelar ou travar o navegador, e causa um caos na execução geral do programa, o que ninguém deseja. -There was an example of an infinite loop in the introduction to this section - it had no terminal condition to break out of the `while` loop inside `loopy()`. Do NOT call this function! +Havia um exemplo de laço infinito na introdução dessa seção - esse laço não tinha uma condição de parada para sair do laço `while` dentro de `loopy()`. NÃO chame essa função! ```js function loopy() { @@ -20,21 +20,21 @@ function loopy() { } ``` -It's the programmer's job to ensure that the terminal condition, which tells the program when to break out of the loop code, is eventually reached. One error is incrementing or decrementing a counter variable in the wrong direction from the terminal condition. Another one is accidentally resetting a counter or index variable within the loop code, instead of incrementing or decrementing it. +É trabalho do programador garantir que a condição de parada, a qual avisa ao programa quando sair de um laço, é eventualmente alcançada. Um erro é incrementar ou decrementar uma variável contadora na direção errada da condição de parada. Outro erro é acidentalmente reiniciar uma variável contadora ou de índice dentro do laço, ao invés de incrementar ou decrementar. # --instructions-- -The `myFunc()` function contains an infinite loop because the terminal condition `i != 4` will never evaluate to `false` (and break the looping) - `i` will increment by 2 each pass, and jump right over 4 since `i` is odd to start. Fix the comparison operator in the terminal condition so the loop only runs for `i` less than or equal to 4. +A função `myFunc()` contém um laço infinito porque a condição de parada `i != 4` nunca será `false` (e então quebrar o laço) - `i` irá incrementar em 2 a cada iteração, e passa direto por 4 já que `i` é ímpar no início. Corrija o operador de comparação para que o laço só rode enquanto `i` for menor ou igual a 4. # --hints-- -Your code should change the comparison operator in the terminal condition (the middle part) of the `for` loop. +Seu código deve alterar o operador de comparação na condição de parada (parte do meio) do laço `for`. ```js assert(code.match(/i\s*?<=\s*?4;/g).length == 1); ``` -Your code should fix the comparison operator in the terminal condition of the loop. +Seu código deve corrigir o operador de comparação na condição de parada do laço. ```js assert(!code.match(/i\s*?!=\s*?4;/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index b3ec6b24bc..c6940489b9 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -1,6 +1,6 @@ --- id: 587d7b83367417b2b2512b37 -title: Understanding the Differences between the freeCodeCamp and Browser Console +title: Entendendo a Diferença entre o console da freeCodeCamp e do Navegador challengeType: 1 forumTopicId: 301193 dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-console @@ -8,27 +8,27 @@ dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-c # --description-- -You may have noticed that some freeCodeCamp JavaScript challenges include their own console. This console behaves a little differently than the browser console you used in the last challenge. +Você pode ter percebido que alguns dos desafios de JavaScript da freeCodeCamp incluem seu próprio console. Esse console se comporta um pouco difrente do console do navegador que você utilizou no último desafio. -The following challenge is meant to highlight the main difference between the freeCodeCamp console and your browser console. +O desafio a seguir tem a finalidade de destacar a principal diferença entre o console da freeCodeCamp e do navegador. -When you run ordinary JavaScript, the browser's console will display your `console.log()` statements the exact number of times it is called. +Quando você executa JavaScript comum, o console do navegado exibirá suas instruções `console.log()` a exata quantidade de vezes que é chamada. -The freeCodeCamp console will print your `console.log()` statements a short time after the editor detects a change in the script, as well as during testing. +O console da freeCodeCamp irá imprimir suas instruções `console.log()` um curto período depois do editor detectar mudança no script, e também durante o teste. -The freeCodeCamp console is cleared before the tests are run and, to avoid spam, only prints the logs during the first test (see the note below for exceptions). +O console da freeCodeCamp é apagado antes de cada execução de testes e, para evitar spam, só imprime os logs durante o primeiro teste (veja a nota abaixo para exceções). -If you would like to see every log for every test, run the tests, and open the browser console. If you prefer to use the browser console, and want it to mimic the freeCodeCamp console, place `console.clear()` before any other `console` calls, to clear the browser console. +Se você gostaria de ver todos os logs em todos os testes, execute os testes e abra o console do navegador. Se preferir usar o console do navegador e quiser que ele imite o console da freeCodeCamp, coloque `console.clear()` antes de qualquer outra chamada ao `console`, para apagar o console do navegador. -**Note:** `console.log`s inside functions are printed to the freeCodeCamp console whenever those functions are called. This can help debugging functions that are called during testing. +**Nota:** `console.log` dentro de funções são impressas no console da freeCodeCamp toda vez que essas funções forem chamadas. Isso pode ajudar a depurar (ou debugar) funções que são chamadas durante os testes. # --instructions-- -First, use `console.log` to log the `output` variable. Then, use `console.clear` to clear the browser console. +Primeiro, use `console.log` para exibir a variável `output`. Em seguida, use `console.clear` para apagar o console do navegador. # --hints-- -You should use `console.clear()` to clear the browser console. +Você deve usar `console.clear()` para apagar o console do navegador. ```js assert( @@ -38,7 +38,7 @@ assert( ); ``` -You should use `console.log()` to print the `output` variable. +Você deve usar `console.log()` para imprimir a variável `output`. ```js assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.md index 19dd59b605..bc68a17504 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.md @@ -1,6 +1,6 @@ --- id: 587d7b86367417b2b2512b3c -title: Use Caution When Reinitializing Variables Inside a Loop +title: Tenha Cuidado Quando Reinicializando Variáveis Dentro de Laços challengeType: 1 forumTopicId: 301194 dashedName: use-caution-when-reinitializing-variables-inside-a-loop @@ -8,29 +8,29 @@ dashedName: use-caution-when-reinitializing-variables-inside-a-loop # --description-- -Sometimes it's necessary to save information, increment counters, or re-set variables within a loop. A potential issue is when variables either should be reinitialized, and aren't, or vice versa. This is particularly dangerous if you accidentally reset the variable being used for the terminal condition, causing an infinite loop. +Às vezes é necessário salvar informações, incrementar contadores ou redefinir variáveis dentro de um laço. Um potencial problema é quando variáveis deveriam ser reinicializadas e, não são, ou vice versa. Isso é particularmente perigoso se você acidentalmente redefinir a variável sendo usada para a a condição de parada, causando um laço infinito. -Printing variable values with each cycle of your loop by using `console.log()` can uncover buggy behavior related to resetting, or failing to reset a variable. +Imprimir os valores das variáveis em cada ciclo do seu laço usando `console.log()` pode descobrir comportamentos com bugs relacionados a reiniciar ou falhar ao reiniciar uma variável. # --instructions-- -The following function is supposed to create a two-dimensional array with `m` rows and `n` columns of zeroes. Unfortunately, it's not producing the expected output because the `row` variable isn't being reinitialized (set back to an empty array) in the outer loop. Fix the code so it returns a correct 3x2 array of zeroes, which looks like `[[0, 0], [0, 0], [0, 0]]`. +A seguinte função deveria criar um array de duas dimensões com `m` linhas e `n` colunas de zeros. Infelizmente, não está produzindo a saída esperada porque a variável `row` não está sendo reiniciada (definida de volta para um array vazio) no laço mais externo. Corrija o código para que retorne o array de zeros correto (dimensão: 3x2), que se parece com `[[0, 0], [0, 0], [0, 0]]`. # --hints-- -Your code should set the `matrix` variable to an array holding 3 rows of 2 columns of zeroes each. +Seu código deve definir a variável `matrix` para um array contendo 3 linhas de 2 colunas de zeros. ```js assert(JSON.stringify(matrix) == '[[0,0],[0,0],[0,0]]'); ``` -The `matrix` variable should have 3 rows. +A variável `matrix` deve ter 3 linhas. ```js assert(matrix.length == 3); ``` -The `matrix` variable should have 2 columns in each row. +A variável `matrix` deve ter 2 colunas em cada linha. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index 4e212c2723..7b2cd30f30 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -1,6 +1,6 @@ --- id: 587d7b83367417b2b2512b33 -title: Use the JavaScript Console to Check the Value of a Variable +title: Use o Console JavaScript para Verificar o Valor de uma Variável challengeType: 1 forumTopicId: 18372 dashedName: use-the-javascript-console-to-check-the-value-of-a-variable @@ -8,13 +8,13 @@ dashedName: use-the-javascript-console-to-check-the-value-of-a-variable # --description-- -Both Chrome and Firefox have excellent JavaScript consoles, also known as DevTools, for debugging your JavaScript. +Ambos o Chrome e o Firefox possui excelentes consoles JavaScript, também conhecidos como DevTools, para depurar seu JavaScript. -You can find Developer tools in your Chrome's menu or Web Console in Firefox's menu. If you're using a different browser, or a mobile phone, we strongly recommend switching to desktop Firefox or Chrome. +Você pode encontrar Developer tools no menu do seu Chrome ou Web Console no menu do Firefox. Se você estiver usando um navegador diferente, ou um telefone móvel, recomendamos fortemente mudar para o Firefox ou Chrome Desktop. -The `console.log()` method, which "prints" the output of what's within its parentheses to the console, will likely be the most helpful debugging tool. Placing it at strategic points in your code can show you the intermediate values of variables. It's good practice to have an idea of what the output should be before looking at what it is. Having check points to see the status of your calculations throughout your code will help narrow down where the problem is. +O método `console.log()`, o qual "imprime" a saída do que está nos seus parênteses no console, irá provavelmente ser a ferramenta de debug mais útil. Colocá-lo em pontos estratégicos no seu código pode te mostrar os valores intermediários de variáveis. É uma boa prática ter uma ideia do que deveria ser a saída antes de olhar o que é. Ter pontos de verificação para ver o status de seus cálculos ao longo do seu código ajudará a encontrar onde o problema está. -Here's an example to print the string `Hello world!` to the console: +Aqui está um exemplo para imprimir a string `Hello world!` no console: ```js console.log('Hello world!'); @@ -22,11 +22,11 @@ console.log('Hello world!'); # --instructions-- -Use the `console.log()` method to print the value of the variable `a` where noted in the code. +Use o método `console.log()` para imprimir o valor da variável `a` aonde anotou no código. # --hints-- -Your code should use `console.log()` to check the value of the variable `a`. +Seu código deve usar `console.log()` para verificar o valor da variável `a`. ```js assert(code.match(/console\.log\(a\)/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index 866916b9b8..5b4af56982 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -1,6 +1,6 @@ --- id: 587d7b84367417b2b2512b34 -title: Use typeof to Check the Type of a Variable +title: Use typeof para Verificar o Tipo da Variável challengeType: 1 forumTopicId: 18374 dashedName: use-typeof-to-check-the-type-of-a-variable @@ -8,9 +8,9 @@ dashedName: use-typeof-to-check-the-type-of-a-variable # --description-- -You can use `typeof` to check the data structure, or type, of a variable. This is useful in debugging when working with multiple data types. If you think you're adding two numbers, but one is actually a string, the results can be unexpected. Type errors can lurk in calculations or function calls. Be careful especially when you're accessing and working with external data in the form of a JavaScript Object Notation (JSON) object. +Você pode usar `typeof` para verificar a estrutura de dado, ou tipo, de uma variável. Isso é útil na depuração quando trabalhando com diversos tipos de dados. Se você pensar que está adicionando dois números, mas na verdade um é na verdade uma string, o resultado pode ser inesperado. Erros de tipo podem se esconder em cálculos ou chamada de funções. Seja cuidadoso especialmente quando você estiver acessando e trabalhando com dados externos na forma de um objeto JavaScript Object Notation (JSON). -Here are some examples using `typeof`: +Aqui está alguns exemplos usando `typeof`: ```js console.log(typeof ""); @@ -19,29 +19,29 @@ console.log(typeof []); console.log(typeof {}); ``` -In order, the console will display the strings `string`, `number`, `object`, and `object`. +Em ordem, o console exibirá as strings `string`, `number`, `object` e `object`. -JavaScript recognizes six primitive (immutable) data types: `Boolean`, `Null`, `Undefined`, `Number`, `String`, and `Symbol` (new with ES6) and one type for mutable items: `Object`. Note that in JavaScript, arrays are technically a type of object. +JavaScript reconhece seis tipos de dados primitivos (imutável): `Boolean`, `Null`, `Undefined`, `Number`, `String` e `Symbol` (novo em ES6) e um tipo para itens mutáveis: `Object`. Note que em JavaScript, arrays são tecnicamente um tipo de objeto. # --instructions-- -Add two `console.log()` statements to check the `typeof` each of the two variables `seven` and `three` in the code. +Adicione duas instruções `console.log()` para verificar o `typeof` de cada uma das duas variáveis `seven` e `three` no código. # --hints-- -Your code should use `typeof` in two `console.log()` statements to check the type of the variables. +Seu código deve usar `typeof` em duas instruções `console.log()` para verificar o tipo das variáveis. ```js assert(code.match(/console\.log\(typeof[\( ].*\)?\)/g).length == 2); ``` -Your code should use `typeof` to check the type of the variable `seven`. +Seu código deve usar `typeof` para verificar o tipo da variável `seven`. ```js assert(code.match(/typeof[\( ]seven\)?/g)); ``` -Your code should use `typeof` to check the type of the variable `three`. +Seu código deve usar `typeof` para verificar o tipo da variável `three`. ```js assert(code.match(/typeof[\( ]three\)?/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index 8d1c2233a5..3434d66ee3 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -1,6 +1,6 @@ --- id: 587d7b87367417b2b2512b40 -title: Compare Scopes of the var and let Keywords +title: Compare Escopos das Palavras-Chaves var e let challengeType: 1 forumTopicId: 301195 dashedName: compare-scopes-of-the-var-and-let-keywords @@ -8,11 +8,11 @@ dashedName: compare-scopes-of-the-var-and-let-keywords # --description-- -When you declare a variable with the `var` keyword, it is declared globally, or locally if declared inside a function. +Quando você declara uma variável com a palavra-chave `var`, ela é declarada globalmente, ou localmente se declarada dentro de uma função. -The `let` keyword behaves similarly, but with some extra features. When you declare a variable with the `let` keyword inside a block, statement, or expression, its scope is limited to that block, statement, or expression. +A palvara-chave `let` se comporta de forma similar, mas com alguns recursos extras. Quando você declara a variável com a palavra-chave `let` dentro de um bloco, declaração, ou expressão, seu escopo é limitado ao bloco, declaração, ou expressão. -For example: +Por exemplo: ```js var numArray = []; @@ -23,9 +23,9 @@ console.log(numArray); console.log(i); ``` -Here the console will display the values `[0, 1, 2]` and `3`. +Aqui o console irá exibir os valores `[0, 1, 2]` e `3`. -With the `var` keyword, `i` is declared globally. So when `i++` is executed, it updates the global variable. This code is similar to the following: +Com a palavra-chave `var`, `i` é declarado globalmente. Então quando `i++` é executado, ele atualiza a variável global. Esse código é semelhante ao seguinte: ```js var numArray = []; @@ -37,9 +37,9 @@ console.log(numArray); console.log(i); ``` -Here the console will display the values `[0, 1, 2]` and `3`. +Aqui o console irá exibir os valores `[0, 1, 2]` e `3`. -This behavior will cause problems if you were to create a function and store it for later use inside a `for` loop that uses the `i` variable. This is because the stored function will always refer to the value of the updated global `i` variable. +Este comportamento causará problemas se você criasse uma função e armazená-la para depois utilizar dentro de um laço `for` que utiliza a variável `i`. Isso se deve ao fato da função armazenada sempre irá se referir ao valor da variável global `i` atualizada. ```js var printNumTwo; @@ -53,9 +53,9 @@ for (var i = 0; i < 3; i++) { console.log(printNumTwo()); ``` -Here the console will display the value `3`. +Aqui o console irá exibir o valor `3`. -As you can see, `printNumTwo()` prints 3 and not 2. This is because the value assigned to `i` was updated and the `printNumTwo()` returns the global `i` and not the value `i` had when the function was created in the for loop. The `let` keyword does not follow this behavior: +Como você pode ver, `printNumTwo()` exibe 3 e não 2. Isso se deve ao fato do valor atribuído a `i` foi atualizado e `printNumTwo()` retorna a variável global `i` e não o valor que `i` tinha quando a função foi criada dentro do laço for. A palavra-chave `let` não segue este comportamento: ```js let printNumTwo; @@ -70,25 +70,25 @@ console.log(printNumTwo()); console.log(i); ``` -Here the console will display the value `2`, and an error that `i is not defined`. +Aqui o console irá exibir o valor `2`, e um erro que `i is not defined (i não foi definido)`. -`i` is not defined because it was not declared in the global scope. It is only declared within the `for` loop statement. `printNumTwo()` returned the correct value because three different `i` variables with unique values (0, 1, and 2) were created by the `let` keyword within the loop statement. +`i` não foi definido porque não foi declarado no escopo global. É declarado apenas dentro da declaração do laço `for`. `printNumTwo()` retornou o valor correto porque três variáveis `i` distintas com valores únicos (0, 1 e 2) foram criados com a palavra-chave `let` dentro da declaração do laço. # --instructions-- -Fix the code so that `i` declared in the `if` statement is a separate variable than `i` declared in the first line of the function. Be certain not to use the `var` keyword anywhere in your code. +Corrija o código para que `i` declarado dentro do comando `if` seja uma variável diferente de `i` declarada na primeira linha da função. Tenha certeza de não usar a palavra-chave `var` em nenhum lugar do seu código. -This exercise is designed to illustrate the difference between how `var` and `let` keywords assign scope to the declared variable. When programming a function similar to the one used in this exercise, it is often better to use different variable names to avoid confusion. +Este exercício foi projetado para ilustrar a diferença ente como as palavras-chaves `var` e `let` definem o escopo para a variável declarada. Quando programamos uma função semelhar a aquelas utilizadas no exercício, geralmente é melhor utilizar variáveis distintas para evitar confusão. # --hints-- -`var` should not exist in code. +`var` não deve existir no código. ```js (getUserInput) => assert(!getUserInput('index').match(/var/g)); ``` -The variable `i` declared in the `if` statement should equal the string `block scope`. +A variável `i` declarada dentro do corpo do comando `if` deve ser igual a string `block scope`. ```js (getUserInput) => @@ -97,7 +97,7 @@ The variable `i` declared in the `if` statement should equal the string `block s ); ``` -`checkScope()` should return the string `function scope` +`checkScope()` deve retornar a string `function scope` ```js assert(checkScope() === 'function scope'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index aea3b4dd18..01f6d48488 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -1,6 +1,6 @@ --- id: 5cdafbc32913098997531680 -title: Complete a Promise with resolve and reject +title: Concluir uma Promessa com resolve e reject challengeType: 1 forumTopicId: 301196 dashedName: complete-a-promise-with-resolve-and-reject @@ -8,7 +8,7 @@ dashedName: complete-a-promise-with-resolve-and-reject # --description-- -A promise has three states: `pending`, `fulfilled`, and `rejected`. The promise you created in the last challenge is forever stuck in the `pending` state because you did not add a way to complete the promise. The `resolve` and `reject` parameters given to the promise argument are used to do this. `resolve` is used when you want your promise to succeed, and `reject` is used when you want it to fail. These are methods that take an argument, as seen below. +Uma promessa possui três estados: pendente (`pending`), cumprida (`fulfilled`) e rejeitada (`rejected`). A promessa que você criou no desafio anterior está presa no estado `pending` para sempre porque você não adicionou uma forma de concluir a promessa. Os parâmetros `resolve` e `reject` passados para o argumento da promessa servem para este propósito. `resolve` é utilizado quando a promessa for bem sucedida, enquanto que `reject` é utilizado quando ela falhar. Ambos são métodos que recebem apenas um argumento, como no exemplo abaixo. ```js const myPromise = new Promise((resolve, reject) => { @@ -20,15 +20,15 @@ const myPromise = new Promise((resolve, reject) => { }); ``` -The example above uses strings for the argument of these functions, but it can really be anything. Often, it might be an object, that you would use data from, to put on your website or elsewhere. +O exemplo acima usa strings como argumento desses métodos, mas você pode passar qualquer outro tipo de dado. Geralmente, é passado um objeto para esses métodos. Assim você pode acessar as propriedades deste objeto e usá-los em seu site ou em qualquer outro lugar. # --instructions-- -Make the promise handle success and failure. If `responseFromServer` is `true`, call the `resolve` method to successfully complete the promise. Pass `resolve` a string with the value `We got the data`. If `responseFromServer` is `false`, use the `reject` method instead and pass it the string: `Data not received`. +Adapte a promessa para ambas as situações de sucesso e fracasso. Se `responseFromServer` for `true`, chame o método `resolve` para completar a promessa com sucesso. Passe a string `We got the data` como argumento para o método `resolve`. Se `responseFromServer` for `false`, passe a string `Data not received` como argumento para o método `reject`. # --hints-- -`resolve` should be called with the expected string when the `if` condition is `true`. +O método `resolve` deve ser chamado com a string informada anteriormente quando a condição do `if` for `true`. ```js assert( @@ -36,7 +36,7 @@ assert( ); ``` -`reject` should be called with the expected string when the `if` condition is `false`. +O método `reject` deve ser chamado com a string informada anteriormente quando a condição do `if` for `false`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md index a0ea3ea95b..cd50070664 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md @@ -1,6 +1,6 @@ --- id: 5cdafbb0291309899753167f -title: Create a JavaScript Promise +title: Criar uma Promessa em JavaScript challengeType: 1 forumTopicId: 301197 dashedName: create-a-javascript-promise @@ -8,7 +8,7 @@ dashedName: create-a-javascript-promise # --description-- -A promise in JavaScript is exactly what it sounds like - you use it to make a promise to do something, usually asynchronously. When the task completes, you either fulfill your promise or fail to do so. `Promise` is a constructor function, so you need to use the `new` keyword to create one. It takes a function, as its argument, with two parameters - `resolve` and `reject`. These are methods used to determine the outcome of the promise. The syntax looks like this: +Uma promessa em JavaScript é exatamente o que parece - você faz a promessa de que irá fazer uma tarefa, geralmente de forma assíncrona. Quando a tarefa é finalizada, ou você cumpriu a promessa ou falhou ao tentar. Por ser uma função construtora, você precisa utilizar a palavra-chave `new` para criar uma `Promise`. Ele recebe uma função, como seu arguemento, com dois parâmetros - `resolve` e `reject`. Esses métodos são usados para determinar o resultado da promessa. A sintaxe se parecesse com isso: ```js const myPromise = new Promise((resolve, reject) => { @@ -18,17 +18,17 @@ const myPromise = new Promise((resolve, reject) => { # --instructions-- -Create a new promise called `makeServerRequest`. Pass in a function with `resolve` and `reject` parameters to the constructor. +Crie uma nova promessa chamada `makeServerRequest`. No construtor da promessa, passe uma função com os parâmetros `resolve` e `reject`. # --hints-- -You should assign a promise to a declared variable named `makeServerRequest`. +Você deve atribuir a promessa a uma variável chamada `makeServerRequest`. ```js assert(makeServerRequest instanceof Promise); ``` -Your promise should receive a function with `resolve` and `reject` as parameters. +A promessa deve receber uma função com os parâmetros `resolve` e `reject`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md index 30959b42a3..ced01f2331 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md @@ -1,6 +1,6 @@ --- id: 5cddbfd622f1a59093ec611d -title: Create a Module Script +title: Separar seus scripts em módulos challengeType: 6 forumTopicId: 301198 dashedName: create-a-module-script @@ -8,27 +8,27 @@ dashedName: create-a-module-script # --description-- -JavaScript started with a small role to play on an otherwise mostly HTML web. Today, it’s huge, and some websites are built almost entirely with JavaScript. In order to make JavaScript more modular, clean, and maintainable; ES6 introduced a way to easily share code among JavaScript files. This involves exporting parts of a file for use in one or more other files, and importing the parts you need, where you need them. In order to take advantage of this functionality, you need to create a script in your HTML document with a `type` of `module`. Here’s an example: +O JavaScript nasceu com com o objetivo de cumprir um pequeno papel em uma web onde tudo era, na maior parte, HTML. Hoje, o JavaScript é gigante. Para se ter noção, alguns websites são construídos quase que inteiramente em JavaScript. A fim de tornar o JavaScript mais modular, limpo e passível de manutenção, a versão ES6 introduziu uma forma mais simples de compartilhar códigos entre arquivos JavaScript. Dessa forma, você consegue exportar partes de um arquivo e usá-los em arquivos externos bem como importar as partes que você precisa. Para tirar proveito dessa funcionalidade, você precisa crair uma tag script com o atributo `type` de valor `module` no seu documento HTML. Aqui está um exemplo: ```html ``` -A script that uses this `module` type can now use the `import` and `export` features you will learn about in the upcoming challenges. +O script do exemplo acima agora é um módulo (`module`) e pode usar os recursos `import` e `export` (você aprenderá sobre eles nos próximos desafios). # --instructions-- -Add a script to the HTML document of type `module` and give it the source file of `index.js` +Adicione uma tag script ao documento HTML do tipo `module` e dê a ela o caminho do arquivo `index.js` # --hints-- -You should create a `script` tag. +Você deve criar uma tag `script`. ```js assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); ``` -Your `script` tag should have the `type` attribute with a value of `module`. +A tag `script` deve ter o atributo `type` com o valor `module`. ```js assert( @@ -38,7 +38,7 @@ assert( ); ``` -Your `script` tag should have a `src` of `index.js`. +A tag `script` deve ter o atributo `src` com o valor `index.js`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md index 0f4d9c3390..12b00c4def 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md @@ -1,6 +1,6 @@ --- id: 587d7b8c367417b2b2512b58 -title: Create an Export Fallback with export default +title: Exportar apenas um valor com export default challengeType: 1 forumTopicId: 301199 dashedName: create-an-export-fallback-with-export-default @@ -8,11 +8,11 @@ dashedName: create-an-export-fallback-with-export-default # --description-- -In the `export` lesson, you learned about the syntax referred to as a named export. This allowed you to make multiple functions and variables available for use in other files. +Na lição de `export` você aprendeu sobre a sintaxe que chamamos de exportação nomeada. Naquela lição você exportou múltiplas funções e variáveis que ficaram disponíveis para utilização em outros arquivos. -There is another `export` syntax you need to know, known as export default. Usually you will use this syntax if only one value is being exported from a file. It is also used to create a fallback value for a file or module. +Há outra sintaxe para `export` que você precisa saber, conhecida como exportação padrão. Você usará essa sintaxe quando apenas um valor estiver sendo exportado de um arquivo ou módulo. Essa sintaxe também é usada para exportar um valor substituto caso o valor original não possa ser exportado. -Below are examples using `export default`: +Abaixo estão exemplos utilizando a sintaxe `export default`: ```js export default function add(x, y) { @@ -24,17 +24,17 @@ export default function(x, y) { } ``` -The first is a named function, and the second is an anonymous function. +O primeiro exemplo é uma função nomeada e o segundo é uma função anônima. -Since `export default` is used to declare a fallback value for a module or file, you can only have one value be a default export in each module or file. Additionally, you cannot use `export default` with `var`, `let`, or `const` +A sintaxe `export default` é usada para exportar um único valor de um arquivo ou módulo. Tenha em mente que você não pode usar o `export default` com `var`, `let` ou `const` # --instructions-- -The following function should be the fallback value for the module. Please add the necessary code to do so. +A função a seguir deve ser o único valor a ser exportado. Adicione o código necessário para que apenas um valor seja exportado. # --hints-- -Your code should use an `export` fallback. +Você deve usar a sintaxe alternativa ao `export`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md index 870716c3ec..2ad6be8816 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md @@ -1,6 +1,6 @@ --- id: 587d7b8a367417b2b2512b4e -title: Create Strings using Template Literals +title: Criar Strings usando Template Literals challengeType: 1 forumTopicId: 301200 dashedName: create-strings-using-template-literals @@ -8,11 +8,11 @@ dashedName: create-strings-using-template-literals # --description-- -A new feature of ES6 is the template literal. This is a special type of string that makes creating complex strings easier. +Um novo recurso introduzido na versão ES6 é o template literal. Esse é um tipo especial de string que torna mais fácil a criação de strings complexas. -Template literals allow you to create multi-line strings and to use string interpolation features to create strings. +Template literals nos permite criar strings de mais de uma linha e usar os recursos de interpolação de strings. -Consider the code below: +Considere o código abaixo: ```js const person = { @@ -26,15 +26,15 @@ I am ${person.age} years old.`; console.log(greeting); ``` -The console will display the strings `Hello, my name is Zodiac Hasbro!` and `I am 56 years old.`. +O console irá exibir as strings `Hello, my name is Zodiac Hasbro!` e `I am 56 years old.`. -A lot of things happened there. Firstly, the example uses backticks (`` ` ``), not quotes (`'` or `"`), to wrap the string. Secondly, notice that the string is multi-line, both in the code and the output. This saves inserting `\n` within strings. The `${variable}` syntax used above is a placeholder. Basically, you won't have to use concatenation with the `+` operator anymore. To add variables to strings, you just drop the variable in a template string and wrap it with `${` and `}`. Similarly, you can include other expressions in your string literal, for example `${a + b}`. This new way of creating strings gives you more flexibility to create robust strings. +Muitas coisas aconteceram aqui. Primeiro, o exemplo utiliza crases, ou backticks em Inglês, (`` ` ``), ao invés de aspas (`'` ou `"`), ao redor da string. Segundo, note que a string tem mais de uma linha, tanto no código quanto na saída. Isso torna desnecessário inserir `\n` dentro das strings. A sintaxe `${variable}` usada acima é um espaço reservado (placeholder). Basicamente, você não terá mais que usar concatenação com o operador `+`. Para adicionar o valor de uma variável à string, você a envolve com `${` e `}`. Além de poder usar variáveis, você pode incluir outras expressões. Como por exemplo `${a + b}`. Essa nova maneira de criar strings te dá mais flexibilidade na hora de criar string complexas. # --instructions-- -Use template literal syntax with backticks to create an array of list element (`li`) strings. Each list element's text should be one of the array elements from the `failure` property on the `result` object and have a `class` attribute with the value `text-warning`. The `makeList` function should return the array of list item strings. +Use a sintaxe de template literal com crases para criar um array de strings de elementos de lista (`li`). Analise a propriedade `failure` do objeto `result`. O texto de cada elemento li deve ser um dos elementos contidos no array dentro da propriedade failure e cada li deve ter o atributo `class` com o valor `text-warning`. A função `makeList` deve retornar um array de strings de elementos li. -Use an iterator method (any kind of loop) to get the desired output (shown below). +Abaixo está um exemplo do array que você deve criar. Use um loop para criar o mesmo resultado. ```js [ @@ -46,7 +46,7 @@ Use an iterator method (any kind of loop) to get the desired output (shown below # --hints-- -`failuresList` should be an array containing `result failure` messages. +A variável `failuresList` deve ser um array contendo as mensagens de `result failure`. ```js assert( @@ -54,7 +54,7 @@ assert( ); ``` -`failuresList` should be equal to the specified output. +A variável `failuresList` deve ser igual ao array mostrado anteriormente. ```js assert( @@ -66,13 +66,13 @@ assert( ); ``` -Template strings and expression interpolation should be used. +Template strings e interpolação de expressões - ${} - devem ser usados. ```js (getUserInput) => assert(getUserInput('index').match(/(`.*\${.*}.*`)/)); ``` -An iterator should be used. +Você deve usar um loop. ```js (getUserInput) => diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.md index 39359d0a32..8f34a27de4 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.md @@ -1,6 +1,6 @@ --- id: 587d7b87367417b2b2512b41 -title: Declare a Read-Only Variable with the const Keyword +title: Declare variáveis somente de leitura com a palavra-chave const challengeType: 1 forumTopicId: 301201 dashedName: declare-a-read-only-variable-with-the-const-keyword @@ -8,46 +8,46 @@ dashedName: declare-a-read-only-variable-with-the-const-keyword # --description-- -The keyword `let` is not the only new way to declare variables. In ES6, you can also declare variables using the `const` keyword. +A palavra-chave `let` não é a única nova forma de declarar variáveis. Na versão ES6, você também pode declarar variáveis usando a palavra-chave `const`. -`const` has all the awesome features that `let` has, with the added bonus that variables declared using `const` are read-only. They are a constant value, which means that once a variable is assigned with `const`, it cannot be reassigned. +`const` possui todos os recursos maravilhosos que `let` tem, com o bônus adicional que variáveis declaradas usando `const` são somente de leitura. Eles são um valor constante, o que significa que uma vez que a variável é atribuída com `const`, não pode ser atribuída novamente. ```js const FAV_PET = "Cats"; FAV_PET = "Dogs"; ``` -The console will display an error due to reassigning the value of `FAV_PET`. +O console irá exibir um erro devido à reatribuição do valor de `FAV_PET`. -As you can see, trying to reassign a variable declared with `const` will throw an error. You should always name variables you don't want to reassign using the `const` keyword. This helps when you accidentally attempt to reassign a variable that is meant to stay constant. A common practice when naming constants is to use all uppercase letters, with words separated by an underscore. +Como você pode ver, tentar reatribuir uma variável declarada com `const` lançará um erro. Você sempre deve nomear variáveis que você não quer reatribuir, usando a palavra-chave `const`. Isso ajuda quando você acidentalmente tenta reatribuir uma variável que deveria ser constante. Uma prática comum ao nomear constantes é colocar todas as letras em maiúsculas, com palavras separadas por sublinhado (underscore ou underline). -**Note:** It is common for developers to use uppercase variable identifiers for immutable values and lowercase or camelCase for mutable values (objects and arrays). In a later challenge you will see an example of a lowercase variable identifier being used for an array. +**Observação:** É comum que os desenvolvedores usem nomes de variáveis maiúsculas para valores imutáveis e minúsculas ou camelCase para valores mutáveis (objetos e arrays). Em um desafio posterior, você verá um exemplo de um nome de variável em minúsculo usado para um array. # --instructions-- -Change the code so that all variables are declared using `let` or `const`. Use `let` when you want the variable to change, and `const` when you want the variable to remain constant. Also, rename variables declared with `const` to conform to common practices, meaning constants should be in all caps. +Altere o código para que todas as variáveis sejam declaradas usando `let` ou `const`. Use `let` quando você quiser que a variável mude e `const` quando você quiser que a variável permaneça constante. Além disso, renomeie as variáveis declaradas com `const` para estar em conformidade com as práticas comuns, o que significa que constantes devem ter todas as letras em maiúsculo. # --hints-- -`var` should not exist in your code. +`var` não deve existir no seu código. ```js (getUserInput) => assert(!getUserInput('index').match(/var/g)); ``` -`SENTENCE` should be a constant variable declared with `const`. +`SENTENCE` deve ser uma variável constante declarada com `const`. ```js (getUserInput) => assert(getUserInput('index').match(/(const SENTENCE)/g)); ``` -`i` should be declared with `let`. +A variável `i` deve ser declarada com `let`. ```js (getUserInput) => assert(getUserInput('index').match(/(let i)/g)); ``` -`console.log` should be changed to print the `SENTENCE` variable. +`console.log` deve ser alterado para imprimir a variável `SENTENCE`. ```js (getUserInput) => diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/explore-differences-between-the-var-and-let-keywords.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/explore-differences-between-the-var-and-let-keywords.md index f422b8c67b..f66ff77277 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/explore-differences-between-the-var-and-let-keywords.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/explore-differences-between-the-var-and-let-keywords.md @@ -1,6 +1,6 @@ --- id: 587d7b87367417b2b2512b3f -title: Explore Differences Between the var and let Keywords +title: Diferenças entre as palavras-chave var e let challengeType: 1 forumTopicId: 301202 dashedName: explore-differences-between-the-var-and-let-keywords @@ -8,7 +8,7 @@ dashedName: explore-differences-between-the-var-and-let-keywords # --description-- -One of the biggest problems with declaring variables with the `var` keyword is that you can overwrite variable declarations without an error. +Um dos maiores problemas ao declarar variáveis com a palavra-chave `var` é que você pode sobrescrever a declaração da variável sem perceber. ```js var camper = 'James'; @@ -16,44 +16,44 @@ var camper = 'David'; console.log(camper); ``` -Here the console will display the string `David`. +Aqui o console irá exibir a string `David`. -As you can see in the code above, the `camper` variable is originally declared as `James` and then overridden to be `David`. In a small application, you might not run into this type of problem, but when your code becomes larger, you might accidentally overwrite a variable that you did not intend to overwrite. Because this behavior does not throw an error, searching and fixing bugs becomes more difficult. -A new keyword called `let` was introduced in ES6 to solve this potential issue with the `var` keyword. If you were to replace `var` with `let` in the variable declarations of the code above, the result would be an error. +Como você pode ver no código acima, a variável `camper` é originalmente declarada com o valor `James` e então substituída pelo valor `David`. Em uma aplicação pequena, você pode não encontrar esse tipo de problema, mas quando seu código se tornar maior, você pode acidentalmente sobrescrever uma variável que você não tinha a intenção. Como esse comportamente não lança nenhum erro, procurar e corrigir bugs se torna mais difícil. +Para resolver esse potencial problema com a palavra-chave `var`, uma nova palavra-chave chamada `let` foi introduzida no ES6. Se você tentar substituir `var` por `let` nas declarações de variável do código acima, o resultado será um erro. ```js let camper = 'James'; let camper = 'David'; ``` -This error can be seen in the console of your browser. So unlike `var`, when using `let`, a variable with the same name can only be declared once. Note the `"use strict"`. This enables Strict Mode, which catches common coding mistakes and "unsafe" actions. For instance: +Esse erro pode ser visto no console do seu navegador. Então, diferente de `var`, ao usar `let`, uma variável com o mesmo nome só pode ser declarada uma única vez. Note o `"use strict"`. Isso habilita o Modo Estrito, o qual captura erros de codificação comum e ações "não seguras". Por exemplo: ```js "use strict"; x = 3.14; ``` -This will display an error that `x is not defined`. +O ´codigo acima irá exibir o erro: `x is not defined`. # --instructions-- -Update the code so it only uses the `let` keyword. +Atualize o código para que apenas a palavra-chave `let` seja usada. # --hints-- -`var` should not exist in the code. +A palavra-chave `var` não deve existir no código. ```js (getUserInput) => assert(!getUserInput('index').match(/var/g)); ``` -`catName` should be the string `Oliver`. +A variável `catName` deve ser uma string de valor `Oliver`. ```js assert(catName === 'Oliver'); ``` -`quote` should be the string `Oliver says Meow!` +A variável `quote` deve ser uma string de valor `Oliver says Meow!` ```js assert(quote === 'Oliver says Meow!'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index 1a3c81bd73..0fa1241f2c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -1,6 +1,6 @@ --- id: 5cdafbd72913098997531681 -title: Handle a Fulfilled Promise with then +title: Manipular uma promessa cumprida usando o then challengeType: 1 forumTopicId: 301203 dashedName: handle-a-fulfilled-promise-with-then @@ -8,7 +8,7 @@ dashedName: handle-a-fulfilled-promise-with-then # --description-- -Promises are most useful when you have a process that takes an unknown amount of time in your code (i.e. something asynchronous), often a server request. When you make a server request it takes some amount of time, and after it completes you usually want to do something with the response from the server. This can be achieved by using the `then` method. The `then` method is executed immediately after your promise is fulfilled with `resolve`. Here’s an example: +Promessas são úteis quando você tem um processo que leva uma quantidade de tempo desconhecido para ser finalizado (ou seja, algo assíncrono). Muitas vezes, uma requisição a um servidor. Fazer uma requisição a um servidor leva tempo, e após a requisição ser finalizada, você geralmente quer fazer algo com a resposta retornada. Isso pode ser feito usando o método `then`. O método `then` é executado imediatamente após a promessa ser cumprida com `resolve`. Aqui está um exemplo: ```js myPromise.then(result => { @@ -16,15 +16,15 @@ myPromise.then(result => { }); ``` -`result` comes from the argument given to the `resolve` method. +O parâmetro `result` vem do argumento dado ao método `resolve`. # --instructions-- -Add the `then` method to your promise. Use `result` as the parameter of its callback function and log `result` to the console. +Adicione o método `then` à sua promessa. Use `result` como parâmetro de sua função de callback e exiba `result` no console. # --hints-- -You should call the `then` method on the promise. +Você deve chamar o método `then` na promessa. ```js assert( @@ -32,13 +32,13 @@ assert( ); ``` -Your `then` method should have a callback function with `result` as its parameter. +O método `then` deve ter uma função de callback com `result` como seu parâmetro. ```js assert(resultIsParameter); ``` -You should log `result` to the console. +Você deve exibir o valor do parâmetro `result` no console. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index 9cf7ab1146..a72dd0a023 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -1,6 +1,6 @@ --- id: 5cdafbe72913098997531682 -title: Handle a Rejected Promise with catch +title: Manipular uma promessa rejeitada usando o catch challengeType: 1 forumTopicId: 301204 dashedName: handle-a-rejected-promise-with-catch @@ -8,7 +8,7 @@ dashedName: handle-a-rejected-promise-with-catch # --description-- -`catch` is the method used when your promise has been rejected. It is executed immediately after a promise's `reject` method is called. Here’s the syntax: +`catch` é o método usado quando a promessa é rejeitada. Ele é executada imediatamente após o método `reject` da promessa ser chamado. Aqui está a sintaxe: ```js myPromise.catch(error => { @@ -16,15 +16,15 @@ myPromise.catch(error => { }); ``` -`error` is the argument passed in to the `reject` method. +O parâmetro `error` é o argumento passado para o método `reject`. # --instructions-- -Add the `catch` method to your promise. Use `error` as the parameter of its callback function and log `error` to the console. +Adicione o método `catch` à sua promessa. Use `error` como parâmetro de sua função de callback e exiba o valor de `error` no console. # --hints-- -You should call the `catch` method on the promise. +Você deve chamar o método `catch` na promessa. ```js assert( @@ -32,13 +32,13 @@ assert( ); ``` -Your `catch` method should have a callback function with `error` as its parameter. +O método `catch` deve ter uma função de callback com `error` como seu parâmetro. ```js assert(errorIsParameter); ``` -You should log `error` to the console. +Você deve exibir o valor de `error` no console. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index d8a0a3d465..7d43294fe1 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -1,6 +1,6 @@ --- id: 587d7b8d367417b2b2512b59 -title: Import a Default Export +title: Importar uma exportação padrão challengeType: 1 forumTopicId: 301205 dashedName: import-a-default-export @@ -8,21 +8,21 @@ dashedName: import-a-default-export # --description-- -In the last challenge, you learned about `export default` and its uses. To import a default export, you need to use a different `import` syntax. In the following example, `add` is the default export of the `math_functions.js` file. Here is how to import it: +No último desafio, você aprendeu sobre `export default` e seus usos. Para importar uma exportação padrão, você precisa usar uma sintaxe diferente de `import`. No exemplo a seguir, `add` é a exportação padrão do arquivo `math_functions.js`. Veja como importá-lo: ```js import add from "./math_functions.js"; ``` -The syntax differs in one key place. The imported value, `add`, is not surrounded by curly braces (`{}`). `add` here is simply a variable name for whatever the default export of the `math_functions.js` file is. You can use any name here when importing a default. +A sintaxe é diferente em apenas um ponto. O valor importado, `add`, não está rodeado por chaves (`{}`). Aqui, `add` é simplesmente uma palavra qualquer que irá ser usada para identificar a variável sendo exportada do arquivo `math_functions.js`. Você pode usar qualquer nome ao importar algo que foi exportado como padrão. # --instructions-- -In the following code, import the default export from the `math_functions.js` file, found in the same directory as this file. Give the import the name `subtract`. +No código a seguir, importe a exportação padrão do arquivo `math_functions.js` encontrado no mesmo diretório do arquivo que foi usado como exemplo. Dê a importação o nome `subtract`. # --hints-- -You should properly import `subtract` from `math_functions.js`. +A única coisa que você precisa fazer é importar `subtract` do arquivo `math_functions.js`. ```js assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md index 5f987eab1a..baf91e385e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md @@ -1,6 +1,6 @@ --- id: 587d7b87367417b2b2512b42 -title: Mutate an Array Declared with const +title: Modificar um array declarado com const challengeType: 1 forumTopicId: 301206 dashedName: mutate-an-array-declared-with-const @@ -8,11 +8,11 @@ dashedName: mutate-an-array-declared-with-const # --description-- -The `const` declaration has many use cases in modern JavaScript. +Variáveis declaradas com `const` têm muitos casos de uso no JavaScript moderno. -Some developers prefer to assign all their variables using `const` by default, unless they know they will need to reassign the value. Only in that case, they use `let`. +Alguns desenvolvedores preferem criar todas suas variáveis usando `const`, a menos que eles saibam que irão precisar reatribuir o valor. Apenas nesse caso, eles usam `let`. -However, it is important to understand that objects (including arrays and functions) assigned to a variable using `const` are still mutable. Using the `const` declaration only prevents reassignment of the variable identifier. +No entanto, é importante entender que objetos (incluindo arrays e funções) atribuídos a uma variável usando `const` ainda são mutáveis. Usar a declaração `const` só impede a reatribuição do identificador (nome) da variável. ```js const s = [5, 6, 7]; @@ -21,29 +21,29 @@ s[2] = 45; console.log(s); ``` -`s = [1, 2, 3]` will result in an error. The `console.log` will display the value `[5, 6, 45]`. +`s = [1, 2, 3]` resultará em um erro. `console.log` exibirá o valor `[5, 6, 45]`. -As you can see, you can mutate the object `[5, 6, 7]` itself and the variable `s` will still point to the altered array `[5, 6, 45]`. Like all arrays, the array elements in `s` are mutable, but because `const` was used, you cannot use the variable identifier `s` to point to a different array using the assignment operator. +Como você pode ver, você pode alterar o objeto `[5, 6, 7]` e a variável `s` ainda apontará para o array alterado `[5, 6, 45]`. Assim como em qualquer outro array, os elementos dentro de `s` também são mutáveis. Mas como `const` foi usado, você não pode usar o identificador da variável `s` para apontar para uma matriz diferente (ou qualquer outro valor) usando o operador de atribuição. # --instructions-- -An array is declared as `const s = [5, 7, 2]`. Change the array to `[2, 5, 7]` using various element assignments. +Um array é declarado: `const s = [5, 7, 2]`. Modifique o array para `[2, 5, 7]` usando várias atribuições de elementos. # --hints-- -You should not replace `const` keyword. +Você não deve substituir a palavra-chave `const`. ```js (getUserInput) => assert(getUserInput('index').match(/const/g)); ``` -`s` should be a constant variable (by using `const`). +`s` deve ser uma variável constante (use `const`). ```js (getUserInput) => assert(getUserInput('index').match(/const\s+s/g)); ``` -You should not change the original array declaration. +Você não deve alterar modificar o array original manualmente. ```js (getUserInput) => @@ -54,7 +54,7 @@ You should not change the original array declaration. ); ``` -`s` should be equal to `[2, 5, 7]`. +A variável `s` deve ser igual a `[2, 5, 7]`. ```js assert.deepEqual(s, [2, 5, 7]); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md index 0161194fda..6ab60aec08 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md @@ -1,6 +1,6 @@ --- id: 598f48a36c8c40764b4e52b3 -title: Prevent Object Mutation +title: Impedir a modificação de um objeto challengeType: 1 forumTopicId: 301207 dashedName: prevent-object-mutation @@ -8,9 +8,9 @@ dashedName: prevent-object-mutation # --description-- -As seen in the previous challenge, `const` declaration alone doesn't really protect your data from mutation. To ensure your data doesn't change, JavaScript provides a function `Object.freeze` to prevent data mutation. +Como visto no desafio anterior, a declaração `const` sozinha, na verdade, não protege a mutação de seus dados. Para garantir que seus dados não mudem, o JavaScript fornece a função `Object.freeze` que previne os dados de serem modificados. -Once the object is frozen, you can no longer add, update, or delete properties from it. Any attempt at changing the object will be rejected without an error. +Uma vez congelado, você não pode mais adicionar, atualizar ou deletar as propriedades deste objeto. Qualquer tentativa de mudar o objeto será rejeitada. Observe que nenhum erro é lançado. ```js let obj = { @@ -23,28 +23,28 @@ obj.newProp = "Test"; console.log(obj); ``` -The `obj.review` and `obj.newProp` assignments will result in errors, and the console will display the value `{ name: "FreeCodeCamp", review: "Awesome" }`. +As atribuições `obj.review` e `obj.newProp` não irão funcionar e o console irá exibir o valor `{ name: "FreeCodeCamp", review: "Awesome" }`. # --instructions-- -In this challenge you are going to use `Object.freeze` to prevent mathematical constants from changing. You need to freeze the `MATH_CONSTANTS` object so that no one is able to alter the value of `PI`, add, or delete properties. +Nesse desafio, você usará o método `Object.freeze` para prevenir a mudança de constantes matemáticas. Você precisa congelar o objeto `MATH_CONSTANTS` para que ninguém possa alterar o valor de `PI`, adicionar ou deletar propriedades. # --hints-- -You should not replace the `const` keyword. +Você não deve substituir a palavra-chave `const`. ```js (getUserInput) => assert(getUserInput('index').match(/const/g)); ``` -`MATH_CONSTANTS` should be a constant variable (by using `const`). +`MATH_CONSTANTS` deve ser uma variável constante (use `const`). ```js (getUserInput) => assert(getUserInput('index').match(/const\s+MATH_CONSTANTS/g)); ``` -You should not change the original declaration of `MATH_CONSTANTS`. +Você não deve alterar a declaração original de `MATH_CONSTANTS`. ```js (getUserInput) => @@ -55,7 +55,7 @@ You should not change the original declaration of `MATH_CONSTANTS`. ); ``` -`PI` should equal `3.14`. +A variável `PI` deve ser igual a `3.14`. ```js assert(PI === 3.14); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index ff3449dd2f..9893b8cedb 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -1,6 +1,6 @@ --- id: 587d7b8c367417b2b2512b55 -title: Reuse JavaScript Code Using import +title: Reutilizar código JavaScript usando import challengeType: 1 forumTopicId: 301208 dashedName: reuse-javascript-code-using-import @@ -8,15 +8,15 @@ dashedName: reuse-javascript-code-using-import # --description-- -`import` allows you to choose which parts of a file or module to load. In the previous lesson, the examples exported `add` from the `math_functions.js` file. Here's how you can import it to use in another file: +`import` te permite escolher quais partes carregar de um arquivo ou módulo. Na lição anterior, os exemplos exportaram a função `add` do arquivo `math_functions.js`. Você pode importá-la e usá-la em outro arquivo assim: ```js import { add } from './math_functions.js'; ``` -Here, `import` will find `add` in `math_functions.js`, import just that function for you to use, and ignore the rest. The `./` tells the import to look for the `math_functions.js` file in the same folder as the current file. The relative file path (`./`) and file extension (`.js`) are required when using import in this way. +Aqui, `import` irá encontrar a função `add` no arquivo `math_functions.js`, importar apenas essa função e ignorar o resto. O `./` diz ao import para procurar pelo arquivo `math_functions.js` no mesmo diretório que o arquivo atual. O caminho relativo do arquivo (`./`) e a extensão do arquivo (`.js`) são necessários ao usar import dessa forma. -You can import more than one item from the file by adding them in the `import` statement like this: +Você pode importar mais de um item do arquivo ao adicioná-los na instrução `import` dessa forma: ```js import { add, subtract } from './math_functions.js'; @@ -24,11 +24,11 @@ import { add, subtract } from './math_functions.js'; # --instructions-- -Add the appropriate `import` statement that will allow the current file to use the `uppercaseString` and `lowercaseString` functions you exported in the previous lesson. These functions are in a file called `string_functions.js`, which is in the same directory as the current file. +Adicione a instrução `import` apropriada que permitirá o arquivo atual usar as funções `uppercaseString` e `lowercaseString` que você exportou na lição anterior. As funções estão em um arquivo chamado `string_functions.js`, o qual está no mesmo diretório que o arquivo atual. # --hints-- -You should properly import `uppercaseString`. +Você deve importar a função `uppercaseString`. ```js assert( @@ -38,7 +38,7 @@ assert( ); ``` -You should properly import `lowercaseString`. +Você deve importar a função `lowercaseString`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index 0bb3fd12f2..25d018bb1d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -1,6 +1,6 @@ --- id: 587d7b88367417b2b2512b46 -title: Set Default Parameters for Your Functions +title: Definir um valor padrão para o parâmetro de uma função challengeType: 1 forumTopicId: 301209 dashedName: set-default-parameters-for-your-functions @@ -8,9 +8,9 @@ dashedName: set-default-parameters-for-your-functions # --description-- -In order to help us create more flexible functions, ES6 introduces default parameters for functions. +Para nos ajudar a criar funções mais flexíveis, a versão ES6 introduziu os parâmetros padrão para funções. -Check out this code: +Confira este código: ```js const greeting = (name = "Anonymous") => "Hello " + name; @@ -19,29 +19,29 @@ console.log(greeting("John")); console.log(greeting()); ``` -The console will display the strings `Hello John` and `Hello Anonymous`. +O console exibirá as strings `Hello John` e `Hello Anonymous`. -The default parameter kicks in when the argument is not specified (it is undefined). As you can see in the example above, the parameter `name` will receive its default value `Anonymous` when you do not provide a value for the parameter. You can add default values for as many parameters as you want. +O parâmetro padrão é usado quando o argumento não é especificado (ele não é definido). Como você pode ver no exemplo acima, o parâmetro `name` receberá o valor padrão `Anonymous` quando você não fornecer um valor para o parâmetro. Você pode adicionar valores padrão para quantos parâmetros quiser. # --instructions-- -Modify the function `increment` by adding default parameters so that it will add 1 to `number` if `value` is not specified. +Modifique a função `increment` adicionando parâmetros padrão para que ela adicione 1 à variável `number` se o parâmetro `value` não for especificado. # --hints-- -The result of `increment(5, 2)` should be `7`. +O resultado de `increment(5, 2)` deve ser `7`. ```js assert(increment(5, 2) === 7); ``` -The result of `increment(5)` should be `6`. +O resultado de `increment(5)` deve ser `6`. ```js assert(increment(5) === 6); ``` -A default parameter value of `1` should be used for `value`. +O parâmetro padrão (`value`) deve receber o valor `1`. ```js assert(code.match(/value\s*=\s*1/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md index c990788c45..f4b8ff4796 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md @@ -1,6 +1,6 @@ --- id: 587d7b8c367417b2b2512b57 -title: Use * to Import Everything from a File +title: Use * para importar tudo de um arquivo challengeType: 1 forumTopicId: 301210 dashedName: use--to-import-everything-from-a-file @@ -8,13 +8,13 @@ dashedName: use--to-import-everything-from-a-file # --description-- -Suppose you have a file and you wish to import all of its contents into the current file. This can be done with the `import * as` syntax. Here's an example where the contents of a file named `math_functions.js` are imported into a file in the same directory: +Suponha que você tem um arquivo e deseja importar todo o conteúdo dele no arquivo atual. Isso pode ser feito com a sintaxe `import * as`. Aqui está um exemplo onde todo o conteúdo de um arquivo chamado `math_function.js` é importado em um arquivo no mesmo diretório: ```js import * as myMathModule from "./math_functions.js"; ``` -The above `import` statement will create an object called `myMathModule`. This is just a variable name, you can name it anything. The object will contain all of the exports from `math_functions.js` in it, so you can access the functions like you would any other object property. Here's how you can use the `add` and `subtract` functions that were imported: +A instrução `import` acima criará um objeto chamado `myMathModule`. Esse nome é totalmente arbitrário. Você pode escolher qualquer outro nome que seja apropriado para sua aplicação. O objeto conterá todas as exportações do arquivo `math_functions.js`. Dessa forma, você pode acessar as funções exportadas da mesma forma que você acessa as propriedades de um objeto. Aqui está um exemplo de como você pode usar as funções `add` e `subtract` que foram importadas: ```js myMathModule.add(2,3); @@ -23,11 +23,11 @@ myMathModule.subtract(5,3); # --instructions-- -The code in this file requires the contents of the file: `string_functions.js`, that is in the same directory as the current file. Use the `import * as` syntax to import everything from the file into an object called `stringFunctions`. +O código nesse desafio requer o conteúdo do arquivo: `string_functions.js`, o qual está no mesmo diretório que o arquivo atual. Use a sintaxe `import * as` para importar tudo do arquivo em um objeto chamado `stringFunctions`. # --hints-- -Your code should properly use `import * as` syntax. +Você deve usar a sintaxe `import * as`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions.md index bcf4507370..ccc7ca3107 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions.md @@ -1,6 +1,6 @@ --- id: 587d7b87367417b2b2512b43 -title: Use Arrow Functions to Write Concise Anonymous Functions +title: Criar funções anônimas com arrow functions challengeType: 1 forumTopicId: 301211 dashedName: use-arrow-functions-to-write-concise-anonymous-functions @@ -8,9 +8,9 @@ dashedName: use-arrow-functions-to-write-concise-anonymous-functions # --description-- -In JavaScript, we often don't need to name our functions, especially when passing a function as an argument to another function. Instead, we create inline functions. We don't need to name these functions because we do not reuse them anywhere else. +No JavaScript, muitas vezes não precisamos nomear nossas funções, especialmente quando passamos uma função como argumento para outra função. Em vez disso, criamos funções anônimas. Como não iremos reutilizar essas funções posteriormente, não precisamos nomeá-las. -To achieve this, we often use the following syntax: +Para fazer isso, geralmente usamos a seguinte sintaxe: ```js const myFunc = function() { @@ -19,7 +19,7 @@ const myFunc = function() { } ``` -ES6 provides us with the syntactic sugar to not have to write anonymous functions this way. Instead, you can use **arrow function syntax**: +ES6 nos fornece um syntatical sugar onde não precisamos escrever funções anônimas como no exemplo acima. Ao invés disso, você pode usar a sintaxe **arrow function**: ```js const myFunc = () => { @@ -28,45 +28,45 @@ const myFunc = () => { } ``` -When there is no function body, and only a return value, arrow function syntax allows you to omit the keyword `return` as well as the brackets surrounding the code. This helps simplify smaller functions into one-line statements: +Quando a função executa apenas uma linha de código ou retorna apenas um valor, a sintaxe de arrow function nos permite omitir a palavra-chave `return` assim como as chaves ao redor do código. Essa abordagem ajuda a criar funções menores em instruções de uma linha: ```js const myFunc = () => "value"; ``` -This code will still return the string `value` by default. +Esse código ainda retornará a string `value` por padrão. # --instructions-- -Rewrite the function assigned to the variable `magic` which returns a `new Date()` to use arrow function syntax. Also, make sure nothing is defined using the keyword `var`. +Rescreva a função atribuída à variável `magic` usando a sintaxe de arrow function. A função deve retornar `new Date()`. Além disso, garanta que nada seja definido usando a palavra-chave `var`. # --hints-- -You should replace the `var` keyword. +Você deve substituir a palavra-chave `var`. ```js (getUserInput) => assert(!getUserInput('index').match(/var/g)); ``` -`magic` should be a constant variable (by using `const`). +A variável `magic` deve ser uma variável constante (use `const`). ```js (getUserInput) => assert(getUserInput('index').match(/const\s+magic/g)); ``` -`magic` should be a `function`. +A variável `magic` deve ser uma `function`. ```js assert(typeof magic === 'function'); ``` -`magic()` should return the correct date. +Ao invocar `magic()`, uma data deve ser retornada. ```js assert(magic().setHours(0, 0, 0, 0) === new Date().setHours(0, 0, 0, 0)); ``` -The `function` keyword should not be used. +A palavra-chave `function` não deve ser usada. ```js (getUserInput) => assert(!getUserInput('index').match(/function/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index 8b847ad5fe..4a038ee3b1 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -1,6 +1,6 @@ --- id: 587d7b8b367417b2b2512b53 -title: Use class Syntax to Define a Constructor Function +title: Use a sintaxe de classe para criar uma função construtora challengeType: 1 forumTopicId: 301212 dashedName: use-class-syntax-to-define-a-constructor-function @@ -8,11 +8,11 @@ dashedName: use-class-syntax-to-define-a-constructor-function # --description-- -ES6 provides a new syntax to create objects, using the class keyword. +ES6 fornece uma nova sintaxe para criar objetos, usando a palavra-chave class. -It should be noted that the `class` syntax is just syntax, and not a full-fledged class-based implementation of an object-oriented paradigm, unlike in languages such as Java, Python, Ruby, etc. +Deve ser notado que a sintaxe `class` é apenas sintaxe, um syntatical sugar. JavaScript ainda não oferece suporte completo ao paradigma orientado a objetos, ao contrário do que acontece em linguagens como Java, Python, Ruby, etc. -In ES5, we usually define a `constructor` function and use the `new` keyword to instantiate an object. +No ES5, geralmente definimos uma função construtora (`constructor` function) e usamos a palavra-chave `new` para instanciar um objeto. ```js var SpaceShuttle = function(targetPlanet){ @@ -21,7 +21,7 @@ var SpaceShuttle = function(targetPlanet){ var zeus = new SpaceShuttle('Jupiter'); ``` -The `class` syntax simply replaces the `constructor` function creation: +A sintaxe `class` simplesmente substitui a criação da função construtora (`constructor`): ```js class SpaceShuttle { @@ -32,21 +32,21 @@ class SpaceShuttle { const zeus = new SpaceShuttle('Jupiter'); ``` -It should be noted that the `class` keyword declares a new function, to which a constructor is added. This constructor is invoked when `new` is called to create a new object. +Deve ser notado que a palavra-chave `class` declara uma nova função, para qual um construtor é adicionado. Esse construtor é invocado quando `new` é chamado na criação de um novo objeto. -**Note:** UpperCamelCase should be used by convention for ES6 class names, as in `SpaceShuttle` used above. +**Observação:** UpperCamelCase (observe a primeira letra de cada palavra em maiúsculo) deve ser usado por convenção para nomes de classe no ES6, como em `SpaceShuttle` usado acima. -The `constructor` method is a special method for creating and initializing an object created with a class. You will learn more about it in the Object Oriented Programming section of the JavaScript Algorithms And Data Structures Certification. +O método `constructor` é um método especial usado para inicializar um objeto criado com uma classe. Você aprenderá mais sobre isso na seção Programação Orientada a Objetos da Certificação de Algoritmos e Estruturas de Dados JavaScript. # --instructions-- -Use the `class` keyword and write a `constructor` to create the `Vegetable` class. +Use a palavra-chave `class` e declare o método `constructor` para criar a classe `Vegetable`. -The `Vegetable` class allows you to create a vegetable object with a property `name` that gets passed to the `constructor`. +A classe `Vegetable` permite criar um objeto vegetal com a propriedade `name` que é passada ao `constructor`. # --hints-- -`Vegetable` should be a `class` with a defined `constructor` method. +`Vegetable` deve ser uma `class` com um método `constructor` definido. ```js assert( @@ -54,13 +54,13 @@ assert( ); ``` -The `class` keyword should be used. +A palavra-chave `class` deve ser usada. ```js assert(code.match(/class/g)); ``` -`Vegetable` should be able to be instantiated. +A classe `Vegetable` deve poder ser instanciada. ```js assert(() => { @@ -69,7 +69,7 @@ assert(() => { }); ``` -`carrot.name` should return `carrot`. +`carrot.name` deve retornar a string `carrot`. ```js assert(carrot.name == 'carrot'); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index 0660373384..89474c3ede 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -1,6 +1,6 @@ --- id: 587d7b89367417b2b2512b4b -title: Use Destructuring Assignment to Assign Variables from Arrays +title: Use Atribuição de Desestruturação para Atribuir Variáveis de Arrays challengeType: 1 forumTopicId: 301213 dashedName: use-destructuring-assignment-to-assign-variables-from-arrays @@ -8,47 +8,47 @@ dashedName: use-destructuring-assignment-to-assign-variables-from-arrays # --description-- -ES6 makes destructuring arrays as easy as destructuring objects. +ES6 torna desestruturar arrays tão fácil quanto desestruturar objetos. -One key difference between the spread operator and array destructuring is that the spread operator unpacks all contents of an array into a comma-separated list. Consequently, you cannot pick or choose which elements you want to assign to variables. +Uma diferença chave entre o operador spread (...) e a desestruturação de array é que o operador spread retira todos os conteúdos de um array e coloca em uma lista com elementos separados por vírgula. Consequentemente, você não pode pegar ou escolher quais elementos você quer atribuir a variáveis. -Destructuring an array lets us do exactly that: +Desestruturar um array nos permite fazer exatamente isso: ```js const [a, b] = [1, 2, 3, 4, 5, 6]; console.log(a, b); ``` -The console will display the values of `a` and `b` as `1, 2`. +O console exibirá os valores de `a` e `b` como `1, 2`. -The variable `a` is assigned the first value of the array, and `b` is assigned the second value of the array. We can also access the value at any index in an array with destructuring by using commas to reach the desired index: +É atribuída à variável `a` o primeiro valor do array, e à variável `b` é atribuído o segundo valor do array. Nós também podemos acessar o valor em qualquer índice de um array com desestruturação ao usar vírgulas para alcançar o índice desejado: ```js const [a, b,,, c] = [1, 2, 3, 4, 5, 6]; console.log(a, b, c); ``` -The console will display the values of `a`, `b`, and `c` as `1, 2, 5`. +O console exibirá os valores de `a`, `b` e `c` como `1, 2, 5`. # --instructions-- -Use destructuring assignment to swap the values of `a` and `b` so that `a` receives the value stored in `b`, and `b` receives the value stored in `a`. +Use atribuição de desestruturação para trocar os valores de `a` e `b` para que `a` receba os valores armazenados em `b` e `b` recebe os valores armazenados em `a`. # --hints-- -The value of `a` should be `6`, after swapping. +O valor de `a` deve ser `6`, após a troca. ```js assert(a === 6); ``` -The value of `b` should be `8`, after swapping. +O valor de `b` deve ser `8`, após a troca. ```js assert(b === 8); ``` -You should use array destructuring to swap `a` and `b`. +Você deve usar desestruturação de array para trocar `a` e `b`. ```js assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index 23f5ff9888..d80d32dca2 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -1,6 +1,6 @@ --- id: 587d7b89367417b2b2512b4a -title: Use Destructuring Assignment to Assign Variables from Nested Objects +title: Use Atribuição de Desestruturação para Atribuir Variáveis de Objetos Aninhados challengeType: 1 forumTopicId: 301214 dashedName: use-destructuring-assignment-to-assign-variables-from-nested-objects @@ -8,9 +8,9 @@ dashedName: use-destructuring-assignment-to-assign-variables-from-nested-objects # --description-- -You can use the same principles from the previous two lessons to destructure values from nested objects. +Você pode usar os mesmos princípios das últimas duas lições para desestruturar valores de objetos aninhados. -Using an object similar to previous examples: +Usando um objeto similar aos exemplos anteriores: ```js const user = { @@ -21,13 +21,13 @@ const user = { }; ``` -Here's how to extract the values of object properties and assign them to variables with the same name: +Aqui está como extrair valores de propriedades de objetos e atribuí-los a variáveis com o mesmo nome: ```js const { johnDoe: { age, email }} = user; ``` -And here's how you can assign an object properties' values to variables with different names: +E aqui está como você pode atribuir o valor de uma propriedade de um objeto para variáveis com nomes diferentes: ```js const { johnDoe: { age: userAge, email: userEmail }} = user; @@ -35,11 +35,11 @@ const { johnDoe: { age: userAge, email: userEmail }} = user; # --instructions-- -Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables `lowToday` and `highToday` the values of `today.low` and `today.high` from the `LOCAL_FORECAST` object. +Substitua as duas atribuições com uma atribuição de desestruturação equivalente. Ainda deve ser atribuído às variáveis `lowToday` e `highToday` os valores de `today.low` e `today.high` do objeto `LOCAL_FORECAST`. # --hints-- -You should remove the ES5 assignment syntax. +Você deve remover a sintaxe de atribuição do ES5. ```js assert( @@ -48,7 +48,7 @@ assert( ); ``` -You should use destructuring to create the `lowToday` variable. +Você deve usar desestruturação para criar a variável `lowToday`. ```js assert( @@ -58,7 +58,7 @@ assert( ); ``` -You should use destructuring to create the `highToday` variable. +Você deve usar desestruturação para criar a variável `highToday`. ```js assert( @@ -68,7 +68,7 @@ assert( ); ``` -`lowToday` should be equal to `64` and `highToday` should be equal to `77`. +`lowToday` deve ser igual a `64` e `highToday` deve ser igual a `77`. ```js assert(lowToday === 64 && highToday === 77); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index a4d5d90073..a06f00caf0 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -1,6 +1,6 @@ --- id: 587d7b89367417b2b2512b49 -title: Use Destructuring Assignment to Assign Variables from Objects +title: Use Atribuição de Desestruturação para Atribuir Variáveis de Objetos challengeType: 1 forumTopicId: 301215 dashedName: use-destructuring-assignment-to-assign-variables-from-objects @@ -8,29 +8,29 @@ dashedName: use-destructuring-assignment-to-assign-variables-from-objects # --description-- -Destructuring allows you to assign a new variable name when extracting values. You can do this by putting the new name after a colon when assigning the value. +Desestruturar o permite atribuir um novo nome de variável quando extrair valores. Você pode fazer isso ao colocar o novo nome após dois pontos quando atribuir o valor. -Using the same object from the last example: +Usando o mesmo objeto do exemplo anterior: ```js const user = { name: 'John Doe', age: 34 }; ``` -Here's how you can give new variable names in the assignment: +Aqui está como você pode dar novos nomes a variáveis na atribuição: ```js const { name: userName, age: userAge } = user; ``` -You may read it as "get the value of `user.name` and assign it to a new variable named `userName`" and so on. The value of `userName` would be the string `John Doe`, and the value of `userAge` would be the number `34`. +Você pode lê-lo como "pegue o valor de `user.name` e atribua-o a uma nova variável chamada `userName`" e assim em diante. O valor de `userName` seria a string `John Doe` e o valor de `userAge` seria o número `34`. # --instructions-- -Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables `highToday` and `highTomorrow` the values of `today` and `tomorrow` from the `HIGH_TEMPERATURES` object. +Substitua as duas atribuições com uma atribuição de desestruturação equivalente. Ainda deve ser atribuído às variáveis `highToday` e `highTomorrow` os valores de `today` e `tomorrow` do objeto `HIGH_TEMPERATURES`. # --hints-- -You should remove the ES5 assignment syntax. +Você deve remover a sintaxe da atribuição ES5. ```js assert( @@ -39,7 +39,7 @@ assert( ); ``` -You should use destructuring to create the `highToday` variable. +Você deve usar desestruturação para criar a variável `highToday`. ```js assert( @@ -49,7 +49,7 @@ assert( ); ``` -You should use destructuring to create the `highTomorrow` variable. +Você deve usar desestruturação para criar a variável `highTomorrow`. ```js assert( @@ -59,7 +59,7 @@ assert( ); ``` -`highToday` should be equal to `77` and `highTomorrow` should be equal to `80`. +`highToday` deve ser igual a `77` e `highTomorrow` deve ser igual a `80`. ```js assert(highToday === 77 && highTomorrow === 80); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 5d71f58348..e4d146a3ce 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -1,6 +1,6 @@ --- id: 5cfa550e84205a357704ccb6 -title: Use Destructuring Assignment to Extract Values from Objects +title: Use Atribuição de Desestruturação para Extrair Valores de Objetos challengeType: 1 forumTopicId: 301216 dashedName: use-destructuring-assignment-to-extract-values-from-objects @@ -8,9 +8,9 @@ dashedName: use-destructuring-assignment-to-extract-values-from-objects # --description-- -Destructuring assignment is special syntax introduced in ES6, for neatly assigning values taken directly from an object. +Atribuição de Desestruturação é uma sintaxe especial introduzida na ES6, para atribuir nitidamente valores retirados diretamente de um objeto. -Consider the following ES5 code: +Considere o seguinte código ES5: ```js const user = { name: 'John Doe', age: 34 }; @@ -19,27 +19,27 @@ const name = user.name; const age = user.age; ``` -`name` would have a value of the string `John Doe`, and `age` would have the number `34`. +`name` teria o valor da string `John Doe` e `age` teria o número `34`. -Here's an equivalent assignment statement using the ES6 destructuring syntax: +Aqui está uma instrução de atribuição equivalente usando a sintaxe de desestruturação ES6: ```js const { name, age } = user; ``` -Again, `name` would have a value of the string `John Doe`, and `age` would have the number `34`. +Novamente, `name` teria o valor da string `John Doe` e `age` teria o número `34`. -Here, the `name` and `age` variables will be created and assigned the values of their respective values from the `user` object. You can see how much cleaner this is. +Aqui, as variáveis `name` e `age` serão criadas e atribuídas a elas os valores de seus respectivos valores do objeto `user`. Você pode ver quão mais limpo é. -You can extract as many or few values from the object as you want. +Você pode extrair quantos valores do objeto quanto você quer. # --instructions-- -Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables `today` and `tomorrow` the values of `today` and `tomorrow` from the `HIGH_TEMPERATURES` object. +Substitua as duas atribuições com a atribuição de desestruturação equivalente. Ainda deve ser atribuído às valores `today` e `tomorrow` os valores de `today` e `tomorrow` do objeto `HIGH_TEMPERATURES`. # --hints-- -You should remove the ES5 assignment syntax. +Você deve remover a sintaxe de atribuição do ES5. ```js assert( @@ -47,7 +47,7 @@ assert( ); ``` -You should use destructuring to create the `today` variable. +Você deve usar desestruturação para criar a variável `today`. ```js assert( @@ -55,7 +55,7 @@ assert( ); ``` -You should use destructuring to create the `tomorrow` variable. +Você deve usar desestruturação para criar a variável `tomorrow`. ```js assert( @@ -63,7 +63,7 @@ assert( ); ``` -`today` should be equal to `77` and `tomorrow` should be equal to `80`. +`today` deve ser igual a `77` e `tomorrow` deve ser igual a `80`. ```js assert(today === 77 && tomorrow === 80); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index 5e5d98d9ad..14931340d0 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -1,6 +1,6 @@ --- id: 587d7b8a367417b2b2512b4d -title: Use Destructuring Assignment to Pass an Object as a Function's Parameters +title: Use Atribuição de Desestruturação para Passar um Objeto como Parâmetro de uma Função challengeType: 1 forumTopicId: 301217 dashedName: use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters @@ -8,9 +8,9 @@ dashedName: use-destructuring-assignment-to-pass-an-object-as-a-functions-parame # --description-- -In some cases, you can destructure the object in a function argument itself. +Em alguns casos, você pode desestruturar um objeto no próprio argumento da função. -Consider the code below: +Considere o código abaixo: ```js const profileUpdate = (profileData) => { @@ -19,7 +19,7 @@ const profileUpdate = (profileData) => { } ``` -This effectively destructures the object sent into the function. This can also be done in-place: +Isso desestrutura efetivamente o objeto enviado para a função. Isso também pode ser feito no lugar: ```js const profileUpdate = ({ name, age, nationality, location }) => { @@ -27,33 +27,33 @@ const profileUpdate = ({ name, age, nationality, location }) => { } ``` -When `profileData` is passed to the above function, the values are destructured from the function parameter for use within the function. +Quando `profileData` é passado para a função acima, os valores são desestruturados do parâmetro da função para ser usado dentro da função. # --instructions-- -Use destructuring assignment within the argument to the function `half` to send only `max` and `min` inside the function. +Use atribuição de desestruturação dentro do argumento para a função `half` para enviar apenas `max` e `min` para dentro da função. # --hints-- -`stats` should be an `object`. +`stats` deve ser um `object`. ```js assert(typeof stats === 'object'); ``` -`half(stats)` should be `28.015` +`half(stats)` deve ser `28.015` ```js assert(half(stats) === 28.015); ``` -Destructuring should be used. +Desestruturação deve ser usado. ```js assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); ``` -Destructured parameter should be used. +Parâmetro desestruturado deve ser usado. ```js assert(!code.match(/stats\.max|stats\.min/)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index 6d170fa01f..e6dcc9f968 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -1,7 +1,7 @@ --- id: 587d7b8a367417b2b2512b4c title: >- - Use Destructuring Assignment with the Rest Parameter to Reassign Array Elements + Use Atribuição de Desestruturação com o Parâmetro Rest para Reatribuir Elementos de Array challengeType: 1 forumTopicId: 301218 dashedName: >- @@ -10,9 +10,9 @@ dashedName: >- # --description-- -In some situations involving array destructuring, we might want to collect the rest of the elements into a separate array. +Em algumas situações envolvendo um array desestruturado, podemos querer coletar o resto dos elementos em um array separado. -The result is similar to `Array.prototype.slice()`, as shown below: +O resultado é similar a `Array.prototype.slice()`, como mostrado abaixo: ```js const [a, b, ...arr] = [1, 2, 3, 4, 5, 7]; @@ -20,35 +20,35 @@ console.log(a, b); console.log(arr); ``` -The console would display the values `1, 2` and `[3, 4, 5, 7]`. +O console exibiria os valores `1, 2` e `[3, 4, 5, 7]`. -Variables `a` and `b` take the first and second values from the array. After that, because of the rest parameter's presence, `arr` gets the rest of the values in the form of an array. The rest element only works correctly as the last variable in the list. As in, you cannot use the rest parameter to catch a subarray that leaves out the last element of the original array. +As variáveis `a` e `b` pegam o primeiro e o segundo valores do array. Após isso, por causa da presença do parâmetro rest, `arr` pega o resto dos valores na forma de um array. O elemento rest só funciona corretamente como a última variável na lista. Como em, você não pode usar o parâmetro rest para capturar um subarray que deixa de fora o último elemento do array original. # --instructions-- -Use destructuring assignment with the rest parameter to perform an effective `Array.prototype.slice()` so that `arr` is a sub-array of the original array `source` with the first two elements omitted. +Use atribuição de desestruturação com o parâmetro rest para executar `Array.prototype.slice()` de forma eficaz para que `arr` seja um sub array do array original `source` com os dois primeiros elementos omitidos. # --hints-- -`arr` should be `[3,4,5,6,7,8,9,10]` +`arr` deve ser `[3,4,5,6,7,8,9,10]` ```js assert(arr.every((v, i) => v === i + 3) && arr.length === 8); ``` -`source` should be `[1,2,3,4,5,6,7,8,9,10]` +`source` deve ser `[1,2,3,4,5,6,7,8,9,10]` ```js assert(source.every((v, i) => v === i + 1) && source.length === 10); ``` -`Array.slice()` should not be used. +`Array.slice()` não deve ser usado. ```js (getUserInput) => assert(!getUserInput('index').match(/slice/g)); ``` -Destructuring on `list` should be used. +Desestruturação na `list` deve ser usada. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index cffcbbe642..6ea14429c6 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -1,6 +1,6 @@ --- id: 587d7b8c367417b2b2512b56 -title: Use export to Share a Code Block +title: Use a exportação para compartilhar um Bloco de Código challengeType: 1 forumTopicId: 301219 dashedName: use-export-to-share-a-code-block @@ -8,7 +8,7 @@ dashedName: use-export-to-share-a-code-block # --description-- -Imagine a file called `math_functions.js` that contains several functions related to mathematical operations. One of them is stored in a variable, `add`, that takes in two numbers and returns their sum. You want to use this function in several different JavaScript files. In order to share it with these other files, you first need to `export` it. +Imagine um arquivo chamado `math_functions.js` que contém várias funções relacionadas a operações matemáticas. Uma delas é armazenada em uma variável, `add`, que recebe dois números e retorna a soma deles. Você quer usar essa função em diversos arquivos JavaScript diferentes. Para compartilhá-las com esses outros arquivos, você primeiro precisa exportá-las (`export`). ```js export const add = (x, y) => { @@ -16,7 +16,7 @@ export const add = (x, y) => { } ``` -The above is a common way to export a single function, but you can achieve the same thing like this: +Acima está uma forma comum de exportar uma única função, mas você pode alcançar a mesma coisa da seguinte forma: ```js const add = (x, y) => { @@ -26,7 +26,7 @@ const add = (x, y) => { export { add }; ``` -When you export a variable or function, you can import it in another file and use it without having to rewrite the code. You can export multiple things by repeating the first example for each thing you want to export, or by placing them all in the export statement of the second example, like this: +Quando você exporta uma variável ou função, você pode importá-las em outro arquivo e usá-las sem ter de rescrever o código. Você pode exportar várias coisas ao repetir o primeiro exemplo para cada coisa que você queira exportar, ou ao colocar todas elas em uma instrução de export do segundo exemplo, da seguinte forma: ```js export { add, subtract }; @@ -34,11 +34,11 @@ export { add, subtract }; # --instructions-- -There are two string-related functions in the editor. Export both of them using the method of your choice. +Há duas funções relacionadas a string no editor. Exporte ambas usando o método de sua escolha. # --hints-- -You should properly export `uppercaseString`. +Você deve exportar corretamente `uppercaseString`. ```js assert( @@ -48,7 +48,7 @@ assert( ); ``` -You should properly export `lowercaseString`. +Você deve exportar corretamente `lowercaseString`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.md index fb25aa95ee..d0123dd66f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.md @@ -1,6 +1,6 @@ --- id: 587d7b8c367417b2b2512b54 -title: Use getters and setters to Control Access to an Object +title: Use getters e setter para Controlar Acesso a um Objeto challengeType: 1 forumTopicId: 301220 dashedName: use-getters-and-setters-to-control-access-to-an-object @@ -8,13 +8,13 @@ dashedName: use-getters-and-setters-to-control-access-to-an-object # --description-- -You can obtain values from an object and set the value of a property within an object. +Você pode obter valores de um objeto e definir o valor da propriedade dentro de um objeto. -These are classically called getters and setters. +Esses são classicamente chamados de getters e setters. -Getter functions are meant to simply return (get) the value of an object's private variable to the user without the user directly accessing the private variable. +Funções getter tem a finalidade de simplesmente retornar (get) o valor de uma variável privada de um objeto para o usuário sem que o usuário acesse diretamente a variável privada. -Setter functions are meant to modify (set) the value of an object's private variable based on the value passed into the setter function. This change could involve calculations, or even overwriting the previous value completely. +Funções setter tem a finalidade de modificar, ou definir (set), o valor de uma variável privada de um objeto baseado no valor passado dentro da função setter. Essa mudança poderia envolver cálculos, ou até sobrescrever completamente o valor anterior. ```js class Book { @@ -36,29 +36,29 @@ novel.writer = 'newAuthor'; console.log(novel.writer); ``` -The console would display the strings `anonymous` and `newAuthor`. +O console exibirá as strings `anonymous` e `newAuthor`. -Notice the syntax used to invoke the getter and setter. They do not even look like functions. Getters and setters are important because they hide internal implementation details. +Note a sintaxe usada para invocar o getter e setter. Eles nem sequer se parecem com funções. Getters e setters são importantes porque escondem os detalhes internos da implementação. -**Note:** It is convention to precede the name of a private variable with an underscore (`_`). However, the practice itself does not make a variable private. +**Nota:** É uma convenção preceder o nome de uma variável privada com um underscore (`_`). No entanto, essa prática por si só não torna uma variável privada. # --instructions-- -Use the `class` keyword to create a `Thermostat` class. The `constructor` accepts a Fahrenheit temperature. +Use a palavra-chave `class` para criar a classe `Thermostat`. O `constructor` aceita uma temperatura Fahrenheit. -In the class, create a `getter` to obtain the temperature in Celsius and a `setter` to set the temperature in Celsius. +Na classe, crie um `getter` para obter a temperatura em Celsius e um `setter` para definir a temperatura em Celsius. -Remember that `C = 5/9 * (F - 32)` and `F = C * 9.0 / 5 + 32`, where `F` is the value of temperature in Fahrenheit, and `C` is the value of the same temperature in Celsius. +Lembre-se que `C = 5/9 * (F - 32)` e `F = C * 9.0 / 5 + 32`, aonde `F` é o valor da temperatura em Fahrenheit e `C` é o valor da mesma temperatura em Celsius. -**Note:** When you implement this, you will track the temperature inside the class in one scale, either Fahrenheit or Celsius. +**Nota:** Quando você implementa isso, você irá rastrar a temperatura dentro da classe em uma escala, ou Fahrenheit ou Celsius. -This is the power of a getter and a setter. You are creating an API for another user, who can get the correct result regardless of which one you track. +Esse é o poder de um getter e um setter. Você está criando uma API para outro uso, que pode pegar o resultado correto independente de qual está rastreando. -In other words, you are abstracting implementation details from the user. +Em outras palavras, você está abstraindo detalhes de implementação do usuário. # --hints-- -`Thermostat` should be a `class` with a defined `constructor` method. +`Thermostat` deve ser uma `class` com um método `constructor` definido. ```js assert( @@ -67,13 +67,13 @@ assert( ); ``` -`class` keyword should be used. +A palavra-chave `class` deve ser usado. ```js assert(code.match(/class/g)); ``` -`Thermostat` should be able to be instantiated. +`Thermostat` deve ser possível de ser instanciado. ```js assert( @@ -84,7 +84,7 @@ assert( ); ``` -When instantiated with a Fahrenheit value, `Thermostat` should set the correct `temperature`. +Quando instanciado com um valor Fahrenheit, `Thermostat` deve definir a `temperature` correta. ```js assert( @@ -95,7 +95,7 @@ assert( ); ``` -A `getter` should be defined. +Um `getter` deve ser definido. ```js assert( @@ -109,7 +109,7 @@ assert( ); ``` -A `setter` should be defined. +Um `setter` deve ser definido. ```js assert( @@ -123,7 +123,7 @@ assert( ); ``` -Calling the `setter` with a Celsius value should set the `temperature`. +Chamando um `setter` com um valor Celsius deve definir a `temperature`. ```js assert( diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index 2f7fe5e546..d4d6a0932a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -1,6 +1,6 @@ --- id: 587d7b88367417b2b2512b47 -title: Use the Rest Parameter with Function Parameters +title: Use o Parâmetro Rest com Parâmetros de Função challengeType: 1 forumTopicId: 301221 dashedName: use-the-rest-parameter-with-function-parameters @@ -8,9 +8,9 @@ dashedName: use-the-rest-parameter-with-function-parameters # --description-- -In order to help us create more flexible functions, ES6 introduces the rest parameter for function parameters. With the rest parameter, you can create functions that take a variable number of arguments. These arguments are stored in an array that can be accessed later from inside the function. +Para nos ajuda a criar funções mais flexíveis, ES6 introduziu o parâmetro rest para parâmetros de funções. Com o parâmetro rest, você pode criar funções que recebem um número variável de argumentos. Esses argumentos são armazenados em um array que pode ser acessado depois dentro da função. -Check out this code: +Verifique esse código: ```js function howMany(...args) { @@ -20,41 +20,41 @@ console.log(howMany(0, 1, 2)); console.log(howMany("string", null, [1, 2, 3], { })); ``` -The console would display the strings `You have passed 3 arguments.` and `You have passed 4 arguments.`. +O console exibiria as strings `You have passed 3 arguments` e `You have passed 4 arguments..

          -The rest parameter eliminates the need to check the `args` array and allows us to apply `map()`, `filter()` and `reduce()` on the parameters array. +

          O parâmetro rest elimina a necessidade de verificar o array args` e nos permite usar `map()`, `filter()` e `reduce()` no array de parâmetros. # --instructions-- -Modify the function `sum` using the rest parameter in such a way that the function `sum` is able to take any number of arguments and return their sum. +Modifique a função `sum` usando o parâmetro rest de tal forma que a função `sum` seja capaz de receber qualquer número de argumentos e retornar a soma deles. # --hints-- -The result of `sum(0,1,2)` should be 3 +O resultado de `sum(0,1,2)` deve ser 3 ```js assert(sum(0, 1, 2) === 3); ``` -The result of `sum(1,2,3,4)` should be 10 +O resultado de `sum(1,2,3,4)` deve ser 10 ```js assert(sum(1, 2, 3, 4) === 10); ``` -The result of `sum(5)` should be 5 +O resultado de `sum(5)` deve ser 5 ```js assert(sum(5) === 5); ``` -The result of `sum()` should be 0 +O resultado de `sum()` deve ser 0 ```js assert(sum() === 0); ``` -`sum` should be an arrow function which uses the rest parameter syntax (`...`) on the `args` parameter. +`sum` deve ser uma arrow function que usa a sintaxe de parâmetro rest (`...`) no parâmetro `args`. ```js assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index d2aa718923..3ceb4ed800 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -1,6 +1,6 @@ --- id: 587d7b89367417b2b2512b48 -title: Use the Spread Operator to Evaluate Arrays In-Place +title: Use o Operador Spread para Avaliar Arrays No Lugar challengeType: 1 forumTopicId: 301222 dashedName: use-the-spread-operator-to-evaluate-arrays-in-place @@ -8,27 +8,27 @@ dashedName: use-the-spread-operator-to-evaluate-arrays-in-place # --description-- -ES6 introduces the spread operator, which allows us to expand arrays and other expressions in places where multiple parameters or elements are expected. +ES6 introduz o operador spread, o qual nos permite expandir arrays e outras expresões no lugar aonde é esperado diversos parâmetros ou elementos. -The ES5 code below uses `apply()` to compute the maximum value in an array: +O código em ES5 abaixo usa `apply()` para calcular o valor máximo de um array: ```js var arr = [6, 89, 3, 45]; var maximus = Math.max.apply(null, arr); ``` -`maximus` would have a value of `89`. +`maximus` teria o valor de `89`. -We had to use `Math.max.apply(null, arr)` because `Math.max(arr)` returns `NaN`. `Math.max()` expects comma-separated arguments, but not an array. The spread operator makes this syntax much better to read and maintain. +Tivemos de usar `Math.max.apply(null, arr)` porque `Math.max(arr)` retorna `NaN`. `Math.max()` espera argumentos separados por vírgula, mas não um array. O operador spread torna essa sintaxe muito mais legível e mais fácil de manter. ```js const arr = [6, 89, 3, 45]; const maximus = Math.max(...arr); ``` -`maximus` would have a value of `89`. +`maximus` teria o valor de `89`. -`...arr` returns an unpacked array. In other words, it *spreads* the array. However, the spread operator only works in-place, like in an argument to a function or in an array literal. The following code will not work: +`...arr` retorna um array descompactado. Em outras palavras, ele *espalha (spreads)* o array. No entanto, o operador spread apenas funciona no local, como em um argumento para uma função ou em um array literal. O código a seguir não funcionará: ```js const spreaded = ...arr; @@ -36,23 +36,23 @@ const spreaded = ...arr; # --instructions-- -Copy all contents of `arr1` into another array `arr2` using the spread operator. +Copie todo o conteúdo de `arr1` em outro array `arr2` usando o operador spread. # --hints-- -`arr2` should be correct copy of `arr1`. +`arr2` deve ser uma cópia correta de `arr1`. ```js assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); ``` -`...` spread operator should be used to duplicate `arr1`. +O operador spread `...` deve ser usado para duplicar `arr1`. ```js assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` -`arr2` should remain unchanged when `arr1` is changed. +`arr2` deve continuar inalterado quando `arr1` é modificado=. ```js assert((arr1, arr2) => { diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md index 1d919e2481..bb5a40ac3c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md @@ -1,6 +1,6 @@ --- id: 587d7b88367417b2b2512b44 -title: Write Arrow Functions with Parameters +title: Escrever Funções de Seta com Parâmetros challengeType: 1 forumTopicId: 301223 dashedName: write-arrow-functions-with-parameters @@ -8,49 +8,49 @@ dashedName: write-arrow-functions-with-parameters # --description-- -Just like a regular function, you can pass arguments into an arrow function. +Assim como uma função normal, você pode passar argumentos para uma função de seta. ```js const doubler = (item) => item * 2; doubler(4); ``` -`doubler(4)` would return the value `8`. +`doubler(4)` retornaria o valor `8`. -If an arrow function has a single parameter, the parentheses enclosing the parameter may be omitted. +Se uma função de seta tiver um único parâmetro, os parênteses envolvendo o parâmetro podem ser omitidos. ```js const doubler = item => item * 2; ``` -It is possible to pass more than one argument into an arrow function. +É possível passar mais de um argumento para uma função de seta. ```js const multiplier = (item, multi) => item * multi; multiplier(4, 2); ``` -`multiplier(4, 2)` would return the value `8`. +`multiplier(4, 2)` retornaria o valor `8`. # --instructions-- -Rewrite the `myConcat` function which appends contents of `arr2` to `arr1` so that the function uses arrow function syntax. +Reescreva a função `myConcat` que anexa conteúdo de `arr2` para `arr1` para que a função use sintaxe de arrow function. # --hints-- -You should replace the `var` keyword. +Você deve substituir a palavra-chave `var`. ```js (getUserInput) => assert(!getUserInput('index').match(/var/g)); ``` -`myConcat` should be a constant variable (by using `const`). +`myConcat` deve ser uma variável constante (usando `const`). ```js (getUserInput) => assert(getUserInput('index').match(/const\s+myConcat/g)); ``` -`myConcat` should be an arrow function with two parameters +`myConcat` deve ser uma função de seta com dois parâmetros ```js assert( @@ -59,13 +59,13 @@ assert( ); ``` -`myConcat()` should return `[1, 2, 3, 4, 5]`. +`meuConcat()` deve retornar `[1, 2, 3, 4, 5]`. ```js assert.deepEqual(myConcat([1, 2], [3, 4, 5]), [1, 2, 3, 4, 5]); ``` -The `function` keyword should not be used. +A palavra-chave `function` não deve ser usada. ```js (getUserInput) => assert(!getUserInput('index').match(/function/g)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 4c319f7bf1..eb4ce715d7 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -1,6 +1,6 @@ --- id: 587d7b8b367417b2b2512b50 -title: Write Concise Declarative Functions with ES6 +title: Escreva Declaração de Funções Concisas com ES6 challengeType: 1 forumTopicId: 301224 dashedName: write-concise-declarative-functions-with-es6 @@ -8,7 +8,7 @@ dashedName: write-concise-declarative-functions-with-es6 # --description-- -When defining functions within objects in ES5, we have to use the keyword `function` as follows: +Ao definir funções dentro de objetos em ES5, nós temos de usar a palavra-chave `function` como se segue: ```js const person = { @@ -19,7 +19,7 @@ const person = { }; ``` -With ES6, you can remove the `function` keyword and colon altogether when defining functions in objects. Here's an example of this syntax: +Com ES6, você pode remover a palavra-chave `function` e dois pontos ao definir funções em objetos. Aqui está um exemplo dessa sintaxe: ```js const person = { @@ -32,17 +32,17 @@ const person = { # --instructions-- -Refactor the function `setGear` inside the object `bicycle` to use the shorthand syntax described above. +Refatore a função `setGear` dentro do objeto `bicycle` para usar a sintaxe curta descrita acima. # --hints-- -Traditional function expression should not be used. +Expressão tradicional de função não deve ser usado. ```js (getUserInput) => assert(!code.match(/function/)); ``` -`setGear` should be a declarative function. +`setGear` deve ser uma função declarativa. ```js assert( @@ -50,7 +50,7 @@ assert( ); ``` -`bicycle.setGear(48)` should change the `gear` value to 48. +`bicycle.setGear(48)` deve alterar o valor de `gear` para 48. ```js assert(new bicycle.setGear(48).gear === 48); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md index 33dabc5d3a..ea243e0954 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md @@ -1,6 +1,6 @@ --- id: 587d7b8a367417b2b2512b4f -title: Write Concise Object Literal Declarations Using Object Property Shorthand +title: Escreva Declarações Literais de Objetos Concisas usando a Forma Abreviada de Propriedade de Objeto challengeType: 1 forumTopicId: 301225 dashedName: write-concise-object-literal-declarations-using-object-property-shorthand @@ -8,9 +8,9 @@ dashedName: write-concise-object-literal-declarations-using-object-property-shor # --description-- -ES6 adds some nice support for easily defining object literals. +ES6 adiciona alguns suportes legais para facilmente definir literais de objetos. -Consider the following code: +Considere o seguinte código: ```js const getMousePosition = (x, y) => ({ @@ -19,7 +19,7 @@ const getMousePosition = (x, y) => ({ }); ``` -`getMousePosition` is a simple function that returns an object containing two properties. ES6 provides the syntactic sugar to eliminate the redundancy of having to write `x: x`. You can simply write `x` once, and it will be converted to`x: x` (or something equivalent) under the hood. Here is the same function from above rewritten to use this new syntax: +`getMousePosition` é uma função simples que retorna um objeto contendo duas propriedades. ES6 fornece o açúcar sintático para eliminar a redundância de ter de escrever `x: x`. Você pode simplesmente escrever `x` uma vez, e será convertido para `x: x` (ou algo equivalente). Aqui está a mesma função que acima rescrita para usar a nova sintaxe: ```js const getMousePosition = (x, y) => ({ x, y }); @@ -27,11 +27,11 @@ const getMousePosition = (x, y) => ({ x, y }); # --instructions-- -Use object property shorthand with object literals to create and return an object with `name`, `age` and `gender` properties. +Use a abreviação de propriedade de objeto com literais de objeto para criar e retornar um objeto com as propriedades `name`, `age` e `gender`. # --hints-- -`createPerson("Zodiac Hasbro", 56, "male")` should return `{name: "Zodiac Hasbro", age: 56, gender: "male"}`. +`createPerson("Zodiac Hasbro", 56, "male")` deve retornar `{name: "Zodiac Hasbro", age: 56, gender: "male"}`. ```js assert.deepEqual( @@ -40,7 +40,7 @@ assert.deepEqual( ); ``` -Your code should not use `key:value`. +Seu código deve usar `key:value`. ```js (getUserInput) => assert(!getUserInput('index').match(/:/g)); diff --git a/curriculum/challenges/portuguese/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md b/curriculum/challenges/portuguese/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md index 9e0c3a879b..5baf9fc636 100644 --- a/curriculum/challenges/portuguese/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md +++ b/curriculum/challenges/portuguese/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md @@ -26,9 +26,11 @@ As you can see, the body is encoded like the query string. This is the default f # --instructions-- -Install the `body-parser` module in your `package.json`. Then, `require` it at the top of the file. Store it in a variable named `bodyParser`. The middleware to handle urlencoded data is returned by `bodyParser.urlencoded({extended: false})`. Pass to `app.use()` the function returned by the previous method call. As usual, the middleware must be mounted before all the routes which need it. +Install the `body-parser` module in your `package.json`. Then, `require` it at the top of the file. Store it in a variable named `bodyParser`. The middleware to handle urlencoded data is returned by `bodyParser.urlencoded({extended: false})`. Pass the function returned by the previous method call to `app.use()`. As usual, the middleware must be mounted before all the routes that depend on it. -**Note:** `extended=false` is a configuration option that tells the parser to use the classic encoding. When using it, values can be only strings or arrays. The extended version allows more data flexibility, but it is outmatched by JSON. +**Note:** `extended` is a configuration option that tells `body-parser` which parsing needs to be used. When `extended=false` it uses the classic encoding `querystring` library. When `extended=true` it uses `qs` library for parsing. + +When using `extended=false`, values can be only strings or arrays. The object returned when using `querystring` does not prototypically inherit from the default JavaScript `Object`, which means functions like `hasOwnProperty`, `toString` will not be available. The extended version allows more data flexibility, but it is outmatched by JSON. # --hints-- From 480afedd6296731dea77d3a671e51b79f3c03b26 Mon Sep 17 00:00:00 2001 From: Adriano Cangiamila <64534786+AdrianoCng@users.noreply.github.com> Date: Wed, 14 Jul 2021 16:43:14 +0100 Subject: [PATCH 181/344] Update completion-modal.tsx (#42842) --- client/src/templates/Challenges/components/completion-modal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/templates/Challenges/components/completion-modal.tsx b/client/src/templates/Challenges/components/completion-modal.tsx index 24d2842f17..013ed22646 100644 --- a/client/src/templates/Challenges/components/completion-modal.tsx +++ b/client/src/templates/Challenges/components/completion-modal.tsx @@ -171,7 +171,7 @@ export class CompletionModalInner extends Component< } handleKeypress(e: React.KeyboardEvent): void { - if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) { + if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { e.preventDefault(); // Since Hotkeys also listens to Ctrl + Enter we have to stop this event // getting to it. From 03913024a5344d21256f79329cf2bed19e55bef7 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Wed, 14 Jul 2021 18:09:50 +0200 Subject: [PATCH 182/344] fix: various multifile editor bugs (#42855) * refactor: use refs to hold editor and monaco Also removed a lot of unnecessary conditionals * refactor: get a ref to the editor directly Previously we got a ref to react-monaco-editor, but that's an unnecessary layer of abstraction * fix: replace data state with ref * fix: replace remaining useStates with useRefs * refactor: simplify dataRef access * fix: store correct id for output zone * refactor: remove unused parts of MultifileEditor * fix: use separate models per fileKey Temp fix, I think the data should store one version per fileKey * fix: create data for each editor * refactor: declare data once * fix: handle widgets etc. like other data * fix: store an editor per fileKey * refactor: clean up types + initial properties * refactor: remove redundant constructor * fix: remove redundant comment * refactor: update comments --- .../Challenges/classic/MultifileEditor.js | 79 +- .../templates/Challenges/classic/editor.tsx | 1903 ++++++++--------- .../Challenges/components/Hotkeys.tsx | 2 +- 3 files changed, 938 insertions(+), 1046 deletions(-) diff --git a/client/src/templates/Challenges/classic/MultifileEditor.js b/client/src/templates/Challenges/classic/MultifileEditor.js index 37af86fa5d..5d883d9334 100644 --- a/client/src/templates/Challenges/classic/MultifileEditor.js +++ b/client/src/templates/Challenges/classic/MultifileEditor.js @@ -84,83 +84,12 @@ const mapDispatchToProps = { }; class MultifileEditor extends Component { - constructor(...props) { - super(...props); - - // TENATIVE PLAN: create a typical order [html/jsx, css, js], put the - // available files into that order. i.e. if it's just one file it will - // automatically be first, but if there's jsx and js (for some reason) it - // will be [jsx, js]. - // this.state = { - // fileKey: 'indexhtml' - // }; - - // NOTE: This looks like it should be react state. However we need - // to access monaco.editor to create the models and store the state and that - // is only available in the react-monaco-editor component's lifecycle hooks - // and not react's lifecyle hooks. - // As a result it was unclear how to link up the editor's lifecycle with - // react's lifecycle. Simply storing the models and state here and letting - // the editor control them seems to be the best solution. - - // TODO: is there any point in initializing this? It should be fine with - // this.data = {indexjs:{}, indexcss:{}, indexhtml:{}, indexjsx: {}} - - this.data = { - indexjs: { - model: null, - state: null, - viewZoneId: null, - startEditDecId: null, - endEditDecId: null, - viewZoneHeight: null - }, - indexcss: { - model: null, - state: null, - viewZoneId: null, - startEditDecId: null, - endEditDecId: null, - viewZoneHeight: null - }, - indexhtml: { - model: null, - state: null, - viewZoneId: null, - startEditDecId: null, - endEditDecId: null, - viewZoneHeight: null - }, - indexjsx: { - model: null, - state: null, - viewZoneId: null, - startEditDecId: null, - endEditDecId: null, - viewZoneHeight: null - } - }; - - // TODO: we might want to store the current editor here - this.focusOnEditor = this.focusOnEditor.bind(this); - } - focusOnHotkeys() { if (this.props.containerRef.current) { this.props.containerRef.current.focus(); } } - focusOnEditor() { - // TODO: it should focus one of the editors - // this._editor.focus(); - } - - componentWillUnmount() { - // this.setState({ fileKey: null }); - this.data = null; - } - render() { const { challengeFiles, @@ -221,9 +150,9 @@ class MultifileEditor extends Component { challengeFiles={challengeFiles} containerRef={containerRef} description={targetEditor === 'indexjsx' ? description : null} + editorRef={editorRef} fileKey='indexjsx' key='indexjsx' - ref={editorRef} resizeProps={resizeProps} theme={editorTheme} /> @@ -240,9 +169,9 @@ class MultifileEditor extends Component { description={ targetEditor === 'indexhtml' ? description : null } + editorRef={editorRef} fileKey='indexhtml' key='indexhtml' - ref={editorRef} resizeProps={resizeProps} theme={editorTheme} /> @@ -257,9 +186,9 @@ class MultifileEditor extends Component { challengeFiles={challengeFiles} containerRef={containerRef} description={targetEditor === 'indexcss' ? description : null} + editorRef={editorRef} fileKey='indexcss' key='indexcss' - ref={editorRef} resizeProps={resizeProps} theme={editorTheme} /> @@ -275,9 +204,9 @@ class MultifileEditor extends Component { challengeFiles={challengeFiles} containerRef={containerRef} description={targetEditor === 'indexjs' ? description : null} + editorRef={editorRef} fileKey='indexjs' key='indexjs' - ref={editorRef} resizeProps={resizeProps} theme={editorTheme} /> diff --git a/client/src/templates/Challenges/classic/editor.tsx b/client/src/templates/Challenges/classic/editor.tsx index 2e5662371b..914e08d209 100644 --- a/client/src/templates/Challenges/classic/editor.tsx +++ b/client/src/templates/Challenges/classic/editor.tsx @@ -1,10 +1,9 @@ import React, { - useState, useEffect, Suspense, RefObject, - forwardRef, - ForwardedRef + MutableRefObject, + useRef } from 'react'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; @@ -41,19 +40,19 @@ import type { Range as RangeType // eslint-disable-next-line import/no-duplicates } from 'monaco-editor/esm/vs/editor/editor.api'; -import type ReactMonacoEditor from 'react-monaco-editor'; import './editor.css'; const MonacoEditor = Loadable(() => import('react-monaco-editor')); -type PropTypes = { +interface EditorProps { canFocus: boolean; challengeFiles: ChallengeFileType; containerRef: RefObject; contents: string; description: string; dimensions: DimensionsType; + editorRef: MutableRefObject; executeChallenge: (isShouldCompletionModalOpen?: boolean) => void; ext: ExtTypes; fileKey: FileKeyTypes; @@ -73,19 +72,30 @@ type PropTypes = { editorValue: string; editableRegionBoundaries: number[] | null; }) => void; -}; +} -type DataType = { - model: null | editor.ITextModel; - state: null; - viewZoneId: string | null; - startEditDecId: string | null; - endEditDecId: string | null; - insideEditDecId: string | null; - viewZoneHeight: number | null; - outputZoneHeight: number | null; - outputZoneId: string | null; -}; +interface EditorProperties { + editor?: editor.IStandaloneCodeEditor; + model?: editor.ITextModel; + viewZoneId: string; + startEditDecId: string; + endEditDecId: string; + insideEditDecId: string; + viewZoneHeight: number; + outputZoneHeight: number; + outputZoneId: string; + descriptionNode?: HTMLDivElement; + outputNode?: HTMLDivElement; + overlayWidget?: editor.IOverlayWidget; + outputWidget?: editor.IOverlayWidget; +} + +interface EditorPropertyStore { + indexcss: EditorProperties; + indexhtml: EditorProperties; + indexjs: EditorProperties; + indexjsx: EditorProperties; +} const mapStateToProps = createSelector( canFocusEditorSelector, @@ -170,1019 +180,972 @@ const toLastLine = (range: RangeType) => { }; // TODO: properly initialise data with values not null -const initialData: DataType = { - model: null, - state: null, - viewZoneId: null, - startEditDecId: null, - endEditDecId: null, - insideEditDecId: null, - viewZoneHeight: null, - outputZoneId: null, - outputZoneHeight: null +const initialData: EditorProperties = { + viewZoneId: '', + startEditDecId: '', + endEditDecId: '', + insideEditDecId: '', + viewZoneHeight: 0, + outputZoneId: '', + outputZoneHeight: 0 }; -const Editor = forwardRef( - (props: PropTypes, ref: ForwardedRef): JSX.Element => { - // TODO: is there any point in initializing this? It should be fine with - // data = {} - const [data, setData] = useState(initialData); - const [_editor, setEditor] = useState( - null +const Editor = (props: EditorProps): JSX.Element => { + const { editorRef, fileKey } = props; + // These refs are used during initialisation of the editor as well as by + // callbacks. Since they have to be initialised before editorWillMount and + // editorDidMount are called, we cannot use useState. Reason being that will + // only take effect during the next render, which is too late. We could use + // plain objects here, but useRef is shared between instances, so avoids + // unecessary object creation. + const monacoRef: MutableRefObject = + useRef(null); + const dataRef = useRef({ + indexcss: { ...initialData }, + indexhtml: { ...initialData }, + indexjs: { ...initialData }, + indexjsx: { ...initialData } + }); + + const data = dataRef.current[fileKey]; + + // TENATIVE PLAN: create a typical order [html/jsx, css, js], put the + // available files into that order. i.e. if it's just one file it will + // automatically be first, but if there's jsx and js (for some reason) it + // will be [jsx, js]. + + // NOTE: the ARIA state is controlled by fileKey, so changes to it must + // trigger a re-render. Hence state: + const options: editor.IStandaloneEditorConstructionOptions = { + fontSize: 18, + scrollBeyondLastLine: false, + selectionHighlight: false, + overviewRulerBorder: false, + hideCursorInOverviewRuler: true, + renderIndentGuides: false, + minimap: { + enabled: false + }, + selectOnLineNumbers: true, + wordWrap: 'on', + scrollbar: { + horizontal: 'hidden', + vertical: 'visible', + verticalHasArrows: false, + useShadows: false, + verticalScrollbarSize: 5 + }, + parameterHints: { + enabled: false + }, + tabSize: 2, + dragAndDrop: true, + lightbulb: { + enabled: false + }, + quickSuggestions: false, + suggestOnTriggerCharacters: false + }; + + const getEditableRegion = () => { + const { challengeFiles, fileKey } = props; + const edRegBounds = challengeFiles[fileKey]?.editableRegionBoundaries; + return edRegBounds ? [...edRegBounds] : []; + }; + + const editorWillMount = (monaco: typeof monacoEditor) => { + const { challengeFiles, fileKey } = props; + + monacoRef.current = monaco; + defineMonacoThemes(monaco); + // If a model is not provided, then the editor 'owns' the model it creates + // and will dispose of that model if it is replaced. Since we intend to + // swap and reuse models, we have to create our own models to prevent + // disposal. + + const model = + data.model || + monaco.editor.createModel( + challengeFiles[fileKey]?.contents ?? '', + modeMap[challengeFiles[fileKey]?.ext ?? 'html'] + ); + data.model = model; + const editableRegion = getEditableRegion(); + + if (editableRegion.length === 2) decorateForbiddenRanges(editableRegion); + + // TODO: do we need to return this? + return { model }; + }; + + // Updates the model if the contents has changed. This is only necessary for + // changes coming from outside the editor (such as code resets). + const updateEditorValues = () => { + const { challengeFiles, fileKey } = props; + const { model } = dataRef.current[fileKey]; + + const newContents = challengeFiles[fileKey]?.contents; + if (model?.getValue() !== newContents) { + model?.setValue(newContents ?? ''); + } + }; + + const editorDidMount = ( + editor: editor.IStandaloneCodeEditor, + monaco: typeof monacoEditor + ) => { + // TODO this should *probably* be set on focus + editorRef.current = editor; + data.editor = editor; + editor.updateOptions({ + accessibilitySupport: props.inAccessibilityMode ? 'on' : 'auto' + }); + // Users who are using screen readers should not have to move focus from + // the editor to the description every time they open a challenge. + if (props.canFocus && !props.inAccessibilityMode) { + // TODO: only one Editor should be calling for focus at once. + editor.focus(); + } else focusOnHotkeys(); + // Removes keybind for intellisense + // Private method - hopefully changes with future version + // ref: https://github.com/microsoft/monaco-editor/issues/102 + /* eslint-disable */ + // @ts-ignore + editor._standaloneKeybindingService.addDynamicKeybinding( + '-editor.action.triggerSuggest', + null, + () => {} ); - const [_monaco, setMonaco] = useState(null); - const [_domNode, setDomNode] = useState(null); - const [_outputNode, setOutputNode] = useState(null); - const [_overlayWidget, setOverlayWidget] = - useState(null); - const [_outputWidget, setOutputWidget] = - useState(null); - - // TENATIVE PLAN: create a typical order [html/jsx, css, js], put the - // available files into that order. i.e. if it's just one file it will - // automatically be first, but if there's jsx and js (for some reason) it - // will be [jsx, js]. - - // NOTE: This looks like it should be react state. However we need - // to access monaco.editor to create the models and store the state and that - // is only available in the react-monaco-editor component's lifecycle hooks - // and not react's lifecyle hooks. - // As a result it was unclear how to link up the editor's lifecycle with - // react's lifecycle. Simply storing the models and state here and letting - // the editor control them seems to be the best solution. - // TODO: IS THIS STILL TRUE NOW EACH EDITOR IS AN ISLAND, ENTIRE OF ITSELF? - - // NOTE: the ARIA state is controlled by fileKey, so changes to it must - // trigger a re-render. Hence state: - const options: editor.IStandaloneEditorConstructionOptions = { - fontSize: 18, - scrollBeyondLastLine: false, - selectionHighlight: false, - overviewRulerBorder: false, - hideCursorInOverviewRuler: true, - renderIndentGuides: false, - minimap: { - enabled: false - }, - selectOnLineNumbers: true, - wordWrap: 'on', - scrollbar: { - horizontal: 'hidden', - vertical: 'visible', - verticalHasArrows: false, - useShadows: false, - verticalScrollbarSize: 5 - }, - parameterHints: { - enabled: false - }, - tabSize: 2, - dragAndDrop: true, - lightbulb: { - enabled: false - }, - quickSuggestions: false, - suggestOnTriggerCharacters: false - }; - - const getEditableRegion = () => { - const { challengeFiles, fileKey } = props; - const edRegBounds = challengeFiles[fileKey]?.editableRegionBoundaries; - return edRegBounds ? [...edRegBounds] : []; - }; - - const editorWillMount = (monaco: typeof monacoEditor) => { - setMonaco(monaco); - const { challengeFiles, fileKey } = props; - defineMonacoThemes(monaco); - // If a model is not provided, then the editor 'owns' the model it creates - // and will dispose of that model if it is replaced. Since we intend to - // swap and reuse models, we have to create our own models to prevent - // disposal. - - // TODO: For now, I'm keeping the 'data' machinery, but it'll probably go - - const model = - data.model || - monaco.editor.createModel( - challengeFiles[fileKey]?.contents ?? '', - modeMap[challengeFiles[fileKey]?.ext ?? 'html'] - ); - setData({ ...data, model }); - - const editableRegion = getEditableRegion(); - - if (editableRegion.length === 2) decorateForbiddenRanges(editableRegion); - - return { model }; - }; - - // Updates the model if the contents has changed. This is only necessary for - // changes coming from outside the editor (such as code resets). - const updateEditorValues = () => { - const { challengeFiles, fileKey } = props; - - const newContents = challengeFiles[fileKey]?.contents; - if (data.model?.getValue() !== newContents) { - data.model?.setValue(newContents ?? ''); + /* eslint-disable */ + editor.addAction({ + id: 'execute-challenge', + label: 'Run tests', + /* eslint-disable no-bitwise */ + keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter], + // TODO: Discuss with Ahmad what should pop-up when a challenge is completed + run: () => props.executeChallenge(true) + }); + editor.addAction({ + id: 'leave-editor', + label: 'Leave editor', + keybindings: [monaco.KeyCode.Escape], + run: () => { + focusOnHotkeys(); + props.setEditorFocusability(false); } - }; - - const editorDidMount = ( - editor: editor.IStandaloneCodeEditor, - monaco: typeof monacoEditor - ) => { - // TODO: Why do we have two editors: 'editor' and '_editor'? - probably not necessary - setEditor(editor); - editor.updateOptions({ - accessibilitySupport: props.inAccessibilityMode ? 'on' : 'auto' - }); - // Users who are using screen readers should not have to move focus from - // the editor to the description every time they open a challenge. - if (props.canFocus && !props.inAccessibilityMode) { - // TODO: only one Editor should be calling for focus at once. - editor.focus(); - } else focusOnHotkeys(); - // Removes keybind for intellisense - // Private method - hopefully changes with future version - // ref: https://github.com/microsoft/monaco-editor/issues/102 - /* eslint-disable */ - // @ts-ignore - editor._standaloneKeybindingService.addDynamicKeybinding( - '-editor.action.triggerSuggest', - null, - () => {} - ); - /* eslint-disable */ - editor.addAction({ - id: 'execute-challenge', - label: 'Run tests', - /* eslint-disable no-bitwise */ - keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter], - // TODO: Discuss with Ahmad what should pop-up when a challenge is completed - run: () => props.executeChallenge(true) - }); - editor.addAction({ - id: 'leave-editor', - label: 'Leave editor', - keybindings: [monaco.KeyCode.Escape], - run: () => { - focusOnHotkeys(); - props.setEditorFocusability(false); - } - }); - editor.addAction({ - id: 'save-editor-content', - label: 'Save editor content to localStorage', - keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_S], - run: props.saveEditorContent - }); - editor.addAction({ - id: 'toggle-accessibility', - label: 'Toggle Accessibility Mode', - keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.F1], - run: () => { - const currentAccessibility = props.inAccessibilityMode; - // The store needs to be updated first, as onDidChangeConfiguration is - // called before updateOptions returns - props.setAccessibilityMode(!currentAccessibility); - editor.updateOptions({ - accessibilitySupport: currentAccessibility ? 'auto' : 'on' - }); - } - }); - editor.onDidFocusEditorWidget(() => props.setEditorFocusability(true)); - // This is to persist changes caused by the accessibility tooltip. - editor.onDidChangeConfiguration(event => { - if ( - event.hasChanged(monaco.editor.EditorOption.accessibilitySupport) && - editor.getRawOptions().accessibilitySupport === 'on' && - !props.inAccessibilityMode - ) { - props.setAccessibilityMode(true); - } - }); - - const editableBoundaries = getEditableRegion(); - - if (editableBoundaries.length === 2) { - const createWidget = ( - id: string, - domNode: HTMLDivElement, - getTop: () => string - ) => { - const getId = () => id; - const getDomNode = () => domNode; - const getPosition = () => { - domNode.style.width = `${editor.getLayoutInfo().contentWidth}px`; - domNode.style.top = getTop(); - - // must return null, so that Monaco knows the widget will position - // itself. - return null; - }; - return { - getId, - getDomNode, - getPosition - }; - }; - - setDomNode(createDescription()); - - setOutputNode(createOutputNode()); - if (_domNode) { - setOverlayWidget( - createWidget('my.overlay.widget', _domNode, getViewZoneTop) - ); - } - if (_outputNode) { - setOutputWidget( - createWidget('my.output.widget', _outputNode, getOutputZoneTop) - ); - } - if (_overlayWidget) { - _editor?.addOverlayWidget(_overlayWidget); - } - // TODO: order of insertion into the DOM probably matters, revisit once - // the tabs have been fixed! - if (_outputWidget) { - _editor?.addOverlayWidget(_outputWidget); - } - - editor.changeViewZones(viewZoneCallback); - editor.changeViewZones(outputZoneCallback); - - editor.onDidScrollChange(() => { - if (_overlayWidget) { - editor.layoutOverlayWidget(_overlayWidget); - } - if (_outputWidget) { - editor.layoutOverlayWidget(_outputWidget); - } + }); + editor.addAction({ + id: 'save-editor-content', + label: 'Save editor content to localStorage', + keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_S], + run: props.saveEditorContent + }); + editor.addAction({ + id: 'toggle-accessibility', + label: 'Toggle Accessibility Mode', + keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.F1], + run: () => { + const currentAccessibility = props.inAccessibilityMode; + // The store needs to be updated first, as onDidChangeConfiguration is + // called before updateOptions returns + props.setAccessibilityMode(!currentAccessibility); + editor.updateOptions({ + accessibilitySupport: currentAccessibility ? 'auto' : 'on' }); - showEditableRegion(editableBoundaries); } - }; - - const viewZoneCallback = ( - changeAccessor: editor.IViewZoneChangeAccessor - ) => { - // TODO: is there any point creating this here? I know it's cached, but - // would it not be better just sourced from the overlayWidget? - const domNode = createDescription(); - - // make sure the overlayWidget has resized before using it to set the height - if (_editor) { - domNode.style.width = `${_editor.getLayoutInfo().contentWidth}px`; + }); + editor.onDidFocusEditorWidget(() => props.setEditorFocusability(true)); + // This is to persist changes caused by the accessibility tooltip. + editor.onDidChangeConfiguration(event => { + if ( + event.hasChanged(monaco.editor.EditorOption.accessibilitySupport) && + editor.getRawOptions().accessibilitySupport === 'on' && + !props.inAccessibilityMode + ) { + props.setAccessibilityMode(true); } + }); - // TODO: set via onComputedHeight? - data.viewZoneHeight = domNode.offsetHeight; + const editableBoundaries = getEditableRegion(); - const background = document.createElement('div'); - // background.style.background = 'lightgreen'; + if (editableBoundaries.length === 2) { + const createWidget = ( + id: string, + domNode: HTMLDivElement, + getTop: () => string + ) => { + const getId = () => id; + const getDomNode = () => domNode; + const getPosition = () => { + domNode.style.width = `${editor.getLayoutInfo().contentWidth}px`; + domNode.style.top = getTop(); - // We have to wait for the viewZone to finish rendering before adjusting the - // position of the overlayWidget (i.e. trigger it via onComputedHeight). If - // not the editor may report the wrong value for position of the lines. - const viewZone = { - afterLineNumber: getLineAfterViewZone() - 1, - heightInPx: domNode.offsetHeight, - domNode: background, - onComputedHeight: () => - _overlayWidget && _editor?.layoutOverlayWidget(_overlayWidget) + // must return null, so that Monaco knows the widget will position + // itself. + return null; + }; + return { + getId, + getDomNode, + getPosition + }; }; - data.viewZoneId = changeAccessor.addZone(viewZone); - }; + const domNode = createDescription(editor); - // TODO: this is basically the same as viewZoneCallback, so DRY them out. - const outputZoneCallback = ( - changeAccessor: editor.IViewZoneChangeAccessor - ) => { - // TODO: is there any point creating this here? I know it's cached, but - // would it not be better just sourced from the overlayWidget? - const outputNode = createOutputNode(); + const outputNode = createOutputNode(editor); - // make sure the overlayWidget has resized before using it to set the height - if (_editor) { - outputNode.style.width = `${_editor.getLayoutInfo().contentWidth}px`; - } - - // TODO: set via onComputedHeight? - data.outputZoneHeight = outputNode.offsetHeight; - - const background = document.createElement('div'); - // background.style.background = 'lightpink'; - - // We have to wait for the viewZone to finish rendering before adjusting the - // position of the overlayWidget (i.e. trigger it via onComputedHeight). If - // not the editor may report the wrong value for position of the lines. - const viewZone = { - afterLineNumber: getLineAfterEditableRegion() - 1, - heightInPx: outputNode.offsetHeight, - domNode: background, - onComputedHeight: () => - _outputWidget && _editor?.layoutOverlayWidget(_outputWidget) - }; - - setData({ ...data, viewZoneId: changeAccessor.addZone(viewZone) }); - }; - - function createDescription() { - if (_domNode) return _domNode; - const { description } = props; - // TODO: var was used here. Should it? - const domNode = document.createElement('div'); - const desc = document.createElement('div'); - const descContainer = document.createElement('div'); - descContainer.classList.add('description-container'); - domNode.classList.add('editor-upper-jaw'); - domNode.appendChild(descContainer); - descContainer.appendChild(desc); - desc.innerHTML = description; - // desc.style.background = 'white'; - // domNode.style.background = 'lightgreen'; - // TODO: the solution is probably just to use an overlay that's forced to - // follow the decorations. - // TODO: this is enough for Firefox, but Chrome needs more before the - // user can select text by clicking and dragging. - domNode.style.userSelect = 'text'; - // The z-index needs increasing as ViewZones default to below the lines. - domNode.style.zIndex = '10'; - - domNode.setAttribute('aria-hidden', 'true'); - - // domNode.style.background = 'lightYellow'; - if (_editor) { - domNode.style.left = `${_editor.getLayoutInfo().contentLeft}px`; - domNode.style.width = `${_editor.getLayoutInfo().contentWidth}px`; - } - domNode.style.top = getViewZoneTop(); - setDomNode(domNode); - return domNode; - } - - function createOutputNode() { - if (_outputNode) return _outputNode; - const outputNode = document.createElement('div'); - const statusNode = document.createElement('div'); - const hintNode = document.createElement('div'); - const editorActionRow = document.createElement('div'); - editorActionRow.classList.add('action-row-container'); - outputNode.classList.add('editor-lower-jaw'); - outputNode.appendChild(editorActionRow); - hintNode.setAttribute('id', 'test-output'); - statusNode.setAttribute('id', 'test-status'); - const button = document.createElement('button'); - button.setAttribute('id', 'test-button'); - button.classList.add('btn-block'); - button.innerHTML = 'Check Your Code (Ctrl + Enter)'; - editorActionRow.appendChild(button); - editorActionRow.appendChild(statusNode); - editorActionRow.appendChild(hintNode); - button.onclick = () => { - const { executeChallenge } = props; - executeChallenge(); - }; - - // TODO: does it? - // The z-index needs increasing as ViewZones default to below the lines. - outputNode.style.zIndex = '10'; - - outputNode.setAttribute('aria-hidden', 'true'); - if (_editor) { - outputNode.style.left = `${_editor.getLayoutInfo().contentLeft}px`; - outputNode.style.width = `${_editor.getLayoutInfo().contentWidth}px`; - } - outputNode.style.top = getOutputZoneTop(); - - setOutputNode(outputNode); - - return outputNode; - } - - function focusOnHotkeys() { - const currContainerRef = props.containerRef.current; - if (currContainerRef) { - currContainerRef.focus(); - } - } - - const onChange = (editorValue: string) => { - const { updateFile } = props; - // TODO: use fileKey everywhere? - const { fileKey: key } = props; - // TODO: now that we have getCurrentEditableRegion, should the overlays - // follow that directly? We could subscribe to changes to that and redraw if - // those imply that the positions have changed (i.e. if the content height - // has changed or if content is dragged between regions) - - const editableRegion = getCurrentEditableRegion(); - const editableRegionBoundaries = editableRegion && [ - editableRegion.startLineNumber - 1, - editableRegion.endLineNumber + 1 - ]; - updateFile({ key, editorValue, editableRegionBoundaries }); - }; - - function showEditableRegion(editableBoundaries: number[]) { - if (editableBoundaries.length !== 2) return; - // TODO: The heuristic has been commented out for now because the cursor - // position is not saved at the moment, so it's redundant. I'm leaving it - // here for now, in case we decide to save it in future. - // this is a heuristic: if the cursor is at the start of the page, chances - // are the user has not edited yet. If so, move to the start of the editable - // region. - // if ( - // isEqual({ ..._editor.getPosition() }, { lineNumber: 1, column: 1 }) - // ) { - _editor?.setPosition({ - lineNumber: editableBoundaries[0] + 1, - column: 1 - }); - _editor?.revealLinesInCenter( - editableBoundaries[0], - editableBoundaries[1] + const overlayWidget = createWidget( + 'my.overlay.widget', + domNode, + getViewZoneTop ); - // } + data.overlayWidget = overlayWidget; + const outputWidget = createWidget( + 'my.output.widget', + outputNode, + getOutputZoneTop + ); + data.outputWidget = outputWidget; + + editor.addOverlayWidget(overlayWidget); + + // TODO: order of insertion into the DOM probably matters, revisit once + // the tabs have been fixed! + + editor.addOverlayWidget(outputWidget); + + editor.changeViewZones(viewZoneCallback); + editor.changeViewZones(outputZoneCallback); + + editor.onDidScrollChange(() => { + editor.layoutOverlayWidget(overlayWidget); + editor.layoutOverlayWidget(outputWidget); + }); + showEditableRegion(editableBoundaries); } + }; - function highlightLines( - stickiness: number, - target: editor.ITextModel, - range: IRange, - oldIds: string[] = [] - ) { - const lineDecoration = { - range, - options: { - isWholeLine: true, - linesDecorationsClassName: 'myLineDecoration', - className: 'do-not-edit', - stickiness - } - }; - return target.deltaDecorations(oldIds, [lineDecoration]); + const viewZoneCallback = (changeAccessor: editor.IViewZoneChangeAccessor) => { + const editor = data.editor; + if (!editor) return; + // TODO: is there any point creating this here? I know it's cached, but + // would it not be better just sourced from the overlayWidget? + const domNode = createDescription(editor); + + // make sure the overlayWidget has resized before using it to set the height + + domNode.style.width = `${editor.getLayoutInfo().contentWidth}px`; + + // TODO: set via onComputedHeight? + data.viewZoneHeight = domNode.offsetHeight; + + const background = document.createElement('div'); + // background.style.background = 'lightgreen'; + + // We have to wait for the viewZone to finish rendering before adjusting the + // position of the overlayWidget (i.e. trigger it via onComputedHeight). If + // not the editor may report the wrong value for position of the lines. + const viewZone = { + afterLineNumber: getLineAfterViewZone() - 1, + heightInPx: domNode.offsetHeight, + domNode: background, + onComputedHeight: () => + data.overlayWidget && editor.layoutOverlayWidget(data.overlayWidget) + }; + + data.viewZoneId = changeAccessor.addZone(viewZone); + }; + + // TODO: this is basically the same as viewZoneCallback, so DRY them out. + const outputZoneCallback = ( + changeAccessor: editor.IViewZoneChangeAccessor + ) => { + const editor = data.editor; + if (!editor) return; + // TODO: is there any point creating this here? I know it's cached, but + // would it not be better just sourced from the overlayWidget? + const outputNode = createOutputNode(editor); + + // make sure the overlayWidget has resized before using it to set the height + + outputNode.style.width = `${editor.getLayoutInfo().contentWidth}px`; + + // TODO: set via onComputedHeight? + data.outputZoneHeight = outputNode.offsetHeight; + + const background = document.createElement('div'); + // background.style.background = 'lightpink'; + + // We have to wait for the viewZone to finish rendering before adjusting the + // position of the overlayWidget (i.e. trigger it via onComputedHeight). If + // not the editor may report the wrong value for position of the lines. + const viewZone = { + afterLineNumber: getLineAfterEditableRegion() - 1, + heightInPx: outputNode.offsetHeight, + domNode: background, + onComputedHeight: () => + data.outputWidget && editor.layoutOverlayWidget(data.outputWidget) + }; + + data.outputZoneId = changeAccessor.addZone(viewZone); + }; + + function createDescription(editor: editor.IStandaloneCodeEditor) { + if (data.descriptionNode) return data.descriptionNode; + const { description } = props; + // TODO: var was used here. Should it? + const domNode = document.createElement('div'); + const desc = document.createElement('div'); + const descContainer = document.createElement('div'); + descContainer.classList.add('description-container'); + domNode.classList.add('editor-upper-jaw'); + domNode.appendChild(descContainer); + descContainer.appendChild(desc); + desc.innerHTML = description; + // desc.style.background = 'white'; + // domNode.style.background = 'lightgreen'; + // TODO: the solution is probably just to use an overlay that's forced to + // follow the decorations. + // TODO: this is enough for Firefox, but Chrome needs more before the + // user can select text by clicking and dragging. + domNode.style.userSelect = 'text'; + // The z-index needs increasing as ViewZones default to below the lines. + domNode.style.zIndex = '10'; + + domNode.setAttribute('aria-hidden', 'true'); + + // domNode.style.background = 'lightYellow'; + domNode.style.left = `${editor.getLayoutInfo().contentLeft}px`; + domNode.style.width = `${editor.getLayoutInfo().contentWidth}px`; + + domNode.style.top = getViewZoneTop(); + data.descriptionNode = domNode; + return domNode; + } + + function createOutputNode(editor: editor.IStandaloneCodeEditor) { + if (data.outputNode) return data.outputNode; + const outputNode = document.createElement('div'); + const statusNode = document.createElement('div'); + const hintNode = document.createElement('div'); + const editorActionRow = document.createElement('div'); + editorActionRow.classList.add('action-row-container'); + outputNode.classList.add('editor-lower-jaw'); + outputNode.appendChild(editorActionRow); + hintNode.setAttribute('id', 'test-output'); + statusNode.setAttribute('id', 'test-status'); + const button = document.createElement('button'); + button.setAttribute('id', 'test-button'); + button.classList.add('btn-block'); + button.innerHTML = 'Check Your Code (Ctrl + Enter)'; + editorActionRow.appendChild(button); + editorActionRow.appendChild(statusNode); + editorActionRow.appendChild(hintNode); + button.onclick = () => { + const { executeChallenge } = props; + executeChallenge(); + }; + + // TODO: does it? + // The z-index needs increasing as ViewZones default to below the lines. + outputNode.style.zIndex = '10'; + + outputNode.setAttribute('aria-hidden', 'true'); + + outputNode.style.left = `${editor.getLayoutInfo().contentLeft}px`; + outputNode.style.width = `${editor.getLayoutInfo().contentWidth}px`; + + outputNode.style.top = getOutputZoneTop(); + + data.outputNode = outputNode; + + return outputNode; + } + + function focusOnHotkeys() { + const currContainerRef = props.containerRef.current; + if (currContainerRef) { + currContainerRef.focus(); } + } - function highlightEditableLines( - stickiness: number, - target: editor.ITextModel, - range: IRange, - oldIds: string[] = [] - ) { - const lineDecoration = { - range, - options: { - isWholeLine: true, - linesDecorationsClassName: 'myEditableLineDecoration', - className: 'do-not-edit', - stickiness - } - }; - return target.deltaDecorations(oldIds, [lineDecoration]); - } + const onChange = (editorValue: string) => { + const { updateFile } = props; + // TODO: use fileKey everywhere? + const { fileKey: key } = props; + // TODO: now that we have getCurrentEditableRegion, should the overlays + // follow that directly? We could subscribe to changes to that and redraw if + // those imply that the positions have changed (i.e. if the content height + // has changed or if content is dragged between regions) - function highlightText( - stickiness: number, - target: editor.ITextModel, - range: IRange, - oldIds: string[] = [] - ) { - const inlineDecoration = { - range, - options: { - inlineClassName: 'myInlineDecoration', - stickiness - } - }; + const editableRegion = getCurrentEditableRegion(); + const editableRegionBoundaries = editableRegion && [ + editableRegion.startLineNumber - 1, + editableRegion.endLineNumber + 1 + ]; + updateFile({ key, editorValue, editableRegionBoundaries }); + }; - return target.deltaDecorations(oldIds, [inlineDecoration]); - } + function showEditableRegion(editableBoundaries: number[]) { + if (editableBoundaries.length !== 2) return; + const editor = data.editor; + if (!editor) return; + // TODO: The heuristic has been commented out for now because the cursor + // position is not saved at the moment, so it's redundant. I'm leaving it + // here for now, in case we decide to save it in future. + // this is a heuristic: if the cursor is at the start of the page, chances + // are the user has not edited yet. If so, move to the start of the editable + // region. + // if ( + // isEqual({ ..._editor.getPosition() }, { lineNumber: 1, column: 1 }) + // ) { + editor.setPosition({ + lineNumber: editableBoundaries[0] + 1, + column: 1 + }); + editor.revealLinesInCenter(editableBoundaries[0], editableBoundaries[1]); + // } + } - // NOTE: this is where the view zone *should* be, not necessarily were it - // currently is. (see getLineAfterViewZone) - // TODO: DRY this and getOutputZoneTop out. - function getViewZoneTop() { - const heightDelta = data.viewZoneHeight ?? 0; - if (_editor) { - const top = `${ - _editor.getTopForLineNumber(getLineAfterViewZone()) - - heightDelta - - _editor.getScrollTop() - }px`; - - return top; + function highlightLines( + stickiness: number, + target: editor.ITextModel, + range: IRange, + oldIds: string[] = [] + ) { + const lineDecoration = { + range, + options: { + isWholeLine: true, + linesDecorationsClassName: 'myLineDecoration', + className: 'do-not-edit', + stickiness } - return '0'; - } + }; + return target.deltaDecorations(oldIds, [lineDecoration]); + } - function getOutputZoneTop() { - const heightDelta = data.outputZoneHeight || 0; - if (_editor) { - const top = `${ - _editor.getTopForLineNumber(getLineAfterEditableRegion()) - - heightDelta - - _editor.getScrollTop() - }px`; - - return top; + function highlightEditableLines( + stickiness: number, + target: editor.ITextModel, + range: IRange, + oldIds: string[] = [] + ) { + const lineDecoration = { + range, + options: { + isWholeLine: true, + linesDecorationsClassName: 'myEditableLineDecoration', + className: 'do-not-edit', + stickiness } - return '0'; - } + }; + return target.deltaDecorations(oldIds, [lineDecoration]); + } - // It's not possible to directly access the current view zone so we track - // the region it should cover instead. - // TODO: DRY - function getLineAfterViewZone() { - // TODO: abstract away the data, ids etc. - const range = data.model?.getDecorationRange(data.startEditDecId ?? ''); - // if the first decoration is missing, this implies the region reaches the - // start of the editor. - return range ? range.endLineNumber + 1 : 1; - } + function highlightText( + stickiness: number, + target: editor.ITextModel, + range: IRange, + oldIds: string[] = [] + ) { + const inlineDecoration = { + range, + options: { + inlineClassName: 'myInlineDecoration', + stickiness + } + }; - function getLineAfterEditableRegion() { + return target.deltaDecorations(oldIds, [inlineDecoration]); + } + + // NOTE: this is where the view zone *should* be, not necessarily were it + // currently is. (see getLineAfterViewZone) + // TODO: DRY this and getOutputZoneTop out. + function getViewZoneTop() { + const editor = data.editor; + const heightDelta = data.viewZoneHeight; + if (editor) { + const top = `${ + editor.getTopForLineNumber(getLineAfterViewZone()) - + heightDelta - + editor.getScrollTop() + }px`; + + return top; + } + return '0'; + } + + function getOutputZoneTop() { + const editor = data.editor; + const heightDelta = data.outputZoneHeight; + if (editor) { + const top = `${ + editor.getTopForLineNumber(getLineAfterEditableRegion()) - + heightDelta - + editor.getScrollTop() + }px`; + return top; + } + return '0'; + } + + // It's not possible to directly access the current view zone so we track + // the region it should cover instead. + // TODO: DRY + function getLineAfterViewZone() { + // TODO: abstract away the data, ids etc. + const range = data.model?.getDecorationRange(data.startEditDecId); + // if the first decoration is missing, this implies the region reaches the + // start of the editor. + return range ? range.endLineNumber + 1 : 1; + } + + function getLineAfterEditableRegion() { + // TODO: handle the case that the editable region reaches the bottom of the + // editor + return ( + data.model?.getDecorationRange(data.endEditDecId) + ?.startLineNumber ?? 1 + ); + } + + const translateRange = (range: IRange, lineDelta: number) => { + const iRange = { + ...range, + startLineNumber: range.startLineNumber + lineDelta, + endLineNumber: range.endLineNumber + lineDelta + }; + return monacoRef.current?.Range.lift(iRange); + }; + + // TODO: TESTS! + // Make 100% sure this is inclusive. + // TODO: pass around monacoRef.current instead of using the global one? + const getLinesBetweenRanges = ( + firstRange: RangeType, + secondRange: RangeType + ) => { + const startRange = translateRange(toLastLine(firstRange), 1); + const endRange = translateRange( + toStartOfLine(secondRange), + -1 + )?.collapseToStart(); + + return { + startLineNumber: startRange?.startLineNumber ?? 1, + endLineNumber: endRange?.endLineNumber ?? 2 + }; + }; + + const getCurrentEditableRegion = () => { + const monaco = monacoRef.current; + const { model, startEditDecId, endEditDecId } = data; + // TODO: this is a little low-level, but we should bail if there is no + // editable region defined. + // NOTE: if a decoration is missing, there is still an editable region - it + // just extends to the edge of the editor. However, no decorations means no + // editable region. + if ((!startEditDecId && !endEditDecId) || !model || !monaco) { + return null; + } else { + const firstRange = startEditDecId + ? model.getDecorationRange(startEditDecId) + : getStartOfEditor(); // TODO: handle the case that the editable region reaches the bottom of the // editor - return ( - data.model?.getDecorationRange(data.endEditDecId ?? '') - ?.startLineNumber ?? 1 - ); - } - - const translateRange = (range: IRange, lineDelta: number) => { - const iRange = { - ...range, - startLineNumber: range.startLineNumber + lineDelta, - endLineNumber: range.endLineNumber + lineDelta - }; - return _monaco?.Range.lift(iRange); - }; - - // TODO: TESTS! - // Make 100% sure this is inclusive. - const getLinesBetweenRanges = ( - firstRange: RangeType, - secondRange: RangeType - ) => { - const startRange = translateRange(toLastLine(firstRange), 1); - const endRange = translateRange( - toStartOfLine(secondRange), - -1 - )?.collapseToStart(); - - return { - startLineNumber: startRange?.startLineNumber ?? 1, - endLineNumber: endRange?.endLineNumber ?? 2 - }; - }; - - const getCurrentEditableRegion = () => { - const model = data.model; - // TODO: this is a little low-level, but we should bail if there is no - // editable region defined. - // NOTE: if a decoration is missing, there is still an editable region - it - // just extends to the edge of the editor. However, no decorations means no - // editable region. - if ((!data.startEditDecId && !data.endEditDecId) || !model || !_monaco) { - return null; - } else { - const firstRange = data.startEditDecId - ? model.getDecorationRange(data.startEditDecId) - : getStartOfEditor(); - // TODO: handle the case that the editable region reaches the bottom of the - // editor - const secondRange = model.getDecorationRange(data.endEditDecId ?? ''); - if (firstRange && secondRange) { - const { startLineNumber, endLineNumber } = getLinesBetweenRanges( - firstRange, - secondRange - ); - - // getValueInRange includes column x if - // startColumnNumber <= x < endColumnNumber - // so we add 1 here - const endColumn = model?.getLineLength(endLineNumber) + 1; - return new _monaco.Range( - startLineNumber, - 1, - endLineNumber, - endColumn - ); - } - return null; - } - }; - - // TODO: do this once after _monaco has been created. - const getStartOfEditor = () => - _monaco?.Range.lift({ - startLineNumber: 1, - endLineNumber: 1, - startColumn: 1, - endColumn: 1 - }); - - function decorateForbiddenRanges(editableRegion: number[]) { - const model = data.model; - if (!model) return; - const forbiddenRanges: [number, number][] = [ - [0, editableRegion[0]], - [editableRegion[1], model.getLineCount()] - ]; - - const ranges = forbiddenRanges.map(positions => { - return positionsToRange(model, positions); - }); - - const editableRange = positionsToRange(model, [ - editableRegion[0] + 1, - editableRegion[1] - 1 - ]); - - data.insideEditDecId = highlightEditableLines( - _monaco?.editor?.TrackedRangeStickiness?.AlwaysGrowsWhenTypingAtEdges ?? - 0, - model, - editableRange - )[0]; - - // if the forbidden range includes the top of the editor - // we simply don't add those decorations - if (forbiddenRanges[0][1] > 0) { - // the first range should expand at the top - // TODO: Unsure what this should be - returns an array, so I added [0] @ojeytonwilliams - data.startEditDecId = highlightLines( - _monaco?.editor?.TrackedRangeStickiness?.GrowsOnlyWhenTypingBefore ?? - 2, - model, - ranges[0] - )[0]; - - highlightText( - _monaco?.editor?.TrackedRangeStickiness?.GrowsOnlyWhenTypingBefore ?? - 2, - model, - ranges[0] + const secondRange = model.getDecorationRange(endEditDecId); + if (firstRange && secondRange) { + const { startLineNumber, endLineNumber } = getLinesBetweenRanges( + firstRange, + secondRange ); - } - // TODO: handle the case the region covers the bottom of the editor - // the second range should expand at the bottom - data.endEditDecId = highlightLines( - _monaco?.editor?.TrackedRangeStickiness?.GrowsOnlyWhenTypingAfter ?? 3, + // getValueInRange includes column x if + // startColumnNumber <= x < endColumnNumber + // so we add 1 here + const endColumn = model.getLineLength(endLineNumber) + 1; + return new monaco.Range(startLineNumber, 1, endLineNumber, endColumn); + } + return null; + } + }; + + // TODO: do this once after _monaco has been created. + const getStartOfEditor = () => + monacoRef.current?.Range.lift({ + startLineNumber: 1, + endLineNumber: 1, + startColumn: 1, + endColumn: 1 + }); + + function decorateForbiddenRanges(editableRegion: number[]) { + const { model } = data; + const monaco = monacoRef.current; + if (!model || !monaco) return; + const forbiddenRanges: [number, number][] = [ + [0, editableRegion[0]], + [editableRegion[1], model.getLineCount()] + ]; + + const ranges = forbiddenRanges.map(positions => { + return positionsToRange(model, monaco, positions); + }); + + const editableRange = positionsToRange(model, monaco, [ + editableRegion[0] + 1, + editableRegion[1] - 1 + ]); + + data.insideEditDecId = highlightEditableLines( + monaco.editor.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges, + model, + editableRange + )[0]; + + // if the forbidden range includes the top of the editor + // we simply don't add those decorations + if (forbiddenRanges[0][1] > 0) { + // the first range should expand at the top + // TODO: Unsure what this should be - returns an array, so I added [0] @ojeytonwilliams + data.startEditDecId = highlightLines( + monaco.editor.TrackedRangeStickiness.GrowsOnlyWhenTypingBefore, model, - ranges[1] + ranges[0] )[0]; highlightText( - _monaco?.editor?.TrackedRangeStickiness?.GrowsOnlyWhenTypingAfter ?? 3, + monaco.editor.TrackedRangeStickiness.GrowsOnlyWhenTypingBefore, model, - ranges[1] + ranges[0] ); + } - // The deleted line is always considered to be the one that has moved up. - // - if the user deletes at the end of line 5, line 6 is deleted and - // - if the user backspaces at the start of line 6, line 6 is deleted - // TODO: handle multiple simultaneous changes (multicursors do this) - function getDeletedLine(event: editor.IModelContentChangedEvent) { - const isDeleted = - event.changes[0].text === '' && - event.changes[0].range.endColumn === 1; - return isDeleted ? event.changes[0].range.endLineNumber : 0; - } + // TODO: handle the case the region covers the bottom of the editor + // the second range should expand at the bottom + data.endEditDecId = highlightLines( + monaco.editor.TrackedRangeStickiness.GrowsOnlyWhenTypingAfter, + model, + ranges[1] + )[0]; - function getNewLineRanges(event: editor.IModelContentChangedEvent) { - const newLines = event.changes.filter( - ({ text }) => text[0] === event.eol - ); - return newLines.map(({ range }) => range); - } + highlightText( + monaco.editor.TrackedRangeStickiness.GrowsOnlyWhenTypingAfter, + model, + ranges[1] + ); - // TODO refactor this mess - // TODO this listener needs to be replaced on reset. - model?.onDidChangeContent(e => { - // TODO: it would be nice if undoing could remove the warning, but - // it's probably too hard to track. i.e. if they make two warned edits - // and then ctrl + z twice, it would realise they've removed their - // edits. However, what if they made a warned edit, then a normal - // edit, then a warned one. Could it track that they need to make 3 - // undos? - const newLineRanges = getNewLineRanges(e).map(range => { - if (_monaco) { - return toStartOfLine(_monaco.Range.lift(range)); - } - }); - const deletedLine = getDeletedLine(e); + // The deleted line is always considered to be the one that has moved up. + // - if the user deletes at the end of line 5, line 6 is deleted and + // - if the user backspaces at the start of line 6, line 6 is deleted + // TODO: handle multiple simultaneous changes (multicursors do this) + function getDeletedLine(event: editor.IModelContentChangedEvent) { + const isDeleted = + event.changes[0].text === '' && event.changes[0].range.endColumn === 1; + return isDeleted ? event.changes[0].range.endLineNumber : 0; + } - const deletedRange = { - startLineNumber: deletedLine, - endLineNumber: deletedLine, - startColumn: 1, - endColumn: 1 - }; + function getNewLineRanges(event: editor.IModelContentChangedEvent) { + const newLines = event.changes.filter( + ({ text }) => text[0] === event.eol + ); + return newLines.map(({ range }) => range); + } - if (e.isUndoing) { - // TODO: can we be more targeted? Only update when they could get out of - // sync - updateViewZone(); - updateOutputZone(); - return; + // TODO refactor this mess + // TODO this listener needs to be replaced on reset. + model.onDidChangeContent(e => { + // TODO: it would be nice if undoing could remove the warning, but + // it's probably too hard to track. i.e. if they make two warned edits + // and then ctrl + z twice, it would realise they've removed their + // edits. However, what if they made a warned edit, then a normal + // edit, then a warned one. Could it track that they need to make 3 + // undos? + const newLineRanges = getNewLineRanges(e).map(range => { + if (monaco) { + return toStartOfLine(monaco.Range.lift(range)); } + }); + const deletedLine = getDeletedLine(e); - const warnUser = (id: string) => { - const range = model.getDecorationRange(id); - if (range) { - const coveringRange = toStartOfLine(range); - e.changes.forEach(({ range }) => { - if ( - _monaco?.Range?.areIntersectingOrTouching(coveringRange, range) - ) { - console.log('OVERLAP!'); - } - }); - } - }; + const deletedRange = { + startLineNumber: deletedLine, + endLineNumber: deletedLine, + startColumn: 1, + endColumn: 1 + }; + + if (e.isUndoing) { + // TODO: can we be more targeted? Only update when they could get out of + // sync + updateViewZone(); + updateOutputZone(); + return; + } + + const warnUser = (id: string) => { + const range = model.getDecorationRange(id); + if (range) { + const coveringRange = toStartOfLine(range); + e.changes.forEach(({ range }) => { + if (monaco.Range.areIntersectingOrTouching(coveringRange, range)) { + console.log('OVERLAP!'); + } + }); + } + }; + + // Make sure the zone tracks the decoration (i.e. the region), which might + // have changed if a line has been added or removed + const handleHintsZoneChange = () => { + if (newLineRanges.length > 0 || deletedLine > 0) { + updateOutputZone(); + } + }; + + // Make sure the zone tracks the decoration (i.e. the region), which might + // have changed if a line has been added or removed + const handleDescriptionZoneChange = () => { + if (newLineRanges.length > 0 || deletedLine > 0) { + updateViewZone(); + } + }; + + // Stops the greyed out region from covering the editable region. Does not + // change the font decoration. + const preventOverlap = ( + id: string, + stickiness: number, + highlightFunction: typeof highlightLines + ) => { + // Even though the decoration covers the whole line, it has a + // startColumn that moves. toStartOfLine ensures that the + // comparison detects if any change has occurred on that line + // NOTE: any change in the decoration has already happened by this point + // so this covers the *new* decoration range. + const range = model.getDecorationRange(id); + if (!range) { + return id; + } + const coveringRange = toStartOfLine(range); + const oldStartOfRange = translateRange( + coveringRange.collapseToStart(), + 1 + ); + const newCoveringRange = coveringRange.setStartPosition( + oldStartOfRange?.startLineNumber ?? 1, + 1 + ); + + // TODO: this triggers both when you delete the first line of the + // decoration AND the second. To see this, consider a region on line 5 + // If you delete 5, then the new start is 4 and the computed start is 5 + // so they match. + // If you delete 6, then the start of the region stays at 5, so the + // computed start is 6 and they still match. + // Is there a way to tell these cases apart? + // This means that if you delete the second line it actually removes the + // grey background from the first line. + if (oldStartOfRange) { + const touchingDeleted = monaco.Range.areIntersectingOrTouching( + deletedRange, + oldStartOfRange + ); + + if (touchingDeleted) { + // TODO: if they undo this should be reversed + const decorations = highlightFunction( + stickiness, + model, + newCoveringRange, + [id] + ); - // Make sure the zone tracks the decoration (i.e. the region), which might - // have changed if a line has been added or removed - const handleHintsZoneChange = () => { - if (newLineRanges.length > 0 || deletedLine > 0) { updateOutputZone(); - } - }; - - // Make sure the zone tracks the decoration (i.e. the region), which might - // have changed if a line has been added or removed - const handleDescriptionZoneChange = () => { - if (newLineRanges.length > 0 || deletedLine > 0) { - updateViewZone(); - } - }; - - // Stops the greyed out region from covering the editable region. Does not - // change the font decoration. - const preventOverlap = ( - id: string, - stickiness: number, - highlightFunction: typeof highlightLines - ) => { - // Even though the decoration covers the whole line, it has a - // startColumn that moves. toStartOfLine ensures that the - // comparison detects if any change has occurred on that line - // NOTE: any change in the decoration has already happened by this point - // so this covers the *new* decoration range. - const range = model.getDecorationRange(id); - if (!range) { + return decorations[0]; + } else { return id; } - const coveringRange = toStartOfLine(range); - const oldStartOfRange = translateRange( - coveringRange.collapseToStart(), - 1 - ); - const newCoveringRange = coveringRange.setStartPosition( - oldStartOfRange?.startLineNumber ?? 1, - 1 - ); - - // TODO: this triggers both when you delete the first line of the - // decoration AND the second. To see this, consider a region on line 5 - // If you delete 5, then the new start is 4 and the computed start is 5 - // so they match. - // If you delete 6, then the start of the region stays at 5, so the - // computed start is 6 and they still match. - // Is there a way to tell these cases apart? - // This means that if you delete the second line it actually removes the - // grey background from the first line. - if (oldStartOfRange) { - const touchingDeleted = _monaco?.Range?.areIntersectingOrTouching( - deletedRange, - oldStartOfRange - ); - - if (touchingDeleted) { - // TODO: if they undo this should be reversed - const decorations = highlightFunction( - stickiness, - model, - newCoveringRange, - [id] - ); - - updateOutputZone(); - return decorations[0]; - } else { - return id; - } - } - return id; - }; - - // we only need to handle the special case of the second region being - // pulled up, the first region already behaves correctly. - setData({ - ...data, - endEditDecId: preventOverlap( - data.endEditDecId ?? '', - _monaco?.editor?.TrackedRangeStickiness - ?.GrowsOnlyWhenTypingBefore ?? 2, - highlightLines - ) - }); - - setData({ - ...data, - insideEditDecId: preventOverlap( - data.insideEditDecId ?? '', - _monaco?.editor?.TrackedRangeStickiness - ?.AlwaysGrowsWhenTypingAtEdges ?? 0, - highlightEditableLines - ) - }); - - // TODO: do the same for the description widget - // this has to be handle differently, because we care about the END - // of the zone, not the START - // if the editable region includes the first line, the first decoration - // will be missing. - if (data.startEditDecId) { - handleDescriptionZoneChange(); - warnUser(data.startEditDecId); } - handleHintsZoneChange(); - if (data.endEditDecId) { - warnUser(data.endEditDecId); - } - }); - } + return id; + }; - // creates a range covering all the lines in 'positions' - // NOTE: positions is an array of [startLine, endLine] - function positionsToRange( - model: editor.ITextModel, - [start, end]: [number, number] - ) { - console.log('positionsToRange', start, end); - // start and end should always be defined, but if not: - start = start ?? 1; - end = end ?? model.getLineCount(); + // we only need to handle the special case of the second region being + // pulled up, the first region already behaves correctly. - // convert to [startLine, startColumn, endLine, endColumn] - const range = _monaco - ? new _monaco.Range(start, 1, end, 1) - : ([start, 1, end, 1] as unknown as RangeType); - - // Protect against ranges that extend outside the editor - const startLineNumber = Math.max(1, range.startLineNumber); - const endLineNumber = Math.min( - model?.getLineCount(), - range.endLineNumber + data.endEditDecId = preventOverlap( + data.endEditDecId, + monaco.editor.TrackedRangeStickiness.GrowsOnlyWhenTypingBefore, + highlightLines ); - const endColumnText = model.getLineContent(endLineNumber); - // NOTE: the end column is incremented by 2 so that the dangerous range - // extends far enough to capture new text added to the end. - // NOTE: according to the spec, it should only need to be +1, but in - // practice that's not enough. - return range - .setStartPosition(startLineNumber, 1) - .setEndPosition(range.endLineNumber, endColumnText.length + 2); + + data.insideEditDecId = preventOverlap( + data.insideEditDecId, + monaco.editor.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges, + highlightEditableLines + ); + + // TODO: do the same for the description widget + // this has to be handle differently, because we care about the END + // of the zone, not the START + // if the editable region includes the first line, the first decoration + // will be missing. + if (data.startEditDecId) { + handleDescriptionZoneChange(); + warnUser(data.startEditDecId); + } + handleHintsZoneChange(); + if (data.endEditDecId) { + warnUser(data.endEditDecId); + } + }); + } + + // creates a range covering all the lines in 'positions' + // NOTE: positions is an array of [startLine, endLine] + function positionsToRange( + model: editor.ITextModel, + monaco: typeof monacoEditor, + [start, end]: [number, number] + ) { + // convert to [startLine, startColumn, endLine, endColumn] + const range = new monaco.Range(start, 1, end, 1); + + // Protect against ranges that extend outside the editor + const startLineNumber = Math.max(1, range.startLineNumber); + const endLineNumber = Math.min(model.getLineCount(), range.endLineNumber); + const endColumnText = model.getLineContent(endLineNumber); + // NOTE: the end column is incremented by 2 so that the dangerous range + // extends far enough to capture new text added to the end. + // NOTE: according to the spec, it should only need to be +1, but in + // practice that's not enough. + return range + .setStartPosition(startLineNumber, 1) + .setEndPosition(range.endLineNumber, endColumnText.length + 2); + } + + useEffect(() => { + // If a challenge is reset, it needs to communicate that change to the + // editor. + updateEditorValues(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [props.challengeFiles]); + useEffect(() => { + const { output, tests } = props; + const editableRegion = getEditableRegion(); + if (editableRegion.length === 2) { + const challengeComplete = tests.every(test => test.pass && !test.err); + const chellengeHasErrors = tests.some(test => test.err); + const testOutput = document.getElementById('test-output'); + const testStatus = document.getElementById('test-status'); + if (challengeComplete) { + const testButton = document.getElementById('test-button'); + if (testButton) { + testButton.innerHTML = + 'Submit your code and go to next challenge (Ctrl + Enter)'; + testButton.onclick = () => { + const { submitChallenge } = props; + submitChallenge(); + }; + } + + const editableRegionDecorators = document.getElementsByClassName( + 'myEditableLineDecoration' + ); + if (editableRegionDecorators.length > 0) { + for (const i of editableRegionDecorators) { + i.classList.add('tests-passed'); + } + } + if (testOutput && testStatus) { + testOutput.innerHTML = ''; + testStatus.innerHTML = '✅ Step completed.'; + } + } else if (chellengeHasErrors && testStatus && testOutput) { + const wordsArray = [ + "Not quite. Here's a hint:", + 'Try again. This might help:', + 'Keep trying. A quick hint for you:', + "You're getting there. This may help:", + "Hang in there. You'll get there. A hint:", + "Don't give up. Here's a hint to get you thinking:" + ]; + testStatus.innerHTML = `✖️ ${ + wordsArray[Math.floor(Math.random() * wordsArray.length)] + }`; + testOutput.innerHTML = `${output[1]}`; + } } - - useEffect(() => { - // If a challenge is reset, it needs to communicate that change to the - // editor. - updateEditorValues(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [props.challengeFiles]); - useEffect(() => { - if (_editor) { - const { output, tests } = props; - const editableRegion = getEditableRegion(); - if (editableRegion.length === 2) { - const challengeComplete = tests.every(test => test.pass && !test.err); - const chellengeHasErrors = tests.some(test => test.err); - const testOutput = document.getElementById('test-output'); - const testStatus = document.getElementById('test-status'); - if (challengeComplete) { - const testButton = document.getElementById('test-button'); - if (testButton) { - testButton.innerHTML = - 'Submit your code and go to next challenge (Ctrl + Enter)'; - testButton.onclick = () => { - const { submitChallenge } = props; - submitChallenge(); - }; - } - - const editableRegionDecorators = document.getElementsByClassName( - 'myEditableLineDecoration' - ); - if (editableRegionDecorators.length > 0) { - for (const i of editableRegionDecorators) { - i.classList.add('tests-passed'); - } - } - if (testOutput && testStatus) { - testOutput.innerHTML = ''; - testStatus.innerHTML = '✅ Step completed.'; - } - } else if (chellengeHasErrors && testStatus && testOutput) { - const wordsArray = [ - "Not quite. Here's a hint:", - 'Try again. This might help:', - 'Keep trying. A quick hint for you:', - "You're getting there. This may help:", - "Hang in there. You'll get there. A hint:", - "Don't give up. Here's a hint to get you thinking:" - ]; - testStatus.innerHTML = `✖️ ${ - wordsArray[Math.floor(Math.random() * wordsArray.length)] - }`; - testOutput.innerHTML = `${output[1]}`; - } - } - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [props.tests]); - useEffect(() => { - if (_editor) { - const { output } = props; - if (_outputNode) { - // TODO: output gets wiped when the preview gets updated, keeping the - // display is an anti-pattern (the render should not ignore props!). - // The correct solution is probably to create a new redux variable - // (shownHint,maybe) and have that persist through previews. But, for - // now: - if (output) { - // if either id exists, the editable region exists - // TODO: add a layer of abstraction: we should be interacting with - // the editable region, not the ids - if (data.startEditDecId || data.endEditDecId) { - updateOutputZone(); - } - } - } - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [props.output]); - useEffect(() => { - if (_editor) { - _editor.layout(); - if (data.startEditDecId) { - updateViewZone(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [props.tests]); + useEffect(() => { + const { output } = props; + // TODO: do we need this condition? What happens if the ref is empty? + if (data.outputNode) { + // TODO: output gets wiped when the preview gets updated, keeping the + // display is an anti-pattern (the render should not ignore props!). + // The correct solution is probably to create a new redux variable + // (shownHint,maybe) and have that persist through previews. But, for + // now: + if (output) { + // if either id exists, the editable region exists + // TODO: add a layer of abstraction: we should be interacting with + // the editable region, not the ids + if (data.startEditDecId || data.endEditDecId) { updateOutputZone(); } } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [props.dimensions]); - - // TODO: DRY (there's going to be a lot of that) - function updateOutputZone() { - _editor?.changeViewZones(changeAccessor => { - changeAccessor.removeZone(data.outputZoneId ?? ''); - outputZoneCallback(changeAccessor); - }); } - - function updateViewZone() { - _editor?.changeViewZones(changeAccessor => { - changeAccessor.removeZone(data.viewZoneId ?? ''); - viewZoneCallback(changeAccessor); - }); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [props.output]); + useEffect(() => { + const editor = data.editor; + editor?.layout(); + if (data.startEditDecId) { + updateViewZone(); + updateOutputZone(); } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [props.dimensions]); - useEffect(() => { - return () => { - setData(initialData); - }; - }, []); - const { theme } = props; - const editorTheme = theme === 'night' ? 'vs-dark-custom' : 'vs-custom'; - return ( - }> - - - - - ); + // TODO: DRY (there's going to be a lot of that) + function updateOutputZone() { + const editor = data.editor; + editor?.changeViewZones(changeAccessor => { + changeAccessor.removeZone(data.outputZoneId); + outputZoneCallback(changeAccessor); + }); } -); + + function updateViewZone() { + const editor = data.editor; + editor?.changeViewZones(changeAccessor => { + changeAccessor.removeZone(data.viewZoneId); + viewZoneCallback(changeAccessor); + }); + } + + const { theme } = props; + const editorTheme = theme === 'night' ? 'vs-dark-custom' : 'vs-custom'; + return ( + }> + + + + + ); +}; Editor.displayName = 'Editor'; -// NOTE: withRef gets replaced by forwardRef in react-redux 6, -// https://github.com/reduxjs/react-redux/releases/tag/v6.0.0 -export default connect(mapStateToProps, mapDispatchToProps, null, { - withRef: true -})(Editor); +export default connect(mapStateToProps, mapDispatchToProps)(Editor); diff --git a/client/src/templates/Challenges/components/Hotkeys.tsx b/client/src/templates/Challenges/components/Hotkeys.tsx index 4f1a357e84..5debfd2f25 100644 --- a/client/src/templates/Challenges/components/Hotkeys.tsx +++ b/client/src/templates/Challenges/components/Hotkeys.tsx @@ -63,7 +63,7 @@ function Hotkeys({ FOCUS_EDITOR: (e: React.KeyboardEvent) => { e.preventDefault(); if (editorRef && editorRef.current) { - editorRef.current.getWrappedInstance().editor.focus(); + editorRef.current.focus(); } }, FOCUS_INSTRUCTIONS_PANEL: () => { From 505c3b7c6ca58d4308c62a0b6396afe1b1a6d3f1 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 14 Jul 2021 16:44:14 +0000 Subject: [PATCH 183/344] chore(deps): update dependency inquirer to v8.1.2 --- .../package-lock.json | 25 ++++++++++++++++--- tools/challenge-helper-scripts/package.json | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/tools/challenge-helper-scripts/package-lock.json b/tools/challenge-helper-scripts/package-lock.json index 6f07e1c222..6b162b15d4 100644 --- a/tools/challenge-helper-scripts/package-lock.json +++ b/tools/challenge-helper-scripts/package-lock.json @@ -317,9 +317,9 @@ "dev": true }, "inquirer": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.1.1.tgz", - "integrity": "sha512-hUDjc3vBkh/uk1gPfMAD/7Z188Q8cvTGl0nxwaCdwSbzFh6ZKkZh+s2ozVxbE5G9ZNRyeY0+lgbAIOUFsFf98w==", + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.1.2.tgz", + "integrity": "sha512-DHLKJwLPNgkfwNmsuEUKSejJFbkv0FMO9SMiQbjI3n5NQuCrSIBqP66ggqyz2a6t2qEolKrMjhQ3+W/xXgUQ+Q==", "dev": true, "requires": { "ansi-escapes": "^4.2.1", @@ -332,10 +332,27 @@ "mute-stream": "0.0.8", "ora": "^5.3.0", "run-async": "^2.4.0", - "rxjs": "^6.6.6", + "rxjs": "^7.2.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0", "through": "^2.3.6" + }, + "dependencies": { + "rxjs": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.2.0.tgz", + "integrity": "sha512-aX8w9OpKrQmiPKfT1bqETtUr9JygIz6GZ+gql8v7CijClsP0laoFUdKzxFAoWuRdSlOdU2+crss+cMf+cqMTnw==", + "dev": true, + "requires": { + "tslib": "~2.1.0" + } + }, + "tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", + "dev": true + } } }, "is-extendable": { diff --git a/tools/challenge-helper-scripts/package.json b/tools/challenge-helper-scripts/package.json index f438541c7a..ff5f707b96 100644 --- a/tools/challenge-helper-scripts/package.json +++ b/tools/challenge-helper-scripts/package.json @@ -27,7 +27,7 @@ "bson-objectid": "2.0.1", "cross-env": "7.0.3", "gray-matter": "4.0.3", - "inquirer": "8.1.1", + "inquirer": "8.1.2", "prettier": "2.3.2", "ts-node": "10.1.0", "typescript": "4.3.5" From eef1805fe66462e272eec7e9a31d42f88051e74b Mon Sep 17 00:00:00 2001 From: gikf <60067306+gikf@users.noreply.github.com> Date: Thu, 15 Jul 2021 09:20:31 +0200 Subject: [PATCH 184/344] fix(curriculum): clean-up Project Euler 201-220 (#42826) * fix: clean-up Project Euler 201-220 * fix: corrections from review Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> --- .../problem-201-subsets-with-a-unique-sum.md | 41 ++++++++++++++----- .../project-euler/problem-202-laserbeam.md | 16 ++++---- ...em-203-squarefree-binomial-coefficients.md | 22 +++++++--- ...problem-204-generalised-hamming-numbers.md | 14 +++---- .../project-euler/problem-205-dice-game.md | 8 ++-- .../problem-206-concealed-square.md | 10 ++--- ...problem-207-integer-partition-equations.md | 34 ++++++++++----- .../project-euler/problem-208-robot-walks.md | 14 ++++--- .../problem-209-circular-logic.md | 30 ++++++++++---- .../problem-210-obtuse-angled-triangles.md | 18 ++++---- .../problem-211-divisor-square-sum.md | 14 +++---- .../problem-212-combined-volume-of-cuboids.md | 33 +++++++++------ .../project-euler/problem-213-flea-circus.md | 8 ++-- .../problem-214-totient-chains.md | 27 +++++++----- .../problem-215-crack-free-walls.md | 14 ++++--- ...-primality-of-numbers-of-the-form-2n2-1.md | 16 ++++---- .../problem-217-balanced-numbers.md | 16 ++++---- ...blem-218-perfect-right-angled-triangles.md | 26 +++++++----- .../problem-219-skew-cost-coding.md | 22 +++++----- .../problem-220-heighway-dragon.md | 27 ++++++++---- 20 files changed, 254 insertions(+), 156 deletions(-) diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-201-subsets-with-a-unique-sum.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-201-subsets-with-a-unique-sum.md index 045fd9b2b8..701c08996a 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-201-subsets-with-a-unique-sum.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-201-subsets-with-a-unique-sum.md @@ -8,24 +8,45 @@ dashedName: problem-201-subsets-with-a-unique-sum # --description-- -For any set A of numbers, let sum(A) be the sum of the elements of A. +For any set $A$ of numbers, let $sum(A)$ be the sum of the elements of $A$. -Consider the set B = {1,3,6,8,10,11}. There are 20 subsets of B containing three elements, and their sums are: +Consider the set $B = \\{1,3,6,8,10,11\\}$. There are 20 subsets of $B$ containing three elements, and their sums are: -sum({1,3,6}) = 10, sum({1,3,8}) = 12, sum({1,3,10}) = 14, sum({1,3,11}) = 15, sum({1,6,8}) = 15, sum({1,6,10}) = 17, sum({1,6,11}) = 18, sum({1,8,10}) = 19, sum({1,8,11}) = 20, sum({1,10,11}) = 22, sum({3,6,8}) = 17, sum({3,6,10}) = 19, sum({3,6,11}) = 20, sum({3,8,10}) = 21, sum({3,8,11}) = 22, sum({3,10,11}) = 24, sum({6,8,10}) = 24, sum({6,8,11}) = 25, sum({6,10,11}) = 27, sum({8,10,11}) = 29. +$$\begin{align} + & sum(\\{1,3,6\\}) = 10 \\\\ + & sum(\\{1,3,8\\}) = 12 \\\\ + & sum(\\{1,3,10\\}) = 14 \\\\ + & sum(\\{1,3,11\\}) = 15 \\\\ + & sum(\\{1,6,8\\}) = 15 \\\\ + & sum(\\{1,6,10\\}) = 17 \\\\ + & sum(\\{1,6,11\\}) = 18 \\\\ + & sum(\\{1,8,10\\}) = 19 \\\\ + & sum(\\{1,8,11\\}) = 20 \\\\ + & sum(\\{1,10,11\\}) = 22 \\\\ + & sum(\\{3,6,8\\}) = 17 \\\\ + & sum(\\{3,6,10\\}) = 19 \\\\ + & sum(\\{3,6,11\\}) = 20 \\\\ + & sum(\\{3,8,10\\}) = 21 \\\\ + & sum(\\{3,8,11\\}) = 22 \\\\ + & sum(\\{3,10,11\\}) = 24 \\\\ + & sum(\\{6,8,10\\}) = 24 \\\\ + & sum(\\{6,8,11\\}) = 25 \\\\ + & sum(\\{6,10,11\\}) = 27 \\\\ + & sum(\\{8,10,11\\}) = 29 +\\end{align}$$ -Some of these sums occur more than once, others are unique. For a set A, let U(A,k) be the set of unique sums of k-element subsets of A, in our example we find U(B,3) = {10,12,14,18,21,25,27,29} and sum(U(B,3)) = 156. +Some of these sums occur more than once, others are unique. For a set $A$, let $U(A,k)$ be the set of unique sums of $k$-element subsets of $A$, in our example we find $U(B,3) = \\{10,12,14,18,21,25,27,29\\}$ and $sum(U(B,3)) = 156$. -Now consider the 100-element set S = {12, 22, ... , 1002}. S has 100891344545564193334812497256 50-element subsets. +Now consider the $100$-element set $S = \\{1^2, 2^2, \ldots , {100}^2\\}$. $S$ has $100\\,891\\,344\\,545\\,564\\,193\\,334\\,812\\,497\\,256\\;$ $50$-element subsets. -Determine the sum of all integers which are the sum of exactly one of the 50-element subsets of S, i.e. find sum(U(S,50)). +Determine the sum of all integers which are the sum of exactly one of the $50$-element subsets of $S$, i.e. find $sum(U(S,50))$. # --hints-- -`euler201()` should return 115039000. +`uniqueSubsetsSum()` should return `115039000`. ```js -assert.strictEqual(euler201(), 115039000); +assert.strictEqual(uniqueSubsetsSum(), 115039000); ``` # --seed-- @@ -33,12 +54,12 @@ assert.strictEqual(euler201(), 115039000); ## --seed-contents-- ```js -function euler201() { +function uniqueSubsetsSum() { return true; } -euler201(); +uniqueSubsetsSum(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-202-laserbeam.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-202-laserbeam.md index c42f68e414..558df13760 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-202-laserbeam.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-202-laserbeam.md @@ -10,18 +10,20 @@ dashedName: problem-202-laserbeam Three mirrors are arranged in the shape of an equilateral triangle, with their reflective surfaces pointing inwards. There is an infinitesimal gap at each vertex of the triangle through which a laser beam may pass. -Label the vertices A, B and C. There are 2 ways in which a laser beam may enter vertex C, bounce off 11 surfaces, then exit through the same vertex: one way is shown below; the other is the reverse of that. +Label the vertices $A$, $B$ and $C$. There are 2 ways in which a laser beam may enter vertex $C$, bounce off 11 surfaces, then exit through the same vertex: one way is shown below; the other is the reverse of that. -There are 80840 ways in which a laser beam may enter vertex C, bounce off 1000001 surfaces, then exit through the same vertex. +one way in which laser beam may enter vertex C, bounce off 11 surfaces and exit through the same vertex -In how many ways can a laser beam enter at vertex C, bounce off 12017639147 surfaces, then exit through the same vertex? +There are 80840 ways in which a laser beam may enter vertex $C$, bounce off 1000001 surfaces, then exit through the same vertex. + +In how many ways can a laser beam enter at vertex $C$, bounce off 12017639147 surfaces, then exit through the same vertex? # --hints-- -`euler202()` should return 1209002624. +`laserbeam()` should return `1209002624`. ```js -assert.strictEqual(euler202(), 1209002624); +assert.strictEqual(laserbeam(), 1209002624); ``` # --seed-- @@ -29,12 +31,12 @@ assert.strictEqual(euler202(), 1209002624); ## --seed-contents-- ```js -function euler202() { +function laserbeam() { return true; } -euler202(); +laserbeam(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-203-squarefree-binomial-coefficients.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-203-squarefree-binomial-coefficients.md index 4ecf609e4b..2ee86e59df 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-203-squarefree-binomial-coefficients.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-203-squarefree-binomial-coefficients.md @@ -8,9 +8,19 @@ dashedName: problem-203-squarefree-binomial-coefficients # --description-- -The binomial coefficients nCk can be arranged in triangular form, Pascal's triangle, like this: +The binomial coefficients $\displaystyle\binom{n}{k}$ can be arranged in triangular form, Pascal's triangle, like this: -111121133114641151010511615201561172135352171 ......... +$$\begin{array}{ccccccccccccccc} + & & & & & & & 1 & & & & & & & \\\\ + & & & & & & 1 & & 1 & & & & & & \\\\ + & & & & & 1 & & 2 & & 1 & & & & & \\\\ + & & & & 1 & & 3 & & 3 & & 1 & & & & \\\\ + & & & 1 & & 4 & & 6 & & 4 & & 1 & & & \\\\ + & & 1 & & 5 & & 10 & & 10 & & 5 & & 1 & & \\\\ + & 1 & & 6 & & 15 & & 20 & & 15 & & 6 & & 1 & \\\\ + 1 & & 7 & & 21 & & 35 & & 35 & & 21 & & 7 & & 1 \\\\ + & & & & & & & \ldots +\end{array}$$ It can be seen that the first eight rows of Pascal's triangle contain twelve distinct numbers: 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 21 and 35. @@ -20,10 +30,10 @@ Find the sum of the distinct squarefree numbers in the first 51 rows of Pascal's # --hints-- -`euler203()` should return 34029210557338. +`squarefreeBinomialCoefficients()` should return `34029210557338`. ```js -assert.strictEqual(euler203(), 34029210557338); +assert.strictEqual(squarefreeBinomialCoefficients(), 34029210557338); ``` # --seed-- @@ -31,12 +41,12 @@ assert.strictEqual(euler203(), 34029210557338); ## --seed-contents-- ```js -function euler203() { +function squarefreeBinomialCoefficients() { return true; } -euler203(); +squarefreeBinomialCoefficients(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-204-generalised-hamming-numbers.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-204-generalised-hamming-numbers.md index 4d81e08eea..b7fb0324c0 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-204-generalised-hamming-numbers.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-204-generalised-hamming-numbers.md @@ -12,18 +12,18 @@ A Hamming number is a positive number which has no prime factor larger than 5. So the first few Hamming numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15. -There are 1105 Hamming numbers not exceeding 108. +There are 1105 Hamming numbers not exceeding ${10}^8$. -We will call a positive number a generalised Hamming number of type n, if it has no prime factor larger than n. Hence the Hamming numbers are the generalised Hamming numbers of type 5. +We will call a positive number a generalised Hamming number of type $n$, if it has no prime factor larger than $n$. Hence the Hamming numbers are the generalised Hamming numbers of type 5. -How many generalised Hamming numbers of type 100 are there which don't exceed 109? +How many generalised Hamming numbers of type 100 are there which don't exceed ${10}^9$? # --hints-- -`euler204()` should return 2944730. +`generalisedHammingNumbers()` should return `2944730`. ```js -assert.strictEqual(euler204(), 2944730); +assert.strictEqual(generalisedHammingNumbers(), 2944730); ``` # --seed-- @@ -31,12 +31,12 @@ assert.strictEqual(euler204(), 2944730); ## --seed-contents-- ```js -function euler204() { +function generalisedHammingNumbers() { return true; } -euler204(); +generalisedHammingNumbers(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-205-dice-game.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-205-dice-game.md index 41bf903b6d..08245ebe45 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-205-dice-game.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-205-dice-game.md @@ -18,10 +18,10 @@ What is the probability that Pyramidal Pete beats Cubic Colin? Give your answer # --hints-- -`euler205()` should return 0.5731441. +`diceGame()` should return `0.5731441`. ```js -assert.strictEqual(euler205(), 0.5731441); +assert.strictEqual(diceGame(), 0.5731441); ``` # --seed-- @@ -29,12 +29,12 @@ assert.strictEqual(euler205(), 0.5731441); ## --seed-contents-- ```js -function euler205() { +function diceGame() { return true; } -euler205(); +diceGame(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-206-concealed-square.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-206-concealed-square.md index eaedced890..303cfd1c61 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-206-concealed-square.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-206-concealed-square.md @@ -8,14 +8,14 @@ dashedName: problem-206-concealed-square # --description-- -Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0, where each “\_” is a single digit. +Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0, where each "_" is a single digit. # --hints-- -`euler206()` should return 1389019170. +`concealedSquare()` should return `1389019170`. ```js -assert.strictEqual(euler206(), 1389019170); +assert.strictEqual(concealedSquare(), 1389019170); ``` # --seed-- @@ -23,12 +23,12 @@ assert.strictEqual(euler206(), 1389019170); ## --seed-contents-- ```js -function euler206() { +function concealedSquare() { return true; } -euler206(); +concealedSquare(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-207-integer-partition-equations.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-207-integer-partition-equations.md index 19f1d12c8d..fab97cf73f 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-207-integer-partition-equations.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-207-integer-partition-equations.md @@ -8,24 +8,38 @@ dashedName: problem-207-integer-partition-equations # --description-- -For some positive integers k, there exists an integer partition of the form 4t = 2t + k, +For some positive integers $k$, there exists an integer partition of the form $4^t = 2^t + k$, -where 4t, 2t, and k are all positive integers and t is a real number. +where $4^t$, $2^t$, and $k$ are all positive integers and $t$ is a real number. -The first two such partitions are 41 = 21 + 2 and 41.5849625... = 21.5849625... + 6. +The first two such partitions are $4^1 = 2^1 + 2$ and $4^{1.584\\,962\\,5\ldots} = 2^{1.584\\,962\\,5\ldots} + 6$. -Partitions where t is also an integer are called perfect. For any m ≥ 1 let P(m) be the proportion of such partitions that are perfect with k ≤ m. Thus P(6) = 1/2. +Partitions where $t$ is also an integer are called perfect. For any $m ≥ 1$ let $P(m)$ be the proportion of such partitions that are perfect with $k ≤ m$. -In the following table are listed some values of P(m) P(5) = 1/1 P(10) = 1/2 P(15) = 2/3 P(20) = 1/2 P(25) = 1/2 P(30) = 2/5 ... P(180) = 1/4 P(185) = 3/13 +Thus $P(6) = \frac{1}{2}$. -Find the smallest m for which P(m) < 1/12345 +In the following table are listed some values of $P(m)$ + +$$\begin{align} + & P(5) = \frac{1}{1} \\\\ + & P(10) = \frac{1}{2} \\\\ + & P(15) = \frac{2}{3} \\\\ + & P(20) = \frac{1}{2} \\\\ + & P(25) = \frac{1}{2} \\\\ + & P(30) = \frac{2}{5} \\\\ + & \ldots \\\\ + & P(180) = \frac{1}{4} \\\\ + & P(185) = \frac{3}{13} +\end{align}$$ + +Find the smallest $m$ for which $P(m) < \frac{1}{12\\,345}$ # --hints-- -`euler207()` should return 44043947822. +`integerPartitionEquations()` should return `44043947822`. ```js -assert.strictEqual(euler207(), 44043947822); +assert.strictEqual(integerPartitionEquations(), 44043947822); ``` # --seed-- @@ -33,12 +47,12 @@ assert.strictEqual(euler207(), 44043947822); ## --seed-contents-- ```js -function euler207() { +function integerPartitionEquations() { return true; } -euler207(); +integerPartitionEquations(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-208-robot-walks.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-208-robot-walks.md index 36d5a8fff5..9223d6ea62 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-208-robot-walks.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-208-robot-walks.md @@ -12,14 +12,18 @@ A robot moves in a series of one-fifth circular arcs (72°), with a free choice One of 70932 possible closed paths of 25 arcs starting northward is -Given that the robot starts facing North, how many journeys of 70 arcs in length can it take that return it, after the final arc, to its starting position? (Any arc may be traversed multiple times.) +closed path of 25 arcs, starting northward + +Given that the robot starts facing North, how many journeys of 70 arcs in length can it take that return it, after the final arc, to its starting position? + +**Note:** Any arc may be traversed multiple times. # --hints-- -`euler208()` should return 331951449665644800. +`robotWalks()` should return `331951449665644800`. ```js -assert.strictEqual(euler208(), 331951449665644800); +assert.strictEqual(robotWalks(), 331951449665644800); ``` # --seed-- @@ -27,12 +31,12 @@ assert.strictEqual(euler208(), 331951449665644800); ## --seed-contents-- ```js -function euler208() { +function robotWalks() { return true; } -euler208(); +robotWalks(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-209-circular-logic.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-209-circular-logic.md index f743744736..fe23e25a11 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-209-circular-logic.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-209-circular-logic.md @@ -8,20 +8,34 @@ dashedName: problem-209-circular-logic # --description-- -A k-input binary truth table is a map from k input bits +A $k$-input binary truth table is a map from $k$ input bits (binary digits, 0 [false] or 1 [true]) to 1 output bit. For example, the $2$-input binary truth tables for the logical $AND$ and $XOR$ functions are: -(binary digits, 0 \[false] or 1 \[true]) to 1 output bit. For example, the 2-input binary truth tables for the logical AND and XOR functions are: +| x | y | x AND y | +|---|---|---------| +| 0 | 0 | 0 | +| 0 | 1 | 0 | +| 1 | 0 | 0 | +| 1 | 1 | 1 | -x y x AND y000010100111x y x XOR y000011101110How many 6-input binary truth tables, τ, satisfy the formula +| x | y | x XOR y | +|---|---|---------| +| 0 | 0 | 0 | +| 0 | 1 | 1 | +| 1 | 0 | 1 | +| 1 | 1 | 0 | -τ(a, b, c, d, e, f) AND τ(b, c, d, e, f, a XOR (b AND c)) = 0 for all 6-bit inputs (a, b, c, d, e, f)? +How many $6$-input binary truth tables, $τ$, satisfy the formula + +$$τ(a, b, c, d, e, f) \\; AND \\; τ(b, c, d, e, f, a \\; XOR \\; (b \\; AND \\; c)) = 0$$ + +for all $6$-bit inputs ($a$, $b$, $c$, $d$, $e$, $f$)? # --hints-- -`euler209()` should return 15964587728784. +`circularLogic()` should return `15964587728784`. ```js -assert.strictEqual(euler209(), 15964587728784); +assert.strictEqual(circularLogic(), 15964587728784); ``` # --seed-- @@ -29,12 +43,12 @@ assert.strictEqual(euler209(), 15964587728784); ## --seed-contents-- ```js -function euler209() { +function circularLogic() { return true; } -euler209(); +circularLogic(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-210-obtuse-angled-triangles.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-210-obtuse-angled-triangles.md index 1fc7d98033..fa696ba3e6 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-210-obtuse-angled-triangles.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-210-obtuse-angled-triangles.md @@ -8,22 +8,22 @@ dashedName: problem-210-obtuse-angled-triangles # --description-- -Consider the set S(r) of points (x,y) with integer coordinates satisfying |x| + |y| ≤ r. +Consider the set $S(r)$ of points ($x$,$y$) with integer coordinates satisfying $|x| + |y| ≤ r$. -Let O be the point (0,0) and C the point (r/4,r/4). +Let $O$ be the point (0,0) and $C$ the point ($\frac{r}{4}$,$\frac{r}{4}$). -Let N(r) be the number of points B in S(r), so that the triangle OBC has an obtuse angle, i.e. the largest angle α satisfies 90°<α<180°. +Let $N(r)$ be the number of points $B$ in $S(r)$, so that the triangle $OBC$ has an obtuse angle, i.e. the largest angle $α$ satisfies $90°<α<180°$. -So, for example, N(4)=24 and N(8)=100. +So, for example, $N(4)=24$ and $N(8)=100$. -What is N(1,000,000,000)? +What is $N(1\\,000\\,000\\,000)$? # --hints-- -`euler210()` should return 1598174770174689500. +`obtuseAngledTriangles()` should return `1598174770174689500`. ```js -assert.strictEqual(euler210(), 1598174770174689500); +assert.strictEqual(obtuseAngledTriangles(), 1598174770174689500); ``` # --seed-- @@ -31,12 +31,12 @@ assert.strictEqual(euler210(), 1598174770174689500); ## --seed-contents-- ```js -function euler210() { +function obtuseAngledTriangles() { return true; } -euler210(); +obtuseAngledTriangles(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-211-divisor-square-sum.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-211-divisor-square-sum.md index bde41e4a79..e793fa216f 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-211-divisor-square-sum.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-211-divisor-square-sum.md @@ -8,18 +8,18 @@ dashedName: problem-211-divisor-square-sum # --description-- -For a positive integer n, let σ2(n) be the sum of the squares of its divisors. For example, +For a positive integer $n$, let $σ_2(n)$ be the sum of the squares of its divisors. For example, -σ2(10) = 1 + 4 + 25 + 100 = 130. +$$σ_2(10) = 1 + 4 + 25 + 100 = 130$$ -Find the sum of all n, 0 < n < 64,000,000 such that σ2(n) is a perfect square. +Find the sum of all $n$, $0 < n < 64\\,000\\,000$ such that $σ_2(n)$ is a perfect square. # --hints-- -`euler211()` should return 1922364685. +`divisorSquareSum()` should return `1922364685`. ```js -assert.strictEqual(euler211(), 1922364685); +assert.strictEqual(divisorSquareSum(), 1922364685); ``` # --seed-- @@ -27,12 +27,12 @@ assert.strictEqual(euler211(), 1922364685); ## --seed-contents-- ```js -function euler211() { +function divisorSquareSum() { return true; } -euler211(); +divisorSquareSum(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-212-combined-volume-of-cuboids.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-212-combined-volume-of-cuboids.md index 901bbbc3d1..43f0ee89ac 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-212-combined-volume-of-cuboids.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-212-combined-volume-of-cuboids.md @@ -8,28 +8,37 @@ dashedName: problem-212-combined-volume-of-cuboids # --description-- -An axis-aligned cuboid, specified by parameters { (x0,y0,z0), (dx,dy,dz) }, consists of all points (X,Y,Z) such that x0 ≤ X ≤ x0+dx, y0 ≤ Y ≤ y0+dy and z0 ≤ Z ≤ z0+dz. The volume of the cuboid is the product, dx × dy × dz. The combined volume of a collection of cuboids is the volume of their union and will be less than the sum of the individual volumes if any cuboids overlap. +An axis-aligned cuboid, specified by parameters $\{ (x_0,y_0,z_0), (dx,dy,dz) \}$, consists of all points ($X$,$Y$,$Z$) such that $x_0 ≤ X ≤ x_0 + dx$, $y_0 ≤ Y ≤ y_0 + dy$ and $z_0 ≤ Z ≤ z_0 + dz$. The volume of the cuboid is the product, $dx × dy × dz$. The combined volume of a collection of cuboids is the volume of their union and will be less than the sum of the individual volumes if any cuboids overlap. -Let C1,...,C50000 be a collection of 50000 axis-aligned cuboids such that Cn has parameters +Let $C_1, \ldots, C_{50000}$ be a collection of 50000 axis-aligned cuboids such that $C_n$ has parameters -x0 = S6n-5 modulo 10000y0 = S6n-4 modulo 10000z0 = S6n-3 modulo 10000dx = 1 + (S6n-2 modulo 399)dy = 1 + (S6n-1 modulo 399)dz = 1 + (S6n modulo 399) +$$\begin{align} + & x_0 = S_{6n - 5} \\; \text{modulo} \\; 10000 \\\\ + & y_0 = S_{6n - 4} \\; \text{modulo} \\; 10000 \\\\ + & z_0 = S_{6n - 3} \\; \text{modulo} \\; 10000 \\\\ + & dx = 1 + (S_{6n - 2} \\; \text{modulo} \\; 399) \\\\ + & dy = 1 + (S_{6n - 1} \\; \text{modulo} \\; 399) \\\\ + & dz = 1 + (S_{6n} \\; \text{modulo} \\; 399) \\\\ +\end{align}$$ -where S1,...,S300000 come from the "Lagged Fibonacci Generator": +where $S_1, \ldots, S_{300000}$ come from the "Lagged Fibonacci Generator": -For 1 ≤ k ≤ 55, Sk = \[100003 - 200003k + 300007k3] (modulo 1000000)For 56 ≤ k, Sk = \[Sk-24 + Sk-55] (modulo 1000000) +For $1 ≤ k ≤ 55$, $S_k = [100003 - 200003k + 300007k^3] \\; (modulo \\; 1000000)$ -Thus, C1 has parameters {(7,53,183),(94,369,56)}, C2 has parameters {(2383,3563,5079),(42,212,344)}, and so on. +For $56 ≤ k$, $S_k = [S_{k - 24} + S_{k - 55}] \\; (modulo \\; 1000000)$ -The combined volume of the first 100 cuboids, C1,...,C100, is 723581599. +Thus, $C_1$ has parameters $\{(7,53,183), (94,369,56)\}$, $C_2$ has parameters $\{(2383,3563,5079), (42,212,344)\}$, and so on. -What is the combined volume of all 50000 cuboids, C1,...,C50000 ? +The combined volume of the first 100 cuboids, $C_1, \ldots, C_{100}$, is 723581599. + +What is the combined volume of all 50000 cuboids, $C_1, \ldots, C_{50000}$? # --hints-- -`euler212()` should return 328968937309. +`combinedValueOfCuboids()` should return `328968937309`. ```js -assert.strictEqual(euler212(), 328968937309); +assert.strictEqual(combinedValueOfCuboids(), 328968937309); ``` # --seed-- @@ -37,12 +46,12 @@ assert.strictEqual(euler212(), 328968937309); ## --seed-contents-- ```js -function euler212() { +function combinedValueOfCuboids() { return true; } -euler212(); +combinedValueOfCuboids(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-213-flea-circus.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-213-flea-circus.md index 2fbc23393c..1e45718d6f 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-213-flea-circus.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-213-flea-circus.md @@ -16,10 +16,10 @@ What is the expected number of unoccupied squares after 50 rings of the bell? Gi # --hints-- -`euler213()` should return 330.721154. +`fleaCircus()` should return `330.721154`. ```js -assert.strictEqual(euler213(), 330.721154); +assert.strictEqual(fleaCircus(), 330.721154); ``` # --seed-- @@ -27,12 +27,12 @@ assert.strictEqual(euler213(), 330.721154); ## --seed-contents-- ```js -function euler213() { +function fleaCircus() { return true; } -euler213(); +fleaCircus(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-214-totient-chains.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-214-totient-chains.md index 754596cef6..b570d77084 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-214-totient-chains.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-214-totient-chains.md @@ -8,24 +8,31 @@ dashedName: problem-214-totient-chains # --description-- -Let φ be Euler's totient function, i.e. for a natural number n, +Let $φ$ be Euler's totient function, i.e. for a natural number $n$, $φ(n)$ is the number of $k$, $1 ≤ k ≤ n$, for which $gcd(k,n) = 1$. -φ(n) is the number of k, 1 ≤ k ≤ n, for which gcd(k,n) = 1. +By iterating $φ$, each positive integer generates a decreasing chain of numbers ending in 1. E.g. if we start with 5 the sequence 5,4,2,1 is generated. Here is a listing of all chains with length 4: -By iterating φ, each positive integer generates a decreasing chain of numbers ending in 1. E.g. if we start with 5 the sequence 5,4,2,1 is generated. Here is a listing of all chains with length 4: - -5,4,2,1 7,6,2,1 8,4,2,1 9,6,2,1 10,4,2,1 12,4,2,1 14,6,2,1 18,6,2,1 +$$\begin{align} + 5,4,2,1 & \\\\ + 7,6,2,1 & \\\\ + 8,4,2,1 & \\\\ + 9,6,2,1 & \\\\ + 10,4,2,1 & \\\\ + 12,4,2,1 & \\\\ + 14,6,2,1 & \\\\ + 18,6,2,1 & +\end{align}$$ Only two of these chains start with a prime, their sum is 12. -What is the sum of all primes less than 40000000 which generate a chain of length 25? +What is the sum of all primes less than $40\\,000\\,000$ which generate a chain of length 25? # --hints-- -`euler214()` should return 1677366278943. +`totientChains()` should return `1677366278943`. ```js -assert.strictEqual(euler214(), 1677366278943); +assert.strictEqual(totientChains(), 1677366278943); ``` # --seed-- @@ -33,12 +40,12 @@ assert.strictEqual(euler214(), 1677366278943); ## --seed-contents-- ```js -function euler214() { +function totientChains() { return true; } -euler214(); +totientChains(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-215-crack-free-walls.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-215-crack-free-walls.md index 45f7f563e7..0da02d772b 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-215-crack-free-walls.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-215-crack-free-walls.md @@ -12,16 +12,18 @@ Consider the problem of building a wall out of 2×1 and 3×1 bricks (horizontal For example, the following 9×3 wall is not acceptable due to the running crack shown in red: -There are eight ways of forming a crack-free 9×3 wall, written W(9,3) = 8. +9x3 wall with one lined up gap between horizontally-adjacent bricks -Calculate W(32,10). +There are eight ways of forming a crack-free 9×3 wall, written $W(9,3) = 8$. + +Calculate $W(32,10)$. # --hints-- -`euler215()` should return 806844323190414. +`crackFreeWalls()` should return `806844323190414`. ```js -assert.strictEqual(euler215(), 806844323190414); +assert.strictEqual(crackFreeWalls(), 806844323190414); ``` # --seed-- @@ -29,12 +31,12 @@ assert.strictEqual(euler215(), 806844323190414); ## --seed-contents-- ```js -function euler215() { +function crackFreeWalls() { return true; } -euler215(); +crackFreeWalls(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-216-investigating-the-primality-of-numbers-of-the-form-2n2-1.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-216-investigating-the-primality-of-numbers-of-the-form-2n2-1.md index e7591cd46f..b159c4f3ec 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-216-investigating-the-primality-of-numbers-of-the-form-2n2-1.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-216-investigating-the-primality-of-numbers-of-the-form-2n2-1.md @@ -8,22 +8,22 @@ dashedName: problem-216-investigating-the-primality-of-numbers-of-the-form-2n2-1 # --description-- -Consider numbers t(n) of the form t(n) = 2n2-1 with n > 1. +Consider numbers $t(n)$ of the form $t(n) = 2n^2 - 1$ with $n > 1$. The first such numbers are 7, 17, 31, 49, 71, 97, 127 and 161. -It turns out that only 49 = 7\*7 and 161 = 7\*23 are not prime. +It turns out that only $49 = 7 \times 7$ and $161 = 7 \times 23$ are not prime. -For n ≤ 10000 there are 2202 numbers t(n) that are prime. +For $n ≤ 10000$ there are 2202 numbers $t(n)$ that are prime. -How many numbers t(n) are prime for n ≤ 50,000,000 ? +How many numbers $t(n)$ are prime for $n ≤ 50\\,000\\,000$? # --hints-- -`euler216()` should return 5437849. +`primalityOfNumbers()` should return `5437849`. ```js -assert.strictEqual(euler216(), 5437849); +assert.strictEqual(primalityOfNumbers(), 5437849); ``` # --seed-- @@ -31,12 +31,12 @@ assert.strictEqual(euler216(), 5437849); ## --seed-contents-- ```js -function euler216() { +function primalityOfNumbers() { return true; } -euler216(); +primalityOfNumbers(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-217-balanced-numbers.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-217-balanced-numbers.md index 625b4a6c6d..690b7ae4e7 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-217-balanced-numbers.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-217-balanced-numbers.md @@ -8,22 +8,22 @@ dashedName: problem-217-balanced-numbers # --description-- -A positive integer with k (decimal) digits is called balanced if its first ⌈k/2⌉ digits sum to the same value as its last ⌈k/2⌉ digits, where ⌈x⌉, pronounced ceiling of x, is the smallest integer ≥ x, thus ⌈π⌉ = 4 and ⌈5⌉ = 5. +A positive integer with $k$ (decimal) digits is called balanced if its first $⌈\frac{k}{2}⌉$ digits sum to the same value as its last $⌈\frac{k}{2}⌉$ digits, where $⌈x⌉$, pronounced ceiling of $x$, is the smallest integer $≥ x$, thus $⌈π⌉ = 4$ and $⌈5⌉ = 5$. So, for example, all palindromes are balanced, as is 13722. -Let T(n) be the sum of all balanced numbers less than 10n. +Let $T(n)$ be the sum of all balanced numbers less than $10^n$. -Thus: T(1) = 45, T(2) = 540 and T(5) = 334795890. +Thus: $T(1) = 45$, $T(2) = 540$ and $T(5) = 334\\,795\\,890$. -Find T(47) mod 315 +Find $T(47)\\,mod\\,3^{15}$ # --hints-- -`euler217()` should return 6273134. +`balancedNumbers()` should return `6273134`. ```js -assert.strictEqual(euler217(), 6273134); +assert.strictEqual(balancedNumbers(), 6273134); ``` # --seed-- @@ -31,12 +31,12 @@ assert.strictEqual(euler217(), 6273134); ## --seed-contents-- ```js -function euler217() { +function balancedNumbers() { return true; } -euler217(); +balancedNumbers(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-218-perfect-right-angled-triangles.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-218-perfect-right-angled-triangles.md index db91d74874..22e6c42a14 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-218-perfect-right-angled-triangles.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-218-perfect-right-angled-triangles.md @@ -8,26 +8,32 @@ dashedName: problem-218-perfect-right-angled-triangles # --description-- -Consider the right angled triangle with sides a=7, b=24 and c=25. +Consider the right-angled triangle with sides $a=7$, $b=24$ and $c=25$. The area of this triangle is 84, which is divisible by the perfect numbers 6 and 28. -Moreover it is a primitive right angled triangle as gcd(a,b)=1 and gcd(b,c)=1. +Moreover it is a primitive right-angled triangle as $gcd(a,b) = 1$ and $gcd(b,c) = 1$. -Also c is a perfect square. +Also $c$ is a perfect square. -We will call a right angled triangle perfect if -it is a primitive right angled triangle -its hypotenuse is a perfect square +We will call a right-angled triangle perfect if: -We will call a right angled triangle super-perfect if -it is a perfect right angled triangle and -its area is a multiple of the perfect numbers 6 and 28. +- it is a primitive right-angled triangle +- its hypotenuse is a perfect square -How many perfect right-angled triangles with c≤1016 exist that are not super-perfect? +We will call a right-angled triangle super-perfect if: + +- it is a perfect right-angled triangle +- its area is a multiple of the perfect numbers 6 and 28. + +How many perfect right-angled triangles with $c ≤ {10}^{16}$ exist that are not super-perfect? # --hints-- -`euler218()` should return 0. +`perfectRightAngledTriangles()` should return `0`. ```js -assert.strictEqual(euler218(), 0); +assert.strictEqual(perfectRightAngledTriangles(), 0); ``` # --seed-- @@ -35,12 +41,12 @@ assert.strictEqual(euler218(), 0); ## --seed-contents-- ```js -function euler218() { +function perfectRightAngledTriangles() { return true; } -euler218(); +perfectRightAngledTriangles(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-219-skew-cost-coding.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-219-skew-cost-coding.md index 38d16eba87..499f3cec1d 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-219-skew-cost-coding.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-219-skew-cost-coding.md @@ -8,26 +8,26 @@ dashedName: problem-219-skew-cost-coding # --description-- -Let A and B be bit strings (sequences of 0's and 1's). +Let $A$ and $B$ be bit strings (sequences of 0's and 1's). -If A is equal to the leftmost length(A) bits of B, then A is said to be a prefix of B. +If $A$ is equal to the leftmost length($A$) bits of $B$, then $A$ is said to be a prefix of $B$. -For example, 00110 is a prefix of 001101001, but not of 00111 or 100110. +For example, 00110 is a prefix of 001101001, but not of 00111 or 100110. -A prefix-free code of size n is a collection of n distinct bit strings such that no string is a prefix of any other. For example, this is a prefix-free code of size 6: +A prefix-free code of size $n$ is a collection of $n$ distinct bit strings such that no string is a prefix of any other. For example, this is a prefix-free code of size 6: -0000, 0001, 001, 01, 10, 11 +$$0000, 0001, 001, 01, 10, 11$$ -Now suppose that it costs one penny to transmit a '0' bit, but four pence to transmit a '1'. Then the total cost of the prefix-free code shown above is 35 pence, which happens to be the cheapest possible for the skewed pricing scheme in question. In short, we write Cost(6) = 35. +Now suppose that it costs one penny to transmit a '0' bit, but four pence to transmit a '1'. Then the total cost of the prefix-free code shown above is 35 pence, which happens to be the cheapest possible for the skewed pricing scheme in question. In short, we write $Cost(6) = 35$. -What is Cost(109) ? +What is $Cost(10^9)$? # --hints-- -`euler219()` should return 64564225042. +`skewCostCoding()` should return `64564225042`. ```js -assert.strictEqual(euler219(), 64564225042); +assert.strictEqual(skewCostCoding(), 64564225042); ``` # --seed-- @@ -35,12 +35,12 @@ assert.strictEqual(euler219(), 64564225042); ## --seed-contents-- ```js -function euler219() { +function skewCostCoding() { return true; } -euler219(); +skewCostCoding(); ``` # --solutions-- diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-220-heighway-dragon.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-220-heighway-dragon.md index 1fccaef107..343a3d1e5f 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-220-heighway-dragon.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-220-heighway-dragon.md @@ -8,24 +8,33 @@ dashedName: problem-220-heighway-dragon # --description-- -Let D0 be the two-letter string "Fa". For n≥1, derive Dn from Dn-1 by the string-rewriting rules: +Let $D_0$ be the two-letter string "Fa". For $n ≥ 1$, derive $D_n$ from $D_{n - 1}$ by the string-rewriting rules: -"a" → "aRbFR" "b" → "LFaLb" +- "a" → "aRbFR" +- "b" → "LFaLb" -Thus, D0 = "Fa", D1 = "FaRbFR", D2 = "FaRbFRRLFaLbFR", and so on. +Thus, $D_0$ = "Fa", $D_1$ = "FaRbFR", $D_2$ = "FaRbFRRLFaLbFR", and so on. These strings can be interpreted as instructions to a computer graphics program, with "F" meaning "draw forward one unit", "L" meaning "turn left 90 degrees", "R" meaning "turn right 90 degrees", and "a" and "b" being ignored. The initial position of the computer cursor is (0,0), pointing up towards (0,1). -Then Dn is an exotic drawing known as the Heighway Dragon of order n. For example, D10 is shown below; counting each "F" as one step, the highlighted spot at (18,16) is the position reached after 500 steps. +Then $D_n$ is an exotic drawing known as the Heighway Dragon of order $n$. For example, $D_{10}$ is shown below; counting each "F" as one step, the highlighted spot at (18,16) is the position reached after 500 steps. -What is the position of the cursor after 1012 steps in D50 ? Give your answer in the form x,y with no spaces. +drawing of the Heighway Dragon after 500 steps + +What is the position of the cursor after ${10}^{12}$ steps in $D_{50}$? Give your answer as a string in the form `x,y` with no spaces. # --hints-- -`euler220()` should return 139776, 963904. +`heighwayDragon()` should return a string. ```js -assert.strictEqual(euler220(), 139776, 963904); +assert(typeof heighwayDragon() === 'string'); +``` + +`heighwayDragon()` should return the string `139776,963904`. + +```js +assert.strictEqual(heighwayDragon(), '139776,963904'); ``` # --seed-- @@ -33,12 +42,12 @@ assert.strictEqual(euler220(), 139776, 963904); ## --seed-contents-- ```js -function euler220() { +function heighwayDragon() { return true; } -euler220(); +heighwayDragon(); ``` # --solutions-- From 7eb0630f2df229ae9e421812b8b7d3dd176ca36d Mon Sep 17 00:00:00 2001 From: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com> Date: Thu, 15 Jul 2021 13:04:11 +0530 Subject: [PATCH 185/344] chore(i18n,chn): manually downloaded curriculum (#42858) --- .../create-decimal-numbers-with-javascript.md | 2 +- .../use-body-parser-to-parse-post-requests.md | 8 +- .../data-analysis-example-a.md | 20 +- .../data-analysis-example-b.md | 2 +- .../data-cleaning-and-visualizations.md | 18 +- .../data-cleaning-duplicates.md | 18 +- .../data-cleaning-introduction.md | 2 +- .../data-cleaning-with-dataframes.md | 12 +- .../how-to-use-jupyter-notebooks-intro.md | 17 +- .../introduction-to-data-analysis.md | 17 +- .../jupyter-notebooks-cells.md | 19 +- ...-notebooks-importing-and-exporting-data.md | 23 +- .../numpy-algebra-and-size.md | 20 +- .../numpy-arrays.md | 12 +- .../numpy-boolean-arrays.md | 12 +- .../numpy-introduction-a.md | 18 +- .../numpy-introduction-b.md | 20 +- .../numpy-operations.md | 12 +- ...onal-selection-and-modifying-dataframes.md | 12 +- .../pandas-creating-columns.md | 12 +- .../pandas-dataframes.md | 10 +- ...ndas-indexing-and-conditional-selection.md | 12 +- .../pandas-introduction.md | 12 +- .../parsing-html-and-saving-data.md | 12 +- .../python-functions-and-collections.md | 18 +- .../python-introduction.md | 20 +- .../python-iteration-and-modules.md | 12 +- .../reading-data-csv-and-txt.md | 12 +- .../reading-data-from-databases.md | 18 +- .../reading-data-introduction.md | 14 +- .../demographic-data-analyzer.md | 13 +- .../medical-data-visualizer.md | 13 +- .../page-view-time-series-visualizer.md | 13 +- .../sea-level-predictor.md | 13 +- ...ng-and-changing-elements,-rows,-columns.md | 4 +- .../numpy/basics-of-numpy.md | 4 +- .../numpy/copying-arrays-warning.md | 4 +- .../numpy/initialize-array-problem.md | 4 +- .../numpy/initializing-different-arrays.md | 4 +- .../numpy/mathematics.md | 4 +- .../numpy/reorganizing-arrays.md | 4 +- .../anonymous-message-board.md | 104 +++++--- .../port-scanner.md | 17 +- .../secure-real-time-multiplayer-game.md | 85 ++++--- .../sha-1-password-cracker.md | 17 +- .../stock-price-checker.md | 50 ++-- ...ur-site-via-https-only-with-helmet.hsts.md | 14 +- ...-response-mime-type-with-helmet.nosniff.md | 8 +- ...lmet-using-the-parent-helmet-middleware.md | 14 +- ...client-side-caching-with-helmet.nocache.md | 10 +- ...fetching-with-helmet.dnsprefetchcontrol.md | 10 +- ...sh-and-compare-passwords-asynchronously.md | 16 +- ...ash-and-compare-passwords-synchronously.md | 16 +- ...-information-using-helmet.hidepoweredby.md | 8 +- .../install-and-require-helmet.md | 23 +- ...-of-clickjacking-with-helmet.frameguard.md | 14 +- ...pting-xss-attacks-with-helmet.xssfilter.md | 16 +- ...ing-untrusted-html-with-helmet.ienoopen.md | 10 +- ...olicy-with-helmet.contentsecuritypolicy.md | 16 +- .../understand-bcrypt-hashes.md | 18 +- .../creating-a-tcp-client.md | 4 +- .../developing-a-banner-grabber.md | 4 +- .../developing-a-port-scanner.md | 10 +- .../developing-an-nmap-scanner-part-1.md | 4 +- .../developing-an-nmap-scanner-part-2.md | 4 +- .../introduction-and-setup.md | 10 +- .../data-structures/create-a-hash-table.md | 66 +++-- .../create-a-priority-queue-class.md | 8 +- .../data-structures/create-a-stack-class.md | 7 +- .../create-an-es6-javascript-map.md | 2 + .../create-and-add-to-sets-in-es6.md | 12 +- .../insert-an-element-into-a-max-heap.md | 8 +- .../remove-items-from-a-set-in-es6.md | 11 +- .../data-structures/typed-arrays.md | 4 +- .../use-.has-and-.size-on-an-es6-set.md | 12 +- .../problem-100-arranged-probability.md | 59 ++++- .../problem-101-optimum-polynomial.md | 22 +- .../problem-102-triangle-containment.md | 130 +++++++++- ...problem-103-special-subset-sums-optimum.md | 27 +- .../problem-104-pandigital-fibonacci-ends.md | 14 +- ...problem-105-special-subset-sums-testing.md | 33 ++- ...em-106-special-subset-sums-meta-testing.md | 17 +- .../problem-107-minimal-network.md | 41 +++- .../problem-108-diophantine-reciprocals-i.md | 8 +- .../project-euler/problem-109-darts.md | 24 +- .../problem-110-diophantine-reciprocals-ii.md | 6 +- .../problem-111-primes-with-runs.md | 29 ++- .../problem-112-bouncy-numbers.md | 8 +- .../problem-113-non-bouncy-numbers.md | 12 +- ...oblem-114-counting-block-combinations-i.md | 14 +- ...blem-115-counting-block-combinations-ii.md | 22 +- .../problem-116-red-green-or-blue-tiles.md | 18 +- .../problem-117-red-green-and-blue-tiles.md | 14 +- .../problem-118-pandigital-prime-sets.md | 10 +- .../problem-119-digit-power-sum.md | 16 +- .../problem-120-square-remainders.md | 14 +- .../problem-182-rsa-encryption.md | 74 +++++- .../problem-32-pandigital-products.md | 70 ++++-- .../project-euler/problem-349-langtons-ant.md | 2 +- .../problem-38-pandigital-multiples.md | 57 +++-- .../problem-43-sub-string-divisibility.md | 115 ++++++--- .../project-euler/problem-461-almost-pi.md | 133 ++++++++-- .../problem-51-prime-digit-replacements.md | 93 ++++++- .../problem-52-permuted-multiples.md | 26 +- .../problem-56-powerful-digit-sum.md | 73 +++++- .../problem-57-square-root-convergents.md | 54 +++- .../project-euler/problem-58-spiral-primes.md | 63 ++++- .../problem-61-cyclical-figurate-numbers.md | 231 ++++++++++++++++-- .../problem-62-cubic-permutations.md | 69 +++++- .../problem-63-powerful-digit-counts.md | 92 ++++++- .../problem-64-odd-period-square-roots.md | 64 ++++- .../problem-65-convergents-of-e.md | 71 +++++- .../problem-66-diophantine-equation.md | 81 +++++- .../problem-67-maximum-path-sum-ii.md | 32 ++- .../problem-69-totient-maximum.md | 88 +++++-- .../problem-70-totient-permutation.md | 90 ++++++- .../problem-71-ordered-fractions.md | 65 ++++- .../problem-72-counting-fractions.md | 60 ++++- ...roblem-73-counting-fractions-in-a-range.md | 53 +++- .../problem-74-digit-factorial-chains.md | 96 ++++++-- ...lem-75-singular-integer-right-triangles.md | 76 +++++- .../problem-76-counting-summations.md | 46 +++- .../problem-77-prime-summations.md | 74 +++++- .../problem-78-coin-partitions.md | 63 ++++- .../problem-79-passcode-derivation.md | 79 +++++- ...roblem-80-square-root-digital-expansion.md | 79 +++++- .../problem-81-path-sum-two-ways.md | 70 ++++-- .../problem-82-path-sum-three-ways.md | 78 ++++-- .../problem-83-path-sum-four-ways.md | 98 ++++++-- .../project-euler/problem-84-monopoly-odds.md | 130 +++++++++- .../problem-85-counting-rectangles.md | 77 +++++- .../project-euler/problem-86-cuboid-route.md | 60 ++++- .../problem-87-prime-power-triples.md | 98 +++++++- .../problem-88-product-sum-numbers.md | 72 +++++- .../problem-89-roman-numerals.md | 72 +++++- ...ight-triangles-with-integer-coordinates.md | 87 ++++++- .../problem-92-square-digit-chains.md | 121 ++++++++- ...problem-94-almost-equilateral-triangles.md | 54 +++- .../problem-95-amicable-chains.md | 90 ++++++- .../project-euler/problem-96-su-doku.md | 129 ++++++++-- .../problem-97-large-non-mersenne-prime.md | 60 ++++- .../problem-98-anagramic-squares.md | 173 ++++++++++++- .../problem-99-largest-exponential.md | 55 +++-- .../rosetta-code/100-doors.md | 4 +- ...ient-and-perfect-number-classifications.md | 34 +-- .../rosetta-code/align-columns.md | 89 ++++--- .../rosetta-code/closest-pair-problem.md | 105 ++++++-- .../convert-seconds-to-compound-duration.md | 2 +- .../rosetta-code/count-the-coins.md | 27 +- .../rosetta-code/cut-a-rectangle.md | 117 +++++---- .../rosetta-code/date-format.md | 18 +- .../rosetta-code/emirp-primes.md | 2 +- .../execute-a-markov-algorithm.md | 40 +-- .../factors-of-a-mersenne-number.md | 8 +- .../rosetta-code/hailstone-sequence.md | 66 +++-- .../rosetta-code/happy-numbers.md | 22 +- .../rosetta-code/harshad-or-niven-series.md | 61 ++--- .../rosetta-code/josephus-problem.md | 57 ++--- .../knapsack-problem-unbounded.md | 88 ++++--- .../rosetta-code/knights-tour.md | 215 ++++++++++------ .../rosetta-code/letter-frequency.md | 8 +- ...oop-over-multiple-arrays-simultaneously.md | 8 +- .../rosetta-code/s-expressions.md | 6 +- .../rosetta-code/sha-256.md | 4 +- .../rosetta-code/sort-disjoint-sublist.md | 4 +- ...ter-string-based-on-change-of-character.md | 6 +- .../rosetta-code/sudoku.md | 2 +- .../rosetta-code/sum-of-a-series.md | 2 +- .../rosetta-code/sum-to-100.md | 10 - .../rosetta-code/top-rank-per-group.md | 60 +++-- .../rosetta-code/topological-sort.md | 65 +++-- .../rosetta-code/vector-cross-product.md | 6 +- .../zeckendorf-number-representation.md | 153 ++++++++++-- .../zhang-suen-thinning-algorithm.md | 185 +++++++------- .../build-a-pinterest-clone.md | 2 +- .../take-home-projects/build-a-simon-game.md | 2 +- .../manage-a-book-trading-club.md | 2 +- .../p2p-video-chat-application.md | 2 +- .../deep-learning-demystified.md | 12 +- .../how-convolutional-neural-networks-work.md | 10 +- .../how-deep-neural-networks-work.md | 10 +- ...rks-rnn-and-long-short-term-memory-lstm.md | 10 +- .../book-recommendation-engine-using-knn.md | 15 +- .../cat-and-dog-image-classifier.md | 13 +- ...near-regression-health-costs-calculator.md | 15 +- .../neural-network-sms-text-classifier.md | 13 +- .../rock-paper-scissors.md | 13 +- .../tensorflow/conclusion.md | 10 +- ...al-neural-networks-evaluating-the-model.md | 10 +- ...ral-networks-picking-a-pretrained-model.md | 4 +- ...neural-networks-the-convolutional-layer.md | 10 +- .../convolutional-neural-networks.md | 10 +- ...-learning-algorithms-building-the-model.md | 4 +- ...core-learning-algorithms-classification.md | 10 +- .../core-learning-algorithms-clustering.md | 14 +- ...earning-algorithms-hidden-markov-models.md | 10 +- ...earning-algorithms-the-training-process.md | 10 +- ...ng-algorithms-training-and-testing-data.md | 10 +- ...using-probabilities-to-make-predictions.md | 4 +- ...e-learning-algorithms-working-with-data.md | 10 +- .../tensorflow/core-learning-algorithms.md | 14 +- ...creating-a-convolutional-neural-network.md | 4 +- ...roduction-machine-learning-fundamentals.md | 10 +- .../tensorflow/introduction-to-tensorflow.md | 12 +- ...processing-with-rnns-building-the-model.md | 4 +- ...ssing-with-rnns-create-a-play-generator.md | 6 +- ...processing-with-rnns-making-predictions.md | 10 +- ...al-language-processing-with-rnns-part-2.md | 10 +- ...ing-with-rnns-recurring-neural-networks.md | 12 +- ...ocessing-with-rnns-sentimental-analysis.md | 4 +- ...processing-with-rnns-training-the-model.md | 4 +- .../natural-language-processing-with-rnns.md | 10 +- .../neural-networks-activation-functions.md | 8 +- .../neural-networks-creating-a-model.md | 4 +- .../tensorflow/neural-networks-optimizers.md | 10 +- .../neural-networks-with-tensorflow.md | 10 +- ...cement-learning-with-q-learning-example.md | 4 +- ...rcement-learning-with-q-learning-part-2.md | 8 +- .../reinforcement-learning-with-q-learning.md | 10 +- .../apis-and-microservices-certificate.yml | 12 +- .../data-analysis-with-python-certificate.yml | 12 +- .../data-visualization-certificate.yml | 12 +- .../front-end-libraries-certificate.yml | 12 +- .../information-security-certificate.yml | 12 +- ...rithms-and-data-structures-certificate.yml | 12 +- .../legacy-back-end-certificate.yml | 22 +- .../legacy-data-visualization-certificate.yml | 22 +- .../legacy-front-end-certificate.yml | 22 +- .../legacy-full-stack-certificate.yml | 14 +- ...rity-and-quality-assurance-certificate.yml | 12 +- ...chine-learning-with-python-certificate.yml | 12 +- .../quality-assurance-certificate.yml | 12 +- .../relational-databases-certificate.yml | 21 ++ ...ific-computing-with-python-certificate.yml | 12 +- .../celestial-bodies-database.md | 18 ++ .../learn-relational-databases/final-boss.md | 18 ++ .../learn-advanced-bash-by-building.md | 18 ++ ...-and-sql-by-building-a-bike-rental-shop.md | 17 ++ .../learn-bash-by-building-a-boilerplate.md | 18 ++ ...ash-scripting-by-building-five-programs.md | 18 ++ ...git-by-building-an-sql-reference-object.md | 18 ++ ...building-a-list-of-inspirational-quotes.md | 18 ++ .../learn-nano-by-building-a-castle.md | 18 ++ ...-databases-by-building-a-mario-database.md | 18 ++ ...earn-sql-by-building-a-student-database.md | 18 ++ .../periodic-table-database.md | 18 ++ .../salon-appointment-scheduler.md | 18 ++ .../world-cup-database.md | 18 ++ 248 files changed, 5645 insertions(+), 2149 deletions(-) create mode 100644 curriculum/challenges/chinese/12-certificates/relational-databases-certificate/relational-databases-certificate.yml create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/celestial-bodies-database.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/final-boss.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/learn-advanced-bash-by-building.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/learn-bash-and-sql-by-building-a-bike-rental-shop.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/learn-bash-by-building-a-boilerplate.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/learn-bash-scripting-by-building-five-programs.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/learn-git-by-building-an-sql-reference-object.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/learn-github-by-building-a-list-of-inspirational-quotes.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/learn-nano-by-building-a-castle.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/learn-relational-databases-by-building-a-mario-database.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/learn-sql-by-building-a-student-database.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/periodic-table-database.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/salon-appointment-scheduler.md create mode 100644 curriculum/challenges/chinese/13-relational-databases/learn-relational-databases/world-cup-database.md diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md index f3d062f266..147dbfea17 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md @@ -11,7 +11,7 @@ dashedName: create-decimal-numbers-with-javascript 我们也可以把小数存储到变量中。 小数有时候也被称作浮点数或者 floats。 -**提示:** 不是所有的实数都可以用浮点数(floating point)来表示。 因为可能产生四舍五入的错误, [查看详情](https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems)。 +**提示:** 不是所有的实数都可以用浮点数(floating point)来表示。 因为可能产生四舍五入的错误, [点击这里了解细节](https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems)。 # --instructions-- diff --git a/curriculum/challenges/chinese/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md b/curriculum/challenges/chinese/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md index 35e32af7d1..885edfc0e3 100644 --- a/curriculum/challenges/chinese/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md +++ b/curriculum/challenges/chinese/05-apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests.md @@ -26,13 +26,15 @@ name=John+Doe&age=25 # --instructions-- -在 `package.json` 中安装 `body-parser` 模块, 然后在文件顶部 `require` 进来, 用变量 `bodyParser` 保存它。 通过中间件的 `bodyParser.urlencoded({extended: false})` 方法处理 URL 编码数据, 将调用上个方法返回的函数传给 `app.use()`, 中间件通常挂载在所有需要它的路由之前。 +在 `package.json` 中安装 `body-parser` 模块, 然后在文件顶部 `require` 进来, 用变量 `bodyParser` 保存它。 通过中间件的 `bodyParser.urlencoded({extended: false})` 方法处理 URL 编码数据, Pass the function returned by the previous method call to `app.use()`. As usual, the middleware must be mounted before all the routes that depend on it. -**注意:**`extended=false` 是一个告诉解析器使用经典编码的配置选项, 当使用它时,值只能是字符串或者数组, 拓展版本数据更加灵活,但稍逊于 JSON。 +**Note:** `extended` is a configuration option that tells `body-parser` which parsing needs to be used. When `extended=false` it uses the classic encoding `querystring` library. When `extended=true` it uses `qs` library for parsing. + +When using `extended=false`, values can be only strings or arrays. The object returned when using `querystring` does not prototypically inherit from the default JavaScript `Object`, which means functions like `hasOwnProperty`, `toString` will not be available. The extended version allows more data flexibility, but it is outmatched by JSON. # --hints-- -应该挂载“body-parser”中间件 +The 'body-parser' middleware should be mounted ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-analysis-example-a.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-analysis-example-a.md index 9a24560aa9..ba6b4e7636 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-analysis-example-a.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-analysis-example-a.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c14d -title: Data Analysis Example A +title: 数据分析 案例 A challengeType: 11 videoId: nVAaxZ34khk dashedName: data-analysis-example-a @@ -8,34 +8,34 @@ dashedName: data-analysis-example-a # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +更多资料: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/FreeCodeCamp-Pandas-Real-Life-Example) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/FreeCodeCamp-Pandas-Real-Life-Example) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -What does the shape of our dataframe tell us? +数据框架的形状表示了什么意义?从中我们又能够了解到什么? ## --answers-- -The size in gigabytes the dataframe we loaded into memory is. +我们加载到内存中的数据帧大小为千兆字节。 --- -How many rows and columns our dataframe has. +我们的数据框架有多少行和多少列? --- -How many rows the source data had before loading. +在加载数据前,源数据中有多少行? --- -How many columns the source data had before loading. +在加载数据前,源数据中有多少列? ## --video-solution-- diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-analysis-example-b.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-analysis-example-b.md index 199b47762e..0c75ad326b 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-analysis-example-b.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-analysis-example-b.md @@ -8,7 +8,7 @@ dashedName: data-analysis-example-b # --description-- -*您可以使用 Google Colab,而不是像视频中显示的那样使用 notebooks.ai。* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* 更多资源: diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-and-visualizations.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-and-visualizations.md index 13cd90fb08..01d3eda975 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-and-visualizations.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-and-visualizations.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c160 -title: Data Cleaning and Visualizations +title: 数据清理和可视化 challengeType: 11 videoId: mHjxzFS5_Z0 dashedName: data-cleaning-and-visualizations @@ -8,18 +8,18 @@ dashedName: data-cleaning-and-visualizations # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +更多资源: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/data-cleaning-rmotr-freecodecamp) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/data-cleaning-rmotr-freecodecamp) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -When using Matplotlib's global API, what does the order of numbers mean here? +当使用 Matplotlib 的全局 API 时,数字的顺序在这里意味着什么? ```py plt.subplot(1, 2, 1) @@ -27,15 +27,15 @@ plt.subplot(1, 2, 1) ## --answers-- -My figure will have one column, two rows, and I am going to start drawing in the first (left) plot. +这里将创建一个图像包括一列、两行,并且我将开始在第一个图(左)绘图。 --- -I am going to start drawing in the first (left) plot, my figure will have two rows, and my figure will have one column. +我将开始在第一个图表(左)绘图,同时我的图像将有两行,也将有一列。 --- -My figure will have one row, two columns, and I am going to start drawing in the first (left) plot. +这里将创建一个图像包括一行、两列,并且我将开始在第一个图表(左)绘图。 ## --video-solution-- diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-duplicates.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-duplicates.md index cf159cead1..ea12e9403f 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-duplicates.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-duplicates.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c15f -title: Data Cleaning Duplicates +title: 数据 清理重复项 challengeType: 11 videoId: kj7QqjXhH6A dashedName: data-cleaning-duplicates @@ -8,30 +8,30 @@ dashedName: data-cleaning-duplicates # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +以下有更多的资料: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/data-cleaning-rmotr-freecodecamp) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/data-cleaning-rmotr-freecodecamp) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -The Python method `.duplicated()` returns a boolean Series for your DataFrame. `True` is the return value for rows that: +Python 方法 `.duplicated()` 将针对你的 DataFrame 返回一个储存着布尔值的 Series。 `True` 是行的返回值: ## --answers-- -contain a duplicate, where the value for the row contains the first occurrence of that value. +包含一个重复值,并且它表示了在这一行这一重复值第一次出现。 --- -contain a duplicate, where the value for the row is at least the second occurrence of that value. +包含一个重复值,并且它表示了在这一行这一重复值至少第二次出现。 --- -contain a duplicate, where the value for the row contains either the first or second occurrence. +包含一个重复值,并且它表示了在这一行这一重复值第一次或第二次出现。 ## --video-solution-- diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-introduction.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-introduction.md index deba27b6e6..c094124dea 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-introduction.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-introduction.md @@ -8,7 +8,7 @@ dashedName: data-cleaning-introduction # --description-- -*您可以使用 Google Colab,而不是像视频中显示的那样使用 notebooks.ai。* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* 以下有更多的资料: diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-with-dataframes.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-with-dataframes.md index 887af41702..711c7fae06 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-with-dataframes.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-with-dataframes.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c15e -title: Data Cleaning with DataFrames +title: DataFrames 中的数据清理 challengeType: 11 videoId: sTMN_pdI6S0 dashedName: data-cleaning-with-dataframes @@ -8,18 +8,18 @@ dashedName: data-cleaning-with-dataframes # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +以下有更多的资料: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/data-cleaning-rmotr-freecodecamp) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/data-cleaning-rmotr-freecodecamp) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -What will the following code print out? +以下代码会打印出什么? ```py import pandas as pd diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/how-to-use-jupyter-notebooks-intro.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/how-to-use-jupyter-notebooks-intro.md index 4ac7363d87..b51b0701cb 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/how-to-use-jupyter-notebooks-intro.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/how-to-use-jupyter-notebooks-intro.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c14f -title: How to use Jupyter Notebooks Intro +title: 如何使用 Jupyter Notebook challengeType: 11 videoId: h8caJq2Bb9w dashedName: how-to-use-jupyter-notebooks-intro @@ -8,19 +8,18 @@ dashedName: how-to-use-jupyter-notebooks-intro # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +更多资源: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/ds-content-interactive-jupyterlab-tutorial) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) -- [Twitter Cheat Sheet](https://twitter.com/rmotr_com/status/1122176794696847361) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/ds-content-interactive-jupyterlab-tutorial) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -What is **not** allowed in a Jupyter Notebook's cell? +以下哪个是 Jupyter Notebook 单元格中**不**允许的? ## --answers-- @@ -28,11 +27,11 @@ Markdown --- -Python code +Python 代码 --- -An Excel sheet +Excel 工作表 ## --video-solution-- diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/introduction-to-data-analysis.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/introduction-to-data-analysis.md index a092ad93a8..0bb7ecc1d1 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/introduction-to-data-analysis.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/introduction-to-data-analysis.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c14c -title: Introduction to Data Analysis +title: 数据分析简介 challengeType: 11 videoId: VJrP2FUzKP0 dashedName: introduction-to-data-analysis @@ -8,33 +8,32 @@ dashedName: introduction-to-data-analysis # --description-- -More resources: +以下有更多的资料: -\- [Slides](https://docs.google.com/presentation/d/1fDpjlyMiOMJyuc7_jMekcYLPP2XlSl1eWw9F7yE7byk) +\- [幻灯片](https://docs.google.com/presentation/d/1cUIt8b2ySz-85_ykfeuuWsurccwTAuFPn782pZBzFsU/edit?usp=sharing) # --question-- ## --text-- -Why should you choose R over Python for data analysis? +以下哪一项 **不是** 数据分析的一部分? ## --answers-- -It's simple to learn. +建立统计模型和数据可视化。 --- -It's better at dealing with advanced statistical methods. +为分析选择所需的结论。 --- -There are many powerful libraries that support R. +修复不正确的值并删除无效数据。 --- -It's free and open source. +将数据转换为适当的数据结构。 ## --video-solution-- 2 - diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/jupyter-notebooks-cells.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/jupyter-notebooks-cells.md index 137b9f53bd..bd2da8504d 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/jupyter-notebooks-cells.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/jupyter-notebooks-cells.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c150 -title: Jupyter Notebooks Cells +title: Jupyter Notebooks 单元格 challengeType: 11 videoId: 5PPegAs9aLA dashedName: jupyter-notebooks-cells @@ -8,31 +8,30 @@ dashedName: jupyter-notebooks-cells # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +更多资源: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/ds-content-interactive-jupyterlab-tutorial) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) -- [Twitter Cheat Sheet](https://twitter.com/rmotr_com/status/1122176794696847361) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/ds-content-interactive-jupyterlab-tutorial) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -What are the three main types of Jupyter Notebook Cell? +Jupyter Notebook 单元格支持的三种主要类型是什么? ## --answers-- -Code, Markdown, and Python +Code、Markdown 和 Python --- -Code, Markdown, and Raw +Code、Markdown 和 Raw --- -Markdown, Python, and Raw +Markdown、Python 和 Raw ## --video-solution-- diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/jupyter-notebooks-importing-and-exporting-data.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/jupyter-notebooks-importing-and-exporting-data.md index 104edcae19..54b815d19c 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/jupyter-notebooks-importing-and-exporting-data.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/jupyter-notebooks-importing-and-exporting-data.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c151 -title: Jupyter Notebooks Importing and Exporting Data +title: 在 Jupyter Notebooks 中导入和导出数据 challengeType: 11 videoId: k1msxD3JIxE dashedName: jupyter-notebooks-importing-and-exporting-data @@ -8,39 +8,38 @@ dashedName: jupyter-notebooks-importing-and-exporting-data # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +更多资源: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/ds-content-interactive-jupyterlab-tutorial) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) -- [Twitter Cheat Sheet](https://twitter.com/rmotr_com/status/1122176794696847361) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/ds-content-interactive-jupyterlab-tutorial) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -What kind of data can you import and work with in a Jupyter Notebook? +你可以在 Jupyter Notebook 中导入和使用什么样的数据? ## --answers-- -Excel files. +Excel 文件。 --- -CSV files. +CSV 文件。 --- -XML files. +XML 文件 --- -Data from an API. +来自 API 的数据 --- -All of the above. +以上全部内容 ## --video-solution-- diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-algebra-and-size.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-algebra-and-size.md index 454f7c5646..794419854a 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-algebra-and-size.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-algebra-and-size.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c157 -title: Numpy Algebra and Size +title: Numpy 代数和大小 challengeType: 11 videoId: XAT97YLOKD8 dashedName: numpy-algebra-and-size @@ -8,34 +8,34 @@ dashedName: numpy-algebra-and-size # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +以下有更多的资料: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-numpy) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-numpy) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -What is the relationship between size of objects (such as lists and datatypes) in memory in Python's standard library and the NumPy library? Knowing this, what are the implications for performance? +内存中,对象的大小(例如列表和数据类型)在 Python 标准库和 NumPy 库之间有什么关系? 知道这一点,对性能有何影响? ## --answers-- -Standard Python objects take up much more memory to store than NumPy objects; operations on comparable standard Python and NumPy objects complete in roughly the same time. +标准的 Python 对象占用了比 NumPy 对象更多的内存;标准的 Python 和 NumPy 对象完成的操作时间是大致相同的。 --- -NumPy objects take up much more memory than standard Python objects; operations on NumPy objects complete very quickly compared to comparable objects in standard Python. +Numpy 对象比标准的 Python 对象占用更多的内存;Numpy 的对象相比较标准的 Python 更快地完成操作。 --- -NumPy objects take up much less memory than Standard Python objects; operations on Standard Python objects complete very quickly compared to comparable objects on NumPy Object. +Numpy 对象比标准的 Python 对象占用更少的内存;标准 Python 的对象相比较 Numpy 的对象更快地完成操作。 --- -Standard Python objects take up more memory than NumPy objects; operations on NumPy objects complete very quickly compared to comparable objects in standard Python. +标准 Python 的对象比 Numpy 的对象占用更多的内存;Numpy 的对象相比较标准 Python 的对象更快地完成操作。 ## --video-solution-- diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-arrays.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-arrays.md index b5504e836e..8b2df714dd 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-arrays.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-arrays.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c154 -title: Numpy Arrays +title: Numpy 数组 challengeType: 11 videoId: VDYVFHBL1AM dashedName: numpy-arrays @@ -8,18 +8,18 @@ dashedName: numpy-arrays # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +以下有更多的资料: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-numpy) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-numpy) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -What will the following code print out? +以下代码会打印出什么? ```py A = np.array([ diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-boolean-arrays.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-boolean-arrays.md index f271dff4b0..93d2813af5 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-boolean-arrays.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-boolean-arrays.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c156 -title: Numpy Boolean Arrays +title: Numpy 布尔值的数组 challengeType: 11 videoId: N1ttsMmcVMM dashedName: numpy-boolean-arrays @@ -8,18 +8,18 @@ dashedName: numpy-boolean-arrays # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +以下有更多的资料: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-numpy) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-numpy) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -What will the following code print out? +以下代码会打印出什么? ```py a = np.arange(5) diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-introduction-a.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-introduction-a.md index fc38697f40..b7bbc92430 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-introduction-a.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-introduction-a.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c152 -title: Numpy Introduction A +title: Numpy 简介 A challengeType: 11 videoId: P-JjV6GBCmk dashedName: numpy-introduction-a @@ -8,30 +8,30 @@ dashedName: numpy-introduction-a # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +以下有更多的资料: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-numpy) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-numpy) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -Why is Numpy an important, but unpopular Python library? +为什么 Numpy 是一个重要的却又不流行的 Python 库? ## --answers-- -Often you won't work directly with Numpy. +你常常不会直接使用 Numpy。 --- -It is extremely slow. +它是极其缓慢的。 --- -Working with Numpy is difficult. +使用 Numpy 的难度是很大的。 ## --video-solution-- diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-introduction-b.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-introduction-b.md index a863e42074..6188c1f81b 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-introduction-b.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-introduction-b.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c153 -title: Numpy Introduction B +title: Numpy 简介 B challengeType: 11 videoId: YIqgrNLAZkA dashedName: numpy-introduction-b @@ -8,34 +8,34 @@ dashedName: numpy-introduction-b # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +以下有更多的资料: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-numpy) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-numpy) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -About how much memory does the integer `5` consume in plain Python? +整数 `5` 在 Python 中消耗多少内存? ## --answers-- -32 bits +32 位 --- -20 bytes +20 字节 --- -16 bytes +16 字节 --- -8 bits +8 位 ## --video-solution-- diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-operations.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-operations.md index 0072c84019..fc7dff6583 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-operations.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/numpy-operations.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c155 -title: Numpy Operations +title: Numpy 的运算 challengeType: 11 videoId: eqSVcJbaPdk dashedName: numpy-operations @@ -8,18 +8,18 @@ dashedName: numpy-operations # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +更多资源: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-numpy) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-numpy) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -What is the value of `a` after you run the following code? +运行以下代码后, `a` 的值是多少? ```py a = np.arange(5) diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-conditional-selection-and-modifying-dataframes.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-conditional-selection-and-modifying-dataframes.md index 3d17a73a55..93ec246e45 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-conditional-selection-and-modifying-dataframes.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-conditional-selection-and-modifying-dataframes.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c15b -title: Pandas Conditional Selection and Modifying DataFrames +title: Pandas 条件选择和 DataFrames 的修改 challengeType: 11 videoId: BFlH0fN5xRQ dashedName: pandas-conditional-selection-and-modifying-dataframes @@ -8,18 +8,18 @@ dashedName: pandas-conditional-selection-and-modifying-dataframes # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +以下有更多的资料: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-pandas) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-pandas) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -What will the following code print out? +以下代码会打印出什么? ```py import pandas as pd diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-creating-columns.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-creating-columns.md index 7d20f76c4a..df5ffb6df6 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-creating-columns.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-creating-columns.md @@ -1,6 +1,6 @@ --- id: 5e9a093a74c4063ca6f7c15c -title: Pandas Creating Columns +title: Pandas 创建列 challengeType: 11 videoId: _sSo2XZoB3E dashedName: pandas-creating-columns @@ -8,18 +8,18 @@ dashedName: pandas-creating-columns # --description-- -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.* +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。* -More resources: +以下有更多的资料: -- [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-pandas) -- [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) +- [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-pandas) +- [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb) # --question-- ## --text-- -What code would add a "Certificates per month" column to the `certificates_earned` DataFrame like the one below? +哪段代码可以向 DataFrame `certificates_earned` 中添加一个 “Certificates per month” 列,就像下面所展示的?

                Certificates  Time (in months)  Certificates per month
           Tom               8                16                    0.50
          diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-dataframes.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-dataframes.md
          index fd5eedb176..5f90574945 100644
          --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-dataframes.md
          +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-dataframes.md
          @@ -8,18 +8,18 @@ dashedName: pandas-dataframes
           
           # --description--
           
          -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.*
          +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。*
           
          -More resources:
          +以下有更多的资料:
           
          --   [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-pandas)
          --   [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
          +-   [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-pandas)
          +-   [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
           
           # --question--
           
           ## --text--
           
          -What will the following code print out?
          +以下代码会打印出什么?
           
           ```py
           import pandas as pd
          diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-indexing-and-conditional-selection.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-indexing-and-conditional-selection.md
          index 1107f217f4..77eb5b040a 100644
          --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-indexing-and-conditional-selection.md
          +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-indexing-and-conditional-selection.md
          @@ -1,6 +1,6 @@
           ---
           id: 5e9a093a74c4063ca6f7c159
          -title: Pandas Indexing and Conditional Selection
          +title: Pandas 索引和条件选择
           challengeType: 11
           videoId: '-ZOrgV_aA9A'
           dashedName: pandas-indexing-and-conditional-selection
          @@ -8,18 +8,18 @@ dashedName: pandas-indexing-and-conditional-selection
           
           # --description--
           
          -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.*
          +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。*
           
          -More resources:
          +以下有更多的资料:
           
          --   [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-pandas)
          --   [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
          +-   [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-pandas)
          +-   [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
           
           # --question--
           
           ## --text--
           
          -What will the following code print out?
          +以下代码会打印出什么?
           
           ```py
           import pandas as pd
          diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-introduction.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-introduction.md
          index 45a30bc050..5d0f59f6c1 100644
          --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-introduction.md
          +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/pandas-introduction.md
          @@ -1,6 +1,6 @@
           ---
           id: 5e9a093a74c4063ca6f7c158
          -title: Pandas Introduction
          +title: Pandas 简介
           challengeType: 11
           videoId: 0xACW-8cZU0
           dashedName: pandas-introduction
          @@ -8,18 +8,18 @@ dashedName: pandas-introduction
           
           # --description--
           
          -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.*
          +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。*
           
          -More resources:
          +以下有更多的资料:
           
          --   [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-pandas)
          --   [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
          +-   [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/freecodecamp-intro-to-pandas)
          +-   [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
           
           # --question--
           
           ## --text--
           
          -What will the following code print out?
          +以下代码会打印出什么?
           
           ```py
           import pandas as pd
          diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.md
          index 284a5eabab..6ef68b014f 100644
          --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.md
          +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.md
          @@ -1,6 +1,6 @@
           ---
           id: 5e9a093a74c4063ca6f7c164
          -title: Parsing HTML and Saving Data
          +title: 解析 HTML 和保存数据
           challengeType: 11
           videoId: bJaqnTWQmb0
           dashedName: parsing-html-and-saving-data
          @@ -8,18 +8,18 @@ dashedName: parsing-html-and-saving-data
           
           # --description--
           
          -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.*
          +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。*
           
          -More resources:
          +更多资源:
           
          --   [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas)
          --   [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
          +-   [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/tree/master/unit-1-reading-data-with-python-and-pandas/lesson-17-reading-html-tables/files)
          +-   [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
           
           # --question--
           
           ## --text--
           
          -What Python library has the `.read_html()` method we can we use for parsing HTML documents and extracting tables?
          +为了解析 HTML 文本和提取表格,`.read_html()` 位于哪个 Python 的库?
           
           ## --answers--
           
          diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/python-functions-and-collections.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/python-functions-and-collections.md
          index 75a9a71e77..c222c7abc9 100644
          --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/python-functions-and-collections.md
          +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/python-functions-and-collections.md
          @@ -1,6 +1,6 @@
           ---
           id: 5e9a093a74c4063ca6f7c166
          -title: Python Functions and Collections
          +title: Python 函数和集合
           challengeType: 11
           videoId: NzpU17ZVlUw
           dashedName: python-functions-and-collections
          @@ -8,30 +8,30 @@ dashedName: python-functions-and-collections
           
           # --description--
           
          -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.*
          +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。*
           
          -More resources:
          +更多资源:
           
          --   [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/ds-content-python-under-10-minutes)
          --   [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
          +-   [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/ds-content-python-under-10-minutes)
          +-   [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
           
           # --question--
           
           ## --text--
           
          -What is the main difference between lists and tuples in Python?
          +在 Python 中,列表和元组有什么主要的区别?
           
           ## --answers--
           
          -Tuples are immutable.
          +元组是不可改变的。
           
           ---
           
          -Lists are ordered.
          +列表是有顺序的。
           
           ---
           
          -Tuples are unordered.
          +元组是无序的。
           
           ## --video-solution--
           
          diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/python-introduction.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/python-introduction.md
          index f67c83c389..c9e2078c58 100644
          --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/python-introduction.md
          +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/python-introduction.md
          @@ -1,6 +1,6 @@
           ---
           id: 5e9a093a74c4063ca6f7c165
          -title: Python Introduction
          +title: Python 简介
           challengeType: 11
           videoId: PrQV9JkLhb4
           dashedName: python-introduction
          @@ -8,34 +8,34 @@ dashedName: python-introduction
           
           # --description--
           
          -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.*
          +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。*
           
          -More resources:
          +更多资源:
           
          --   [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/ds-content-python-under-10-minutes)
          --   [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
          +-   [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/ds-content-python-under-10-minutes)
          +-   [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
           
           # --question--
           
           ## --text--
           
          -How do we define blocks of code in the body of functions in Python?
          +我们如何在 Python 函数中定义代码块?
           
           ## --answers--
           
          -We use a set of curly braces, one on either side of each new block of our code.
          +我们可以在代码的每个新区块的两侧使用一组大括号。
           
           ---
           
          -We use indentation, usually right-aligned 4 spaces.
          +我们使用缩进,通常是右对齐的 4 个空格。
           
           ---
           
          -We do not denote blocks of code.
          +我们不用指示出代码块。
           
           ---
           
          -We could use curly braces or indentation to denote blocks of code.
          +我们可以使用大括号或缩进来指示出代码块。
           
           ## --video-solution--
           
          diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/python-iteration-and-modules.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/python-iteration-and-modules.md
          index 4d4350768f..5dfc4f7aff 100644
          --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/python-iteration-and-modules.md
          +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/python-iteration-and-modules.md
          @@ -1,6 +1,6 @@
           ---
           id: 5e9a093a74c4063ca6f7c167
          -title: Python Iteration and Modules
          +title: Python 迭代和模块
           challengeType: 11
           videoId: XzosGWLafrY
           dashedName: python-iteration-and-modules
          @@ -8,18 +8,18 @@ dashedName: python-iteration-and-modules
           
           # --description--
           
          -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.*
          +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。*
           
          -More resources:
          +更多资源:
           
          --   [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/ds-content-python-under-10-minutes)
          --   [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
          +-   [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/ds-content-python-under-10-minutes)
          +-   [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
           
           # --question--
           
           ## --text--
           
          -How would you iterate over and print the keys and values of a dictionary named `user`?
          +您将如何迭代并打印名为 `user` 的字典的键和值?
           
           ## --answers--
           
          diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.md
          index 18d6487a0a..62b97b1722 100644
          --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.md
          +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.md
          @@ -1,6 +1,6 @@
           ---
           id: 5e9a093a74c4063ca6f7c162
          -title: Reading Data CSV and TXT
          +title: 从 CSV 和 TXT 中读取数据
           challengeType: 11
           videoId: ViGEv0zOzUk
           dashedName: reading-data-csv-and-txt
          @@ -8,18 +8,18 @@ dashedName: reading-data-csv-and-txt
           
           # --description--
           
          -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.*
          +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。*
           
          -More resources:
          +以下有更多的资料:
           
          --   [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas)
          --   [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
          +-   [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/tree/master/unit-1-reading-data-with-python-and-pandas/lesson-1-reading-csv-and-txt-files/files)
          +-   [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
           
           # --question--
           
           ## --text--
           
          -How would you import the CSV file `data.csv` and store it in a DataFrame using the Pandas module?
          +你如何使用 Pandas 模块导入 CSV 文件 `data.csv` 并且存储到 DataFrame 中?
           
           ## --answers--
           
          diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.md
          index 5502a07e7a..d4534c8a40 100644
          --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.md
          +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.md
          @@ -1,6 +1,6 @@
           ---
           id: 5e9a093a74c4063ca6f7c163
          -title: Reading Data from Databases
          +title: 从数据库中读取数据
           challengeType: 11
           videoId: MtgXS1MofRw
           dashedName: reading-data-from-databases
          @@ -8,30 +8,30 @@ dashedName: reading-data-from-databases
           
           # --description--
           
          -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.*
          +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。*
           
          -More resources:
          +以下有更多的资料
           
          --   [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas)
          --   [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
          +-   [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/tree/master/unit-1-reading-data-with-python-and-pandas/lesson-11-reading-data-from-relational-databases/files)
          +-   [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
           
           # --question--
           
           ## --text--
           
          -What method does a `Cursor` instance have and what does it allow?
          +`Cursor` 实例中都有什么方法,这些方法能用来做什么?
           
           ## --answers--
           
          -The `Cursor` instance has a `.run()` method which allows you to run SQL queries.
          +`Cursor` 实例中有方法 `.run()` ,它允许你运行 SQL 查询语句。
           
           ---
           
          -The `Cursor` instance has a `.select()` method which allows you to select records.
          +`Cursor` 实例中有方法 `.select()` ,它允许你选择记录。
           
           ---
           
          -The `Cursor` instance has an `.execute()` method which will receive SQL parameters to run against the database.
          +`Cursor` 实例有方法 `.execute()` , 它能够接收在数据库中运行的 SQL 参数。
           
           ## --video-solution--
           
          diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.md
          index a16b2d0176..a3fbcd4eeb 100644
          --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.md
          +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.md
          @@ -1,6 +1,6 @@
           ---
           id: 5e9a093a74c4063ca6f7c161
          -title: Reading Data Introduction
          +title: 读取数据简介
           challengeType: 11
           videoId: cDnt02BcHng
           dashedName: reading-data-introduction
          @@ -8,18 +8,18 @@ dashedName: reading-data-introduction
           
           # --description--
           
          -*Instead of using notebooks.ai like it shows in the video, you can use Google Colab instead.*
          +*在视频中我们使用的编辑器工具是在 notebook.ai 这个平台,你也可以选择用其他的平台,比如说 Google Colab 也是一个不错的选择。*
           
          -More resources:
          +以下有更多的资料:
           
          --   [Notebooks on GitHub](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas)
          --   [How to open Notebooks from GitHub using Google Colab.](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
          +-   [在 GitHub 平台的 Notebooks](https://github.com/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/tree/master/unit-1-reading-data-with-python-and-pandas/lesson-1-reading-csv-and-txt-files/files)
          +-   [如何使用 Google Colab 来打开 GitHub 上的 Notebooks](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)
           
           # --question--
           
           ## --text--
           
          -Given a file named `certificates.csv` with these contents:
          +文件 `certificates.csv` 有以下内容:
           
           
           Name$Certificates$Time (in months)
          @@ -29,7 +29,7 @@ Ahmad$5$9
           Beau$6$12
           
          -Fill in the blanks for the missing arguments below: +请填写以下缺失的参数: ```py import csv diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/demographic-data-analyzer.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/demographic-data-analyzer.md index 66246f3d5d..b689408a1a 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/demographic-data-analyzer.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/demographic-data-analyzer.md @@ -1,23 +1,24 @@ --- id: 5e46f7e5ac417301a38fb929 -title: Demographic Data Analyzer +title: 人口统计数据分析器 challengeType: 10 +forumTopicId: 462367 dashedName: demographic-data-analyzer --- # --description-- -In this challenge you must analyze demographic data using Pandas. You are given a dataset of demographic data that was extracted from the 1994 Census database. +在这个挑战中,你必须使用 Pandas 对人口统计进行分析。 你将获得从 1994 年人口普查数据库中提取的人口统计数据数据集。 -You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-demographic-data-analyzer). +你可以[在 Replit 上查看整个项目的具体描述和初始代码](https://replit.com/github/freeCodeCamp/boilerplate-demographic-data-analyzer)。 -After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. +点击此链接,fork 这个项目。 一旦你根据 “README.md” 中的说明完成项目,请提交你的项目链接到下面。 -We are still developing the interactive instructional part of the data analysis with Python curriculum. For now, you will have to use other resources to learn how to pass this challenge. +我们仍在开发 Python 数据分析课程的交互式教学。 现在,你需要使用其他资源来学习如何通过这一挑战。 # --hints-- -It should pass all Python tests. +它应该通过所有的 Python 测试。 ```js diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/medical-data-visualizer.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/medical-data-visualizer.md index 4d7cfc2f13..5d2bcd36b2 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/medical-data-visualizer.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/medical-data-visualizer.md @@ -1,23 +1,24 @@ --- id: 5e46f7f8ac417301a38fb92a -title: Medical Data Visualizer +title: 医疗数据可视化工具 challengeType: 10 +forumTopicId: 462368 dashedName: medical-data-visualizer --- # --description-- -In this project, you will visualize and make calculations from medical examination data using matplotlib, seaborn, and pandas. +在这个项目中,你将要使用 matplotlib,seaborn 和 pandas 来对健康检查数据进行数据可视化和计算。 -You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-medical-data-visualizer). +你可以[在 Replit 上查看整个项目的具体描述和初始代码](https://replit.com/github/freeCodeCamp/boilerplate-medical-data-visualizer)。 -After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. +打开此链接后,fork 这个项目。 一旦你根据 “README.md” 中的说明完成项目,请提交你的项目到下面的链接。 -We are still developing the interactive instructional part of the data analysis with Python curriculum. For now, you will have to use other resources to learn how to pass this challenge. +我们仍在开发 Python 数据分析课程的交互式课程部分。 现在,你需要使用其他资源来学习如何通过这一挑战。 # --hints-- -It should pass all Python tests. +它应该通过所有的 Python 测试。 ```js diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md index b33d2eeed6..aba7f8e37d 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md @@ -1,23 +1,24 @@ --- id: 5e46f802ac417301a38fb92b -title: Page View Time Series Visualizer +title: 页面访问量的时间序列可视化工具 challengeType: 10 +forumTopicId: 462369 dashedName: page-view-time-series-visualizer --- # --description-- -For this project you will visualize time series data using a line chart, bar chart, and box plots. You will use Pandas, matplotlib, and seaborn to visualize a dataset containing the number of page views each day on the freeCodeCamp.org forum from 2016-05-09 to 2019-12-03. The data visualizations will help you understand the patterns in visits and identify yearly and monthly growth. +对于这个项目,你将使用线图、条形图和箱形图对时间序列数据进行可视化。 你将要使用 Pandas、matplotlib 和 seaborn 来对数据集进行可视化,这个数据集包含从 2016-05-09 到 2019-12-03 每一天在 freeCodeCamp.org 论坛的页面访问量。 这个数据可视化将帮助你了解访问的模式,并且显示年增长和月增长情况。 -You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-page-view-time-series-visualizer). +你可以 [在 Replit 上查看整个项目的具体描述和初始代码](https://replit.com/github/freeCodeCamp/boilerplate-page-view-time-series-visualizer)。 -After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. +点击此链接,fork 这个项目。 一旦你根据 “README.md” 中的说明完成项目,请提交你的项目到下面的链接。 -We are still developing the interactive instructional part of the data analysis with Python curriculum. For now, you will have to use other resources to learn how to pass this challenge. +我们仍在开发 Python 数据分析课程的交互式课程部分。 现在,你将需要使用其他资源来学习如何通过这一挑战。 # --hints-- -It should pass all Python tests. +它应该通过所有的 Python 测试。 ```js diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md index 58075caec0..2642541fbe 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md @@ -1,23 +1,24 @@ --- id: 5e4f5c4b570f7e3a4949899f -title: Sea Level Predictor +title: 海平面预报器 challengeType: 10 +forumTopicId: 462370 dashedName: sea-level-predictor --- # --description-- -In this project, you will analyze a dataset of the global average sea level change since 1880. You will use the data to predict the sea level change through year 2050. +在本项目中,您将分析自 1880 年以来全球平均海平面变化的数据集。 您将使用这些数据来预测到 2050 年的海平面变化。 -You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-sea-level-predictor). +你可以在 [Replit 上查看整个项目的具体描述和初始代码](https://replit.com/github/freeCodeCamp/boilerplate-sea-level-predictor)。 -After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. +打开此链接后,fork 这个项目。 一旦你根据 “README.md” 中的说明完成项目,请提交你的项目到下面的链接。 -We are still developing the interactive instructional part of the data analysis with Python curriculum. For now, you will have to use other resources to learn how to pass this challenge. +我们仍在开发 Python 数据分析课程的交互式课程部分。 现在,你需要使用其他资源来学习如何通过这一挑战。 # --hints-- -It should pass all Python tests. +它应该通过所有的 Python 测试。 ```js diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/accessing-and-changing-elements,-rows,-columns.md b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/accessing-and-changing-elements,-rows,-columns.md index 3c833be5ad..84b9829df3 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/accessing-and-changing-elements,-rows,-columns.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/accessing-and-changing-elements,-rows,-columns.md @@ -1,6 +1,6 @@ --- id: 5e9a0a8e09c5df3cc3600ed4 -title: 'Accessing and Changing Elements, Rows, Columns' +title: '访问与更改元素、行和列' challengeType: 11 videoId: v-7Y7koJ_N0 dashedName: accessing-and-changing-elements-rows-columns @@ -10,7 +10,7 @@ dashedName: accessing-and-changing-elements-rows-columns ## --text-- -What code would change the values in the 3rd column of both of the following Numpy arrays to 20? +以下哪行代码将下面的 Numpy 数组的第三行的数值都更改成 20? ```py a = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/basics-of-numpy.md b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/basics-of-numpy.md index 57b1924af7..3541050a5c 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/basics-of-numpy.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/basics-of-numpy.md @@ -1,6 +1,6 @@ --- id: 5e9a0a8e09c5df3cc3600ed3 -title: Basics of Numpy +title: Numpy 的基础知识 challengeType: 11 videoId: f9QrZrKQMLI dashedName: basics-of-numpy @@ -10,7 +10,7 @@ dashedName: basics-of-numpy ## --text-- -What will the following code print? +以下代码将打印出什么? ```python b = np.array([[1.0,2.0,3.0],[3.0,4.0,5.0]]) diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/copying-arrays-warning.md b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/copying-arrays-warning.md index afe7b8d83e..9caa41d2b8 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/copying-arrays-warning.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/copying-arrays-warning.md @@ -1,6 +1,6 @@ --- id: 5e9a0a8e09c5df3cc3600ed7 -title: Copying Arrays Warning +title: 复制数组警告 challengeType: 11 videoId: iIoQ0_L0GvA dashedName: copying-arrays-warning @@ -10,7 +10,7 @@ dashedName: copying-arrays-warning ## --text-- -What is the value of `a` after running the following code? +运行以下代码后, `a` 的值是多少? ```py import numpy as np diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/initialize-array-problem.md b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/initialize-array-problem.md index 34e8f27604..347ad52689 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/initialize-array-problem.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/initialize-array-problem.md @@ -1,6 +1,6 @@ --- id: 5e9a0a8e09c5df3cc3600ed6 -title: Initialize Array Problem +title: 初始化数组问题 challengeType: 11 videoId: 0jGfH8BPfOk dashedName: initialize-array-problem @@ -10,7 +10,7 @@ dashedName: initialize-array-problem ## --text-- -What is another way to produce the following array? +产生以下数组的另一种方式是什么? ```py [[0. 0. 0. 0. 0. 0. 0.] diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/initializing-different-arrays.md b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/initializing-different-arrays.md index a6957cc7e4..199f5dc752 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/initializing-different-arrays.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/initializing-different-arrays.md @@ -1,6 +1,6 @@ --- id: 5e9a0a8e09c5df3cc3600ed5 -title: Initializing Different Arrays +title: 初始化不同的数组 challengeType: 11 videoId: CEykdsKT4U4 dashedName: initializing-different-arrays @@ -10,7 +10,7 @@ dashedName: initializing-different-arrays ## --text-- -What will the following code print? +以下代码将打印出什么? ```py a = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/mathematics.md b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/mathematics.md index f3b1a3c111..1745fc2d40 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/mathematics.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/mathematics.md @@ -1,6 +1,6 @@ --- id: 5e9a0a8e09c5df3cc3600ed8 -title: Mathematics +title: 数学 challengeType: 11 videoId: 7txegvyhtVk dashedName: mathematics @@ -10,7 +10,7 @@ dashedName: mathematics ## --text-- -What is the value of `b` after running the following code? +运行以下代码后, `b` 的值是多少? ```py import numpy as np diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/reorganizing-arrays.md b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/reorganizing-arrays.md index 7e4903c864..44a77fb4bc 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/reorganizing-arrays.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/numpy/reorganizing-arrays.md @@ -1,6 +1,6 @@ --- id: 5e9a0a8e09c5df3cc3600ed9 -title: Reorganizing Arrays +title: 重组数组 challengeType: 11 videoId: VNWAQbEM-C8 dashedName: reorganizing-arrays @@ -10,7 +10,7 @@ dashedName: reorganizing-arrays ## --text-- -What code would produce the following array? +哪个代码会生成下面的数组? ```py [[1. 1.] diff --git a/curriculum/challenges/chinese/09-information-security/information-security-projects/anonymous-message-board.md b/curriculum/challenges/chinese/09-information-security/information-security-projects/anonymous-message-board.md index 20970a8e21..66e96b9796 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-projects/anonymous-message-board.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-projects/anonymous-message-board.md @@ -1,6 +1,6 @@ --- id: 587d824a367417b2b2512c45 -title: Anonymous Message Board +title: 匿名留言板 challengeType: 4 forumTopicId: 301568 dashedName: anonymous-message-board @@ -8,38 +8,38 @@ dashedName: anonymous-message-board # --description-- -Build a full stack JavaScript app that is functionally similar to this: . +构建一个功能上与此相似的全栈式 JavaScript 应用程序:。 -Working on this project will involve you writing your code using one of the following methods: +在这个项目中,你将使用以下方法之一编写你的代码: -- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-messageboard/) and complete your project locally. -- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-messageboard) to complete your project. -- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. +- 克隆[这个 GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-messageboard/) 并在本地完成你的项目。 +- 使用 [我们的 Replit 启动项目](https://replit.com/github/freeCodeCamp/boilerplate-project-messageboard)来完成你的项目。 +- 使用一个你喜欢的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。 -When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field. +完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。 # --instructions-- -1. Set `NODE_ENV` to test without quotes when ready to write tests and DB to your databases connection string (in `.env`) -2. Recommended to create controllers/handlers and handle routing in `routes/api.js` -3. You will add any security features to `server.js` +1. 当准备写测试和数据库连接字符串时,设置`NODE_ENV`为不带引号的变量(在`.env`文件中)。 +2. 建议在 `routes/api.js` 中创建控制器/处理器并处理路由。 +3. 你将在 `server.js` 中添加任何安全功能。 -Write the following tests in `tests/2_functional-tests.js`: +在 `tests/2_functional-tests.js` 中编写下以下测试: -- Creating a new thread: POST request to `/api/threads/{board}` -- Viewing the 10 most recent threads with 3 replies each: GET request to `/api/threads/{board}` -- Deleting a thread with the incorrect password: DELETE request to `/api/threads/{board}` with an invalid `delete_password` -- Deleting a thread with the correct password: DELETE request to `/api/threads/{board}` with a valid `delete_password` -- Reporting a thread: PUT request to `/api/threads/{board}` -- Creating a new reply: POST request to `/api/replies/{board}` -- Viewing a single thread with all replies: GET request to `/api/replies/{board}` -- Deleting a reply with the incorrect password: DELETE request to `/api/threads/{board}` with an invalid `delete_password` -- Deleting a reply with the correct password: DELETE request to `/api/threads/{board}` with a valid `delete_password` -- Reporting a reply: PUT request to `/api/replies/{board}` +- 创建一个新的主题:发送 POST 请求到 `/api/threads/{board}`。 +- 查看最近的 10 个主题,每个主题有 3 个回复:发送 GET 请求到 `/api/threads/{board}` +- 使用错误密码删除主题:使用错误的`delete_password`向`/api/threads/{board}`发出DELETE请求 +- 用正确的密码删除一个主题:向`/api/threads/{board}`发出DELETE请求,并提供有效的`delete_password`。 +- 报告一个主题:发送 PUT 请求到 `/api/threads/{board}`。 +- 创建一个新的回复:发送 POST 请求到 `/api/replies/{board}`。 +- 查看一个带有所有回复的主题:发送 GET 请求到`/api/replies/{board}`。 +- 使用错误密码删除一个回复:使用无效的`delete_password`向`/api/replies/{board}`发出DELETE请求。 +- 使用正确密码删除一个回复:使用有效的`delete_password`向`/api/replies/{board}`发出DELETE请求。 +- 报告一个回复:发送 PUT 请求到 `/api/replies/{board}`。 # --hints-- -You can provide your own project, not the example URL. +提交自己的项目,而不是示例的 URL。 ```js (getUserInput) => { @@ -51,7 +51,7 @@ You can provide your own project, not the example URL. }; ``` -Only allow your site to be loaded in an iFrame on your own pages. +只允许你的网站在你自己的页面上以 iFrame 方式加载。 ```js async (getUserInput) => { @@ -61,7 +61,7 @@ async (getUserInput) => { }; ``` -Do not allow DNS prefetching. +不允许 DNS 预取。 ```js async (getUserInput) => { @@ -71,7 +71,7 @@ async (getUserInput) => { }; ``` -Only allow your site to send the referrer for your own pages. +只允许你的网站为你自己的页面发送 referrer 请求头。 ```js async (getUserInput) => { @@ -81,55 +81,81 @@ async (getUserInput) => { }; ``` -You can send a POST request to `/api/threads/{board}` with form data including `text` and `delete_password`. The saved database record will have at least the fields `_id`, `text`, `created_on`(date & time), `bumped_on`(date & time, starts same as `created_on`), `reported` (boolean), `delete_password`, & `replies` (array). +你可以向 `/api/threads/{board}` 发送一个 POST 请求,其中包括 `text` 和 `delete_password` 的表单数据。 保存的数据库记录将至少有 `_id`、`text`、`created_on`(date & time)、`bumped_on`(date & time, starts same as `created_on`)、`reported`(布尔值)、`delete_password`、& `replies`(数组)。 + +```js +async (getUserInput) => { + const date = new Date(); + const text = `fcc_test_${date}`; + const deletePassword = 'delete_me'; + const data = { text, delete_password: deletePassword }; + const url = getUserInput('url'); + const res = await fetch(url + '/api/threads/fcc_test', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(data) + }); + if (res.ok) { + const checkData = await fetch(url + '/api/threads/fcc_test'); + const parsed = await checkData.json(); + try { + assert.equal(parsed[0].text, text); + assert.isNotNull(parsed[0]._id); + assert.equal(new Date(parsed[0].created_on).toDateString(), date.toDateString()); + assert.equal(parsed[0].bumped_on, parsed[0].created_on); + assert.isArray(parsed[0].replies); + } catch (err) { + throw new Error(err.responseText || err.message); + } + } else { + throw new Error(`${res.status} ${res.statusText}`); + } +}; +``` + +你可以向 `/api/replies/{board}` 发送一个 POST 请求,其中包括字段 `text`、`delete_password` & `thread_id`。 这将更新 `bumped_on` 日期到评论日期。 在主题的 `replies` 数组中,将保存一个对象,至少有 `_id`、`text`、`created_on`、`delete_password`、& `reported` 这些属性。 ```js ``` -You can send a POST request to `/api/replies/{board}` with form data including `text`, `delete_password`, & `thread_id`. This will update the `bumped_on` date to the comment's date. In the thread's `replies` array, an object will be saved with at least the properties `_id`, `text`, `created_on`, `delete_password`, & `reported`. +你可以向 `/api/threads/{board}` 发送一个 GET 请求。 返回的将是一个数组,包括论坛上最近的 10 个被回复的主题,及每个主题最新的 3 个回帖。 `reported` 和 `delete_password` 字段将不会被发送到客户端。 ```js ``` -You can send a GET request to `/api/threads/{board}`. Returned will be an array of the most recent 10 bumped threads on the board with only the most recent 3 replies for each. The `reported` and `delete_password` fields will not be sent to the client. +你可以向 `/api/replies/{board}?thread_id={thread_id}` 发送一个 GET 请求。 返回的将是带有所有的回复的整个主题,不包括与之前测试相同的客户端字段。 ```js ``` -You can send a GET request to `/api/replies/{board}?thread_id={thread_id}`. Returned will be the entire thread with all its replies, also excluding the same fields from the client as the previous test. +你可以向 `/api/threads/{board}` 发送一个 DELETE 请求,并传递 `thread_id` & `delete_password` 来删除该线程。 返回的将是字符串 `incorrect password` 或 `success`。 ```js ``` -You can send a DELETE request to `/api/threads/{board}` and pass along the `thread_id` & `delete_password` to delete the thread. Returned will be the string `incorrect password` or `success`. +你可以向 `/api/replies/{board}` 发送一个 DELETE 请求,并传递 `thread_id`、`reply_id`、& `delete_password`。 返回的将是字符串 `incorrect password` 或 `success`。 成功后,`reply_id` 的文本将更改为 `[deleted]`。 ```js ``` -You can send a DELETE request to `/api/replies/{board}` and pass along the `thread_id`, `reply_id`, & `delete_password`. Returned will be the string `incorrect password` or `success`. On success, the text of the `reply_id` will be changed to `[deleted]`. +你可以向 `/api/threads/{board}` 发送一个 PUT 请求,并传递 `thread_id`。 返回的将是字符串 `success`。 `thread_id` 回复的 `reported` 值将改为 `true`。 ```js ``` -You can send a PUT request to `/api/threads/{board}` and pass along the `thread_id`. Returned will be the string `success`. The `reported` value of the `thread_id` will be changed to `true`. +你可以通过向 `/api/replies/{board}` 发送 PUT 请求并传递 `thread_id` & `reply_id`。 返回的将是字符串 `success`。 `reply_id` 的 `reported` 值将被改变为 `true`。 ```js ``` -You can send a PUT request to `/api/replies/{board}` and pass along the `thread_id` & `reply_id`. Returned will be the string `success`. The `reported` value of the `reply_id` will be changed to `true`. - -```js - -``` - -All 10 functional tests are complete and passing. +所有 10 项功能测试都已完成并通过。 ```js diff --git a/curriculum/challenges/chinese/09-information-security/information-security-projects/port-scanner.md b/curriculum/challenges/chinese/09-information-security/information-security-projects/port-scanner.md index 5c776ca7d0..f4b825d9d9 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-projects/port-scanner.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-projects/port-scanner.md @@ -1,33 +1,34 @@ --- id: 5e46f979ac417301a38fb932 -title: Port Scanner +title: 端口扫描器 challengeType: 10 +forumTopicId: 462372 helpCategory: Python dashedName: port-scanner --- # --description-- -Create a port scanner using Python. +使用 Python 创建一个端口扫描器。 -You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-port-scanner). +你可以访问 [Replit 上的完整项目描述和启动代码](https://replit.com/github/freeCodeCamp/boilerplate-port-scanner)。 -After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. +在打开链接之后 fork 该项目。 根据 “README.md” 中的指示完成整个项目,然后在下面提交你的项目链接。 -We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you some of the Python skills required for this project: +Python 课程的交互式教学部分仍在开发当中。 目前,freeCodeCamp YouTube 频道上的一些视频将会教授你这个项目要求的一些 Python 技能。
          # --hints-- -It should pass all Python tests. +它应该通过所有的 Python 测试。 ```js diff --git a/curriculum/challenges/chinese/09-information-security/information-security-projects/secure-real-time-multiplayer-game.md b/curriculum/challenges/chinese/09-information-security/information-security-projects/secure-real-time-multiplayer-game.md index 3ced001df3..453fe95fb4 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-projects/secure-real-time-multiplayer-game.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-projects/secure-real-time-multiplayer-game.md @@ -1,23 +1,28 @@ --- id: 5e601c775ac9d0ecd8b94aff -title: Secure Real Time Multiplayer Game +title: 安全的实时多人游戏 challengeType: 4 +forumTopicId: 462375 dashedName: secure-real-time-multiplayer-game --- # --description-- -Develop a 2D real time multiplayer game using the HTML Canvas API and [Socket.io](https://socket.io/) that is functionally similar to this: . Working on this project will involve you writing your code using one of the following methods: +使用 HTML Canvas API 和 [Socket.io](https://socket.io/) 开发一个 2D 实时多人游戏,其功能与此类似:。 在这个项目中,你将使用以下方法之一编写你的代码: -- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game/) and complete your project locally. -- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game) to complete your project. -- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. +- 克隆[这个 GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game/),并在本地完成你的项目。 +- 使用[我们的 Replit 初始项目](https://replit.com/github/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game)来完成你的项目。 +- 使用您选择的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。 -When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. +完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。 + +# --instructions-- + +**注意** :`helmet@^3.21.3` 是用户故事所必需的。 这意味着你需要使用以前版本的 Helmet 的文档,了解如何实现用户故事的信息。 # --hints-- -You can provide your own project, not the example URL. +提交自己的项目,而不是示例的 URL。 ```js (getUserInput) => { @@ -29,112 +34,134 @@ You can provide your own project, not the example URL. }; ``` -Multiple players can connect to a server and play. +多个玩家可以连接到一台服务器游玩。 ```js ``` -Each player has an avatar. +每个玩家都有头像。 ```js ``` -Each player is represented by an object created by the `Player` class in `Player.mjs`. +每个玩家都由在 `Player.mjs` 中创建的 `Player` 类对象来代表。 ```js ``` -At a minimum, each player object should contain a unique `id`, a `score`, and `x` and `y` coordinates representing the player's current position. +至少,每个玩家对象应该包含一个唯一的 `id`、一个 `score`,以及代表玩家当前位置的 `x` 和 `y` 坐标。 ```js ``` -The game has at least one type of collectible item. Complete the `Collectible` class in `Collectible.mjs` to implement this. +游戏至少有一种类型的可收藏物品。 在 `Collectible.mjs` 中完成 `Collectible` 类来实现这一点。 ```js ``` -At a minimum, each collectible item object created by the `Collectible` class should contain a unique `id`, a `value`, and `x` and `y` coordinates representing the item's current position. +至少,每个由 `Collectible` 类创建的可收集物品对象应该包含一个唯一的 `id`、一个 `value`,以及代表该物品当前位置的 `x` 和 `y` 坐标。 ```js ``` -Players can use the WASD and/or arrow keys to move their avatar. Complete the `movePlayer` method in `Player.mjs` to implement this. +玩家可以使用 WASD 或方向键移动头像。 完成 `Player.mjs` 中的 `movePlayer` 方法来实现这一功能。 ```js ``` -The `movePlayer` method should accept two arguments: a string of "up", "down", "left", or "right", and a number for the amount of pixels the player's position should change. `movePlayer` should adjust the `x` and `y` coordinates of the player object it's called from. +`movePlayer` 方法应该接受两个参数:一个是 “up”、“down”、“left” 或 “right” 的字符串,另一个是玩家角色位置应该改变的像素数量。 `movePlayer` 应该调整它所调用的玩家对象的 `x` 和 `y` 坐标。 ```js ``` -The player's score should be used to calculate their rank among the other players. Complete the `calculateRank` method in the `Player` class to implement this. +用玩家的分数来计算他们相对其他玩家的名次。 在 `Player` 类中完成 `calculateRank` 方法来实现这个。 ```js ``` -The `calculateRank` method should accept an array of objects representing all connected players and return the string `Rank: currentRanking/totalPlayers`. For example, in a game with two players, if Player A has a score of 3 and Player B has a score of 5, `calculateRank` for Player A should return `Rank: 2/2`. +`calculateRank` 方法应该接受一个代表所有在线玩家的对象数组,并返回字符串 `Rank: currentRanking/totalPlayers`。 例如,在一局有两个玩家的游戏中,如果玩家 A 的分数是 3,玩家 B 的分数是 5,那么玩家 A 的 `calculateRank` 应该返回 `Rank: 2/2`。 ```js ``` -Players can collide with a collectible item. Complete the `collision` method in `Player.mjs` to implement this. +玩家可以与可收集物品发生碰撞。 完成 `Player.mjs` 中的 `collision` 方法来实现这一点。 ```js ``` -The `collision` method should accept a collectible item's object as an argument. If the player's avatar intersects with the item, the `collision` method should return `true`. +`collision` 方法应该接受一个可收集物品的对象作为参数。 如果玩家的头像与物品相交,`collision` 方法应该返回 `true`。 ```js ``` -All players are kept in sync. +所有玩家都保持游戏状态同步。 ```js ``` -Players can disconnect from the game at any time. +玩家可以随时断开与游戏的连接。 ```js ``` -Prevent the client from trying to guess / sniff the MIME type. +阻止客户端试图猜测/嗅探 MIME 类型。 ```js - +async (getUserInput) => { + const data = await fetch(getUserInput('url') + '/_api/app-info'); + const parsed = await data.json(); + assert.equal(parsed.headers['x-content-type-options'], 'nosniff'); +}; ``` -Prevent cross-site scripting (XSS) attacks. +防止跨站脚本(XSS)攻击。 ```js - +async (getUserInput) => { + const data = await fetch(getUserInput('url') + '/_api/app-info'); + const parsed = await data.json(); + assert.equal(parsed.headers['x-xss-protection'], '1; mode=block'); +}; ``` -Nothing from the website is cached in the client. +客户端没有缓存任何网站内容。 ```js - +async (getUserInput) => { + const data = await fetch(getUserInput('url') + '/_api/app-info'); + const parsed = await data.json(); + assert.equal(parsed.headers['surrogate-control'], 'no-store'); + assert.equal( + parsed.headers['cache-control'], + 'no-store, no-cache, must-revalidate, proxy-revalidate' + ); + assert.equal(parsed.headers['pragma'], 'no-cache'); + assert.equal(parsed.headers['expires'], '0'); +}; ``` -The headers say that the site is powered by "PHP 7.4.3" even though it isn't (as a security measure). +请求头显示该网站是由 “PHP 7.4.3” 驱动的,尽管实际并非如此(作为一种安全防御措施)。 ```js - +async (getUserInput) => { + const data = await fetch(getUserInput('url') + '/_api/app-info'); + const parsed = await data.json(); + assert.equal(parsed.headers['x-powered-by'], 'PHP 7.4.3'); +}; ``` # --solutions-- diff --git a/curriculum/challenges/chinese/09-information-security/information-security-projects/sha-1-password-cracker.md b/curriculum/challenges/chinese/09-information-security/information-security-projects/sha-1-password-cracker.md index 8a79bb1b7c..e78aa6ae76 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-projects/sha-1-password-cracker.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-projects/sha-1-password-cracker.md @@ -1,33 +1,34 @@ --- id: 5e46f983ac417301a38fb933 -title: SHA-1 Password Cracker +title: SHA-1 密码破解器 challengeType: 10 +forumTopicId: 462374 helpCategory: Python dashedName: sha-1-password-cracker --- # --description-- -For this project you will learn about the importance of good security by creating a password cracker to figure out passwords that were hashed using SHA-1. +在这个项目中,你将通过创建一个密码破解器来找出使用 SHA-1 散列的密码,从而了解到良好安全的重要性。 -You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-SHA-1-password-cracker). +你可以访问 [Replit 上的完整项目描述和启动代码](https://replit.com/github/freeCodeCamp/boilerplate-SHA-1-password-cracker)。 -After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. +进入该链接后,fork 该项目。 一旦你根据 “README.md” 中的说明完成了项目,请在下面提交你的项目链接。 -We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you some of the Python skills required for this project: +我们仍在开发 Python 课程的交互式教学部分。 目前,freeCodeCamp.org YouTube 频道上的一些视频可以教你这个项目所需的一些 Python 技能。 # --hints-- -It should pass all Python tests. +它应该通过所有的 Python 测试。 ```js diff --git a/curriculum/challenges/chinese/09-information-security/information-security-projects/stock-price-checker.md b/curriculum/challenges/chinese/09-information-security/information-security-projects/stock-price-checker.md index ce584c58d5..22f100d1fc 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-projects/stock-price-checker.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-projects/stock-price-checker.md @@ -1,6 +1,6 @@ --- id: 587d824a367417b2b2512c44 -title: Stock Price Checker +title: 股票价格查看器 challengeType: 4 forumTopicId: 301572 dashedName: stock-price-checker @@ -8,36 +8,36 @@ dashedName: stock-price-checker # --description-- -Build a full stack JavaScript app that is functionally similar to this: . +构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:。 -Since all reliable stock price APIs require an API key, we've built a workaround. Use to get up-to-date stock price information without needing to sign up for your own key. +由于所有可靠的股票价格 API 都需要一个 API 密钥,我们已经建立了一个解决方案。 使用 [https://stock-price-checer-proxy.freecodecamp.rocks/](https://stock-price-checker-proxy.freecodecamp.rocks/) 获取最新的股票价格信息,而无需注册您自己的密钥。 -Working on this project will involve you writing your code using one of the following methods: +可以采用下面的任意一种方式完成这个挑战: -- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-stockchecker/) and complete your project locally. -- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-stockchecker) to complete your project. -- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. +- 克隆 [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-stockchecker/) 并在本地完成项目。 +- 使用[我们的 Replit 启动项目](https://replit.com/github/freeCodeCamp/boilerplate-project-stockchecker)来完成你的项目。 +- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。 -When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field. +完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。 # --instructions-- -1. SET `NODE_ENV` to `test` without quotes and set `DB` to your MongoDB connection string -2. Complete the project in `routes/api.js` or by creating a handler/controller -3. You will add any security features to `server.js` -4. You will create all of the functional tests in `tests/2_functional-tests.js` +1. 将 `NODE_ENV` 设置为 `test`,不带引号,并将 `DB` 设为你的 MongoDB 连接字符串。 +2. 在 `routes/api.js` 中完成项目,或者通过创建一个处理程序/控制器来完成项目 +3. 添加安全功能到 `server.js`。 +4. 在 `tests/2_functional-tests.js` 中创建所有的功能测试 -Write the following tests in `tests/2_functional-tests.js`: +在 `tests/2_functional-tests.js` 中编写下以下测试: -- Viewing one stock: GET request to `/api/stock-prices/` -- Viewing one stock and liking it: GET request to `/api/stock-prices/` -- Viewing the same stock and liking it again: GET request to `/api/stock-prices/` -- Viewing two stocks: GET request to `/api/stock-prices/` -- Viewing two stocks and liking them: GET request to `/api/stock-prices/` +- 查看股价:发送 GET 请求到 `/api/stock-prices/` +- 查看一个股票并关注它:发送 GET 请求到 `/api/stock-prices/` +- 查看同一只股票并再次发送关注:发送 GET 请求到 `/api/stock-prices/` +- 查看两只股票:发送 GET 请求到 `/api/stock-prices/` +- 查看两只股票并关注它:发送 GET 请求到 `/api/stock-prices/` # --hints-- -You can provide your own project, not the example URL. +提交自己的项目,而不是示例的 URL。 ```js (getUserInput) => { @@ -47,7 +47,7 @@ You can provide your own project, not the example URL. }; ``` -You should set the content security policies to only allow loading of scripts and CSS from your server. +将内容安全策略设置为仅允许从服务器加载脚本和 CSS。 ```js async (getUserInput) => { @@ -62,7 +62,7 @@ async (getUserInput) => { }; ``` -You can send a `GET` request to `/api/stock-prices` with form data containing a NASDAQ stock ticker. Returned will be an object with the property `stockData`. +你可以向 `/api/stock-prices` 发送一个 `GET` 请求,将纳斯达克股票代码赋值给 `stock` 查询参数。 返回的对象将包含一个名为 `stockData` 的属性。 ```js async (getUserInput) => { @@ -74,7 +74,7 @@ async (getUserInput) => { }; ``` -The `stockData` property includes the `stock` ticker as a string, the `price` as a number, and `likes` as a number. +`stockData` 属性包括字符串 `stock` 代码、数字 `price`,以及数字 `likes`。 ```js async (getUserInput) => { @@ -89,13 +89,13 @@ async (getUserInput) => { }; ``` -You can also pass along a `like` field as `true` (boolean) to have your like added to the stock(s). Only 1 like per IP should be accepted. +你也可以用作为 `true`(布尔值)来传递 `like` 字段,让你的偏好添加到股票中。 每个 IP 应该只接受 1 个赞。 ```js ``` -If you pass along 2 stocks, the returned value will be an array with information about both stocks. Instead of `likes`, it will display `rel_likes` (the difference between the likes on both stocks) for both `stockData` objects. +如果你传递了两只股票,返回值将是一个包含这两只股票信息的数组。 它将会显示对于两个 `stockData` 对象的 `rel_likes`(两只股票所获得的赞同数的区别),而不是 `likes`。 ```js async (getUserInput) => { @@ -110,7 +110,7 @@ async (getUserInput) => { }; ``` -All 5 functional tests are complete and passing. +所有 5 项功能测试都已完成并通过。 ```js async (getUserInput) => { diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/ask-browsers-to-access-your-site-via-https-only-with-helmet.hsts.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/ask-browsers-to-access-your-site-via-https-only-with-helmet.hsts.md index 6bf78cfccc..cdc890a4e1 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/ask-browsers-to-access-your-site-via-https-only-with-helmet.hsts.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/ask-browsers-to-access-your-site-via-https-only-with-helmet.hsts.md @@ -1,6 +1,6 @@ --- id: 587d8248367417b2b2512c3c -title: Ask Browsers to Access Your Site via HTTPS Only with helmet.hsts() +title: 用 helmet.hsts() 使浏览器只能通过 HTTPS 访问你的网站。 challengeType: 2 forumTopicId: 301573 dashedName: ask-browsers-to-access-your-site-via-https-only-with-helmet-hsts @@ -8,19 +8,19 @@ dashedName: ask-browsers-to-access-your-site-via-https-only-with-helmet-hsts # --description-- -As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). +请注意,本项目在[这个 Repl.it 项目](https://replit.com/github/freeCodeCamp/boilerplate-infosec)的基础上进行开发。你也可以从 [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/) 上克隆。 -HTTP Strict Transport Security (HSTS) is a web security policy which helps to protect websites against protocol downgrade attacks and cookie hijacking. If your website can be accessed via HTTPS you can ask user’s browsers to avoid using insecure HTTP. By setting the header Strict-Transport-Security, you tell the browsers to use HTTPS for the future requests in a specified amount of time. This will work for the requests coming after the initial request. +HTTP 严格传输安全(HSTS)是一种网络安全策略,有助于保护网站免受协议降级攻击和 cookie 劫持。 如果你的网站可以通过 HTTPS 访问,你可以要求用户的浏览器避免使用不安全的 HTTP。 通过设置标头 Strict-Transport-Security,你告诉浏览器在指定时间内对未来的请求使用 HTTPS。 这将对初始请求之后的请求起作用。 # --instructions-- -Configure `helmet.hsts()` to use HTTPS for the next 90 days. Pass the config object `{maxAge: timeInSeconds, force: true}`. You can create a variable `ninetyDaysInSeconds = 90*24*60*60;` to use for the `timeInSeconds`. Repl.it already has hsts enabled. To override its settings you need to set the field "force" to true in the config object. We will intercept and restore the Repl.it header, after inspecting it for testing. +配置 `helmet.hsts()` 以在未来 90 天内使用 HTTPS。 传递配置对象 `{maxAge: timeInSeconds, force: true}`。 你可以创建一个变量 `ninetyDaysInSeconds = 90*24*60*60;` 来用于 `timeInSeconds`。 Replit 已经启用了 hsts。 要覆盖它的设置,你需要在配置对象中把 “force” 字段设置为 true。 我们将拦截并在对其进行检查测试后恢复 Replit 请求头。 -Note: Configuring HTTPS on a custom website requires the acquisition of a domain, and a SSL/TLS Certificate. +注意:在自定义网站上配置 HTTPS 需要获得一个域名,以及一个 SSL/TLS 证书。 # --hints-- -helmet.hsts() middleware should be mounted correctly +helmet.hsts() 中间件应该被正确安装。 ```js (getUserInput) => @@ -35,7 +35,7 @@ helmet.hsts() middleware should be mounted correctly ); ``` -maxAge should be equal to 7776000 s (90 days) +maxAge 应该等于 7776000 秒(90 天)。 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/avoid-inferring-the-response-mime-type-with-helmet.nosniff.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/avoid-inferring-the-response-mime-type-with-helmet.nosniff.md index 2bbd3bf02e..faf9647e20 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/avoid-inferring-the-response-mime-type-with-helmet.nosniff.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/avoid-inferring-the-response-mime-type-with-helmet.nosniff.md @@ -1,6 +1,6 @@ --- id: 587d8248367417b2b2512c3a -title: Avoid Inferring the Response MIME Type with helmet.noSniff() +title: 用 helmet.noSniff() 避免推断出响应的 MIME 类型。 challengeType: 2 forumTopicId: 301574 dashedName: avoid-inferring-the-response-mime-type-with-helmet-nosniff @@ -8,15 +8,15 @@ dashedName: avoid-inferring-the-response-mime-type-with-helmet-nosniff # --description-- -As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). Browsers can use content or MIME sniffing to override response `Content-Type` headers to guess and process the data using an implicit content type. While this can be convenient in some scenarios, it can also lead to some dangerous attacks. This middleware sets the X-Content-Type-Options header to `nosniff`, instructing the browser to not bypass the provided `Content-Type`. +请注意,本项目在[这个 Repl.it 项目](https://replit.com/github/freeCodeCamp/boilerplate-infosec)的基础上进行开发。你也可以从 [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/) 上克隆。 浏览器可以使用内容或 MIME 嗅探来覆盖响应的 `Content-Type` 头,猜测并使用隐含的内容类型来处理数据。 虽然这在某些情况下可能很方便,但也可能导致一些危险的攻击。 该中间件将 X-Content-Type-Options 头设置为 `nosniff`,指示浏览器不要绕过所提供的 `Content-Type`。 # --instructions-- -Use the `helmet.noSniff()` method on your server. +在你的服务器上使用 `helmet.noSniff()` 方法。 # --hints-- -helmet.noSniff() middleware should be mounted correctly +helmet.noSniff() 中间件应该被正确安装 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/configure-helmet-using-the-parent-helmet-middleware.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/configure-helmet-using-the-parent-helmet-middleware.md index 6865d3896c..23ee9f49b1 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/configure-helmet-using-the-parent-helmet-middleware.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/configure-helmet-using-the-parent-helmet-middleware.md @@ -1,6 +1,6 @@ --- id: 587d8249367417b2b2512c40 -title: Configure Helmet Using the ‘parent’ helmet() Middleware +title: 使用 helmet() 中间件来配置 Helmet challengeType: 2 forumTopicId: 301575 dashedName: configure-helmet-using-the-parent-helmet-middleware @@ -8,11 +8,11 @@ dashedName: configure-helmet-using-the-parent-helmet-middleware # --description-- -As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). +请注意,本项目在[这个 Repl.it 项目](https://replit.com/github/freeCodeCamp/boilerplate-infosec)的基础上进行开发。你也可以从 [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/) 上克隆。 -`app.use(helmet())` will automatically include all the middleware introduced above, except `noCache()`, and `contentSecurityPolicy()`, but these can be enabled if necessary. You can also disable or configure any other middleware individually, using a configuration object. +`app.use(helmet())` 将自动包括上面介绍的所有中间件,除了 `noCache()` 和 `contentSecurityPolicy()`,但如果有必要,这些可以被启用。 你也可以使用配置对象,单独禁用或配置任何其他中间件。 -**Example:** +**例如:** ```js app.use(helmet({ @@ -21,7 +21,7 @@ app.use(helmet({ }, contentSecurityPolicy: { // enable and configure directives: { - defaultSrc: ["self"], + defaultSrc: ["'self'"], styleSrc: ['style.com'], } }, @@ -29,11 +29,11 @@ app.use(helmet({ })) ``` -We introduced each middleware separately for teaching purposes and for ease of testing. Using the ‘parent’ `helmet()` middleware is easy to implement in a real project. +为了教学目的和便于测试,我们分别介绍了每个中间件。 使用“父”`helmet()` 中间件很容易在真实项目中实现。 # --hints-- -no tests - it's a descriptive challenge +没有测试 - 这是一个描述性的挑战 ```js assert(true); diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-client-side-caching-with-helmet.nocache.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-client-side-caching-with-helmet.nocache.md index 21cf373400..cdbf7c12eb 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-client-side-caching-with-helmet.nocache.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-client-side-caching-with-helmet.nocache.md @@ -1,6 +1,6 @@ --- id: 587d8249367417b2b2512c3e -title: Disable Client-Side Caching with helmet.noCache() +title: 使用 helment.noCache() 禁用客户端缓存 challengeType: 2 forumTopicId: 301576 dashedName: disable-client-side-caching-with-helmet-nocache @@ -8,17 +8,17 @@ dashedName: disable-client-side-caching-with-helmet-nocache # --description-- -As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). +请注意,本项目在[这个 Repl.it 项目](https://replit.com/github/freeCodeCamp/boilerplate-infosec)的基础上进行开发。 你也可以从[GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/)上克隆。 -If you are releasing an update for your website, and you want the users to always download the newer version, you can (try to) disable caching on client’s browser. It can be useful in development too. Caching has performance benefits, which you will lose, so only use this option when there is a real need. +如果你正在为你的网站发布更新,而你希望用户总是下载较新的版本,你可以(尝试)在客户的浏览器上禁用缓存。 它在开发中也很有用。 缓存具有性能优势,你将失去这些优势,因此只有在真正需要时才使用此选项。 # --instructions-- -Use the `helmet.noCache()` method on your server. +在你的服务器上使用 `helmet.noCache()` 方法。 # --hints-- -helmet.noCache() middleware should be mounted correctly +应正确加载 helmet.noCache() 中间件 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-dns-prefetching-with-helmet.dnsprefetchcontrol.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-dns-prefetching-with-helmet.dnsprefetchcontrol.md index 5d212b6dbe..90e2dd50b5 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-dns-prefetching-with-helmet.dnsprefetchcontrol.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-dns-prefetching-with-helmet.dnsprefetchcontrol.md @@ -1,6 +1,6 @@ --- id: 587d8248367417b2b2512c3d -title: Disable DNS Prefetching with helmet.dnsPrefetchControl() +title: 使用 helmet.dnsPrefetchControl() 禁用 DNS 预获取 challengeType: 2 forumTopicId: 301577 dashedName: disable-dns-prefetching-with-helmet-dnsprefetchcontrol @@ -8,17 +8,17 @@ dashedName: disable-dns-prefetching-with-helmet-dnsprefetchcontrol # --description-- -As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). +请注意,本项目在[这个 Repl.it 项目](https://replit.com/github/freeCodeCamp/boilerplate-infosec)的基础上进行开发。你也可以从 [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/) 上克隆。 -To improve performance, most browsers prefetch DNS records for the links in a page. In that way the destination ip is already known when the user clicks on a link. This may lead to over-use of the DNS service (if you own a big website, visited by millions people…), privacy issues (one eavesdropper could infer that you are on a certain page), or page statistics alteration (some links may appear visited even if they are not). If you have high security needs you can disable DNS prefetching, at the cost of a performance penalty. +为了提高性能,大部分浏览器都会为页面上的链接预先加载 DNS 记录。 这样当用户点击一个链接的时候浏览器已经知道其 IP 地址了。 但这也会造成 DNS 服务的过度使用(如果你有一个百万用户数量级的大型网站)、隐私问题(窃听者可以借此推测出你在访问哪个页面)、页面统计数据准确性(有些没访问过的链接会被标记成已访问)。 如果你对安全性要求比较高,你应该禁用 DNS 预加载。 当然,这样做会让你损失一些性能。 # --instructions-- -Use the `helmet.dnsPrefetchControl()` method on your server. +应正确加载 helmet.dnsPrefetchControl() 中间件 # --hints-- -helmet.dnsPrefetchControl() middleware should be mounted correctly +应正确加载 helmet.dnsPrefetchControl() 中间件 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-asynchronously.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-asynchronously.md index 5d6126daa7..77d930c414 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-asynchronously.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-asynchronously.md @@ -1,6 +1,6 @@ --- id: 58a25bcff9fc0f352b528e7d -title: Hash and Compare Passwords Asynchronously +title: 哈希和异步比较密码 challengeType: 2 forumTopicId: 301578 dashedName: hash-and-compare-passwords-asynchronously @@ -8,9 +8,9 @@ dashedName: hash-and-compare-passwords-asynchronously # --description-- -As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-bcrypt), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-bcrypt/). +请注意,本项目在[这个 Repl.it 项目](https://replit.com/github/freeCodeCamp/boilerplate-infosec)的基础上进行开发。 你也可以从[GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/)上克隆。 -As hashing is designed to be computationally intensive, it is recommended to do so asynchronously on your server as to avoid blocking incoming connections while you hash. All you have to do to hash a password asynchronous is call +由于哈希运算会占用很大计算机资源,并且会耗费比较多时间,因此比较推荐的做法是异步调用哈希算法,这样就不会因此阻止其它连接或请求了。 异步调用哈希方法非常简单,只需要: ```js bcrypt.hash(myPlaintextPassword, saltRounds, (err, hash) => { @@ -20,9 +20,9 @@ bcrypt.hash(myPlaintextPassword, saltRounds, (err, hash) => { # --instructions-- -Add this hashing function to your server(we've already defined the variables used in the function for you to use) and log it to the console for you to see! At this point you would normally save the hash to your database. +把这段哈希方法添加到你的服务器(我们已经定义好这个方法的变量给你直接使用了),然后你可以尝试在控制台输出。 之后,我们通常需要把哈希的结果保存到数据库。 -Now when you need to figure out if a new input is the same data as the hash you would just use the compare function. +当你需要对比用户输入的值是否和之前哈希过的值一样的时候,只需要调用对比函数: ```js bcrypt.compare(myPlaintextPassword, hash, (err, res) => { @@ -30,7 +30,7 @@ bcrypt.compare(myPlaintextPassword, hash, (err, res) => { }); ``` -Add this into your existing hash function(since you need to wait for the hash to complete before calling the compare function) after you log the completed hash and log 'res' to the console within the compare. You should see in the console a hash then 'true' is printed! If you change 'myPlaintextPassword' in the compare function to 'someOtherPlaintextPassword' then it should say false. +当控制台输出生成的哈希并在对比的回调中输出结果后,我们就可以将其添加到现有的哈希函数中。 控制台中会首先输出一个哈希结果,然后输出 true。 如果将比较函数中的 “myPlaintextPassword” 更改为 “someOtherPlaintextPassword”,则比较的结果应显示 false。 ```js bcrypt.hash('passw0rd!', 13, (err, hash) => { @@ -43,11 +43,11 @@ bcrypt.hash('passw0rd!', 13, (err, hash) => { ``` -Submit your page when you think you've got it right. +请在完成挑战后提交你的页面。 # --hints-- -Async hash should be generated and correctly compared. +应生成异步散列并正确比较。 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-synchronously.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-synchronously.md index c03109f16a..cb755f67dc 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-synchronously.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-synchronously.md @@ -1,6 +1,6 @@ --- id: 58a25bcff9fc0f352b528e7e -title: Hash and Compare Passwords Synchronously +title: 哈希和同步比较密码 challengeType: 2 forumTopicId: 301579 dashedName: hash-and-compare-passwords-synchronously @@ -8,31 +8,31 @@ dashedName: hash-and-compare-passwords-synchronously # --description-- -As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-bcrypt), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-bcrypt/). +请注意,本项目在 [这个 Repl.it 项目](https://replit.com/github/freeCodeCamp/boilerplate-bcrypt) 的基础上进行开发。 你也可以从 [GitHub](https://github.com/freeCodeCamp/boilerplate-bcrypt/) 上克隆。 -Hashing synchronously is just as easy to do but can cause lag if using it server side with a high cost or with hashing done very often. Hashing with this method is as easy as calling +同步执行哈希运算是非常简单的,但这会在哈希计算量大并且次数多的情况下造成延迟。 用这个方法哈希就像调用函数一样简单。 ```js var hash = bcrypt.hashSync(myPlaintextPassword, saltRounds); ``` -Add this method of hashing to your code and then log the result to the console. Again, the variables used are already defined in the server so you won't need to adjust them. You may notice even though you are hashing the same password as in the async function, the result in the console is different- this is due to the salt being randomly generated each time as seen by the first 22 characters in the third string of the hash. Now to compare a password input with the new sync hash, you would use the compareSync method: +把同步哈希的方法添加到你的代码,并在控制台输出。 和之前一样,我们已经为你定义好了你需要使用的变量,你不需要做任何改动。 你可能会注意到即使你使用与异步函数相同的密码进行哈希处理,控制台中的结果也不同,这是由于每次哈希值随机生成,如第三个哈希字符串中的前 22 个字符所示。 现在,为了比较一个密码输入和新的同步哈希值,你将使用 compareSync 方法。 ```js var result = bcrypt.compareSync(myPlaintextPassword, hash); ``` -with the result being a boolean true or false. +返回的结果为 true 或 false。 # --instructions-- -Add the function in and log the result to the console to see it working. +请添加这个方法,并把结果输出到控制台,以此来验证同步哈希操作是否成功。 -Submit your page when you think you've got it right. +请在完成挑战后提交你的页面。 # --hints-- -Sync hash should be generated and correctly compared. +应同步地进行哈希并正确地执行对比 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hide-potentially-dangerous-information-using-helmet.hidepoweredby.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hide-potentially-dangerous-information-using-helmet.hidepoweredby.md index 630302ea38..af0b394ac2 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hide-potentially-dangerous-information-using-helmet.hidepoweredby.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hide-potentially-dangerous-information-using-helmet.hidepoweredby.md @@ -1,6 +1,6 @@ --- id: 587d8247367417b2b2512c37 -title: Hide Potentially Dangerous Information Using helmet.hidePoweredBy() +title: 使用 helmet.hidePoweredBy() 隐藏潜在的危险信息 challengeType: 2 forumTopicId: 301580 dashedName: hide-potentially-dangerous-information-using-helmet-hidepoweredby @@ -8,13 +8,13 @@ dashedName: hide-potentially-dangerous-information-using-helmet-hidepoweredby # --description-- -As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). +请注意,本项目在[这个 Repl.it 项目](https://replit.com/github/freeCodeCamp/boilerplate-infosec)的基础上进行开发。你也可以从 [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/) 上克隆。 -Hackers can exploit known vulnerabilities in Express/Node if they see that your site is powered by Express. X-Powered-By: Express is sent in every request coming from Express by default. The `helmet.hidePoweredBy()` middleware will remove the X-Powered-By header. You can also explicitly set the header to something else, to throw people off. e.g. `app.use(helmet.hidePoweredBy({ setTo: 'PHP 4.2.0' }))` +如果黑客发现你的网站是用 Express 搭建的,那么他们就可以利用 Express 或 Node 现存的漏洞来攻击你的网站。 `X-Powered-By: Express` 默认在来自 Express 的每个请求中被发送。 使用 `helmet.hidePoweredBy()` 中间件来移除 X-Powered-By 头。 # --hints-- -helmet.hidePoweredBy() middleware should be mounted correctly +应正确地安装 helmet.hidePoweredBy() 中间件 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/install-and-require-helmet.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/install-and-require-helmet.md index 0a58f1d597..2aca76fc3b 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/install-and-require-helmet.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/install-and-require-helmet.md @@ -1,6 +1,6 @@ --- id: 587d8247367417b2b2512c36 -title: Install and Require Helmet +title: 安装和引入 Helmet challengeType: 2 forumTopicId: 301581 dashedName: install-and-require-helmet @@ -8,26 +8,33 @@ dashedName: install-and-require-helmet # --description-- -As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). +你可以采用下面的任意一种编写代码的方式来完成这些挑战: -Helmet helps you secure your Express apps by setting various HTTP headers. +- 克隆 [这个 GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-infosec/) 并在本地完成这些挑战。 +- 使用[我们在 Repl.it 上的初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-infosec)来完成这些挑战。 +- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。 + +完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 字段中提交它的 URL。 + +Helmet 通过设置各种 HTTP 头来保护你的 Express 应用程序。 # --instructions-- -All your code for these lessons goes in the `myApp.js` file between the lines of code we have started you off with. Do not change or delete the code we have added for you. +你在这些课程中写的所有代码都在 `myApp.js` 文件中,在初始代码之间。 不要改变或删除我们为你添加的代码。 -Install Helmet version `3.21.3`, then require it. +安装 Helmet 的 `3.21.3` 版本,然后引入它。 你可以用 `npm install --save-exact package@version` 来安装一个特定版本的软件包,或者直接将其添加到你的 `package.json` 中。 # --hints-- -`helmet` version `3.21.3` should be in `package.json` +`helmet` 版本 `3.21.3` 应该在 `package.json` 中。 ```js (getUserInput) => $.get(getUserInput('url') + '/_api/package.json').then( (data) => { - var packJson = JSON.parse(data); - assert(packJson.dependencies.helmet === '3.21.3'); + const packJson = JSON.parse(data); + const helmet = packJson.dependencies.helmet; + assert(helmet === '3.21.3' || helmet === '^3.21.3'); }, (xhr) => { throw new Error(xhr.responseText); diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-clickjacking-with-helmet.frameguard.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-clickjacking-with-helmet.frameguard.md index 1759d2e727..c6517b096e 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-clickjacking-with-helmet.frameguard.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-clickjacking-with-helmet.frameguard.md @@ -1,6 +1,6 @@ --- id: 587d8247367417b2b2512c38 -title: Mitigate the Risk of Clickjacking with helmet.frameguard() +title: 使用 helmet.frameguard() 降低点击劫持的风险 challengeType: 2 forumTopicId: 301582 dashedName: mitigate-the-risk-of-clickjacking-with-helmet-frameguard @@ -8,19 +8,19 @@ dashedName: mitigate-the-risk-of-clickjacking-with-helmet-frameguard # --description-- -As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). +请注意,本项目在 [这个 Repl.it 项目](https://replit.com/github/freeCodeCamp/boilerplate-infosec) 的基础上进行开发。 你也可以从 [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/) 上克隆。 -Your page could be put in a `` or `