mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat(curriculum): add element skipper lab (#62779)
This commit is contained in:
@@ -2383,10 +2383,7 @@
|
||||
"Open up this page to review concepts around the basics of HTML elements, semantic HTML, tables, forms and accessibility."
|
||||
]
|
||||
},
|
||||
"qpra": {
|
||||
"title": "30",
|
||||
"intro": []
|
||||
},
|
||||
"qpra": { "title": "30", "intro": [] },
|
||||
"lecture-understanding-computer-internet-and-tooling-basics": {
|
||||
"title": "Understanding Computer, Internet, and Tooling Basics",
|
||||
"intro": [
|
||||
@@ -3543,6 +3540,12 @@
|
||||
"In this lab you will build an odd Fibonacci sum calculator that takes a number and returns the sum of all odd Fibonacci numbers that are less than or equal to that number."
|
||||
]
|
||||
},
|
||||
"lab-element-skipper": {
|
||||
"title": "Implement an Element Skipper",
|
||||
"intro": [
|
||||
"In this lab you will create a function that skips elements in an array based on a specified step value."
|
||||
]
|
||||
},
|
||||
"lab-optional-arguments-sum-function": {
|
||||
"title": "Build an Optional Arguments Sum Function",
|
||||
"intro": [
|
||||
@@ -4140,10 +4143,7 @@
|
||||
"Open up this page to review all of the concepts taught including variables, strings, booleans, functions, objects, arrays, debugging, working with the DOM and more."
|
||||
]
|
||||
},
|
||||
"kagw": {
|
||||
"title": "258",
|
||||
"intro": []
|
||||
},
|
||||
"kagw": { "title": "258", "intro": [] },
|
||||
"lecture-introduction-to-javascript-libraries-and-frameworks": {
|
||||
"title": "Introduction to JavaScript Libraries and Frameworks",
|
||||
"intro": [
|
||||
@@ -4416,26 +4416,11 @@
|
||||
"In this lesson, you will learn about TypeScript configuration files and how to use them."
|
||||
]
|
||||
},
|
||||
"trvf": {
|
||||
"title": "293",
|
||||
"intro": []
|
||||
},
|
||||
"kwmg": {
|
||||
"title": "294",
|
||||
"intro": []
|
||||
},
|
||||
"nodx": {
|
||||
"title": "295",
|
||||
"intro": []
|
||||
},
|
||||
"erfj": {
|
||||
"title": "296",
|
||||
"intro": []
|
||||
},
|
||||
"muyw": {
|
||||
"title": "297",
|
||||
"intro": []
|
||||
},
|
||||
"trvf": { "title": "293", "intro": [] },
|
||||
"kwmg": { "title": "294", "intro": [] },
|
||||
"nodx": { "title": "295", "intro": [] },
|
||||
"erfj": { "title": "296", "intro": [] },
|
||||
"muyw": { "title": "297", "intro": [] },
|
||||
"review-typescript": {
|
||||
"title": "Typescript Review",
|
||||
"intro": [
|
||||
@@ -4453,14 +4438,8 @@
|
||||
"Review the Front End Libraries concepts to prepare for the upcoming quiz."
|
||||
]
|
||||
},
|
||||
"rdzk": {
|
||||
"title": "301",
|
||||
"intro": []
|
||||
},
|
||||
"vtpz": {
|
||||
"title": "302",
|
||||
"intro": []
|
||||
},
|
||||
"rdzk": { "title": "301", "intro": [] },
|
||||
"vtpz": { "title": "302", "intro": [] },
|
||||
"lecture-introduction-to-python": {
|
||||
"title": "Introduction to Python",
|
||||
"intro": [
|
||||
@@ -4657,10 +4636,7 @@
|
||||
"title": "Placeholder - Waiting for title",
|
||||
"intro": [""]
|
||||
},
|
||||
"lab-placeholder-oop-3": {
|
||||
"title": "",
|
||||
"intro": [""]
|
||||
},
|
||||
"lab-placeholder-oop-3": { "title": "", "intro": [""] },
|
||||
"review-object-oriented-programming": {
|
||||
"title": "Object Oriented Programming Review",
|
||||
"intro": [
|
||||
@@ -4794,10 +4770,7 @@
|
||||
"In this lab, you will implement the Depth-First Search Algorithm."
|
||||
]
|
||||
},
|
||||
"lab-n-queens-problem": {
|
||||
"title": "",
|
||||
"intro": [""]
|
||||
},
|
||||
"lab-n-queens-problem": { "title": "", "intro": [""] },
|
||||
"review-graphs-and-trees": {
|
||||
"title": "Graphs and Trees Review",
|
||||
"intro": [
|
||||
@@ -6138,12 +6111,8 @@
|
||||
"- Complete the five required projects to qualify for the certification exam.",
|
||||
"- Pass the Python Certification exam."
|
||||
],
|
||||
"chapters": {
|
||||
"python": "Python"
|
||||
},
|
||||
"modules": {
|
||||
"python-certification-exam": "Python Certification Exam"
|
||||
},
|
||||
"chapters": { "python": "Python" },
|
||||
"modules": { "python-certification-exam": "Python Certification Exam" },
|
||||
"blocks": {
|
||||
"exam-python-certification": {
|
||||
"title": "Python Certification Exam",
|
||||
@@ -6159,9 +6128,7 @@
|
||||
"- Complete the five required projects to qualify for the certification exam.",
|
||||
"- Pass the Relational Databases Certification exam."
|
||||
],
|
||||
"chapters": {
|
||||
"relational-databases": "Relational Databases"
|
||||
},
|
||||
"chapters": { "relational-databases": "Relational Databases" },
|
||||
"modules": {
|
||||
"relational-databases-certification-exam": "Relational Databases Certification Exam"
|
||||
},
|
||||
@@ -6264,10 +6231,7 @@
|
||||
"title": "Alphabet and Accents",
|
||||
"intro": ["", ""]
|
||||
},
|
||||
"es-a1-learn-punctuation": {
|
||||
"title": "Punctuation",
|
||||
"intro": ["", ""]
|
||||
},
|
||||
"es-a1-learn-punctuation": { "title": "Punctuation", "intro": ["", ""] },
|
||||
"es-a1-quiz-alphabet-accent-and-punctuation-quiz": {
|
||||
"title": "Alphabet, Accent and Punctuation Quiz",
|
||||
"intro": ["", ""]
|
||||
@@ -6276,14 +6240,8 @@
|
||||
"title": "Introducing Yourself Basics",
|
||||
"intro": ["", ""]
|
||||
},
|
||||
"es-a1-learn-meet-luna": {
|
||||
"title": "Meet Luna",
|
||||
"intro": ["", ""]
|
||||
},
|
||||
"es-a1-learn-meet-mateo": {
|
||||
"title": "Meet Mateo",
|
||||
"intro": ["", ""]
|
||||
},
|
||||
"es-a1-learn-meet-luna": { "title": "Meet Luna", "intro": ["", ""] },
|
||||
"es-a1-learn-meet-mateo": { "title": "Meet Mateo", "intro": ["", ""] },
|
||||
"es-a1-learn-meet-julieta": {
|
||||
"title": "Meet Julieta",
|
||||
"intro": ["", ""]
|
||||
@@ -7407,9 +7365,7 @@
|
||||
"part-12": "Containers",
|
||||
"part-13": "Using Relational Databases"
|
||||
},
|
||||
"modules": {
|
||||
"basic-html": "Basic HTML"
|
||||
},
|
||||
"modules": { "basic-html": "Basic HTML" },
|
||||
"module-intros": {
|
||||
"basic-html": {
|
||||
"title": "Basic HTML",
|
||||
@@ -7422,9 +7378,7 @@
|
||||
"daily-coding-challenge": {
|
||||
"title": "Daily Coding Challenge",
|
||||
"blocks": {
|
||||
"daily-coding-challenge": {
|
||||
"title": "Daily Coding Challenge"
|
||||
}
|
||||
"daily-coding-challenge": { "title": "Daily Coding Challenge" }
|
||||
}
|
||||
},
|
||||
"misc-text": {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
title: Introduction to the Implement an Element Skipper
|
||||
block: lab-element-skipper
|
||||
superBlock: full-stack-developer
|
||||
---
|
||||
|
||||
## Introduction to the Implement an Element Skipper
|
||||
|
||||
In this lab, you will create a function that removes elements from the beginning of an array until a specified condition is met.
|
||||
@@ -0,0 +1,82 @@
|
||||
---
|
||||
id: a5deed1811a43193f9f1c841
|
||||
title: Implement an Element Skipper
|
||||
challengeType: 26
|
||||
dashedName: implement-an-element-skipper
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
In this lab you will create a function that skips elements in an array based on a specified step value.
|
||||
|
||||
**Objective**: Fulfill the user stories below and get all the tests to pass to complete the lab.
|
||||
|
||||
**User Stories**
|
||||
|
||||
1. You should have a `dropElements` function that accepts an array (`arr`) and a function (`func`) as arguments.
|
||||
1. The `dropElements` function should iterate through the array and remove elements starting from the first one until `func` returns `true` for an element.
|
||||
1. The `dropElements` function should return the remaining elements in the array if the condition is met.
|
||||
1. If the condition is never satisfied, it should return an empty array.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should have a `dropElements` function.
|
||||
|
||||
```js
|
||||
assert.isFunction(dropElements);
|
||||
```
|
||||
|
||||
`dropElements([1, 2, 3, 4], function(n) {return n >= 3;})` should return `[3, 4]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(dropElements([1, 2, 3, 4], function(n) {return n >= 3;}), [3, 4]);
|
||||
```
|
||||
|
||||
`dropElements([0, 1, 0, 1], function(n) {return n === 1;})` should return `[1, 0, 1]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(dropElements([0, 1, 0, 1], function(n) {return n === 1;}), [1, 0, 1]);
|
||||
```
|
||||
|
||||
`dropElements([1, 2, 3], function(n) {return n > 0;})` should return `[1, 2, 3]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(dropElements([1, 2, 3], function(n) {return n > 0;}), [1, 2, 3]);
|
||||
```
|
||||
|
||||
`dropElements([1, 2, 3, 4], function(n) {return n > 5;})` should return `[]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(dropElements([1, 2, 3, 4], function(n) {return n > 5;}), []);
|
||||
```
|
||||
|
||||
`dropElements([1, 2, 3, 7, 4], function(n) {return n > 3;})` should return `[7, 4]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(dropElements([1, 2, 3, 7, 4], function(n) {return n > 3;}), [7, 4]);
|
||||
```
|
||||
|
||||
`dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;})` should return `[3, 9, 2]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;}), [3, 9, 2]);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
function dropElements(arr, func) {
|
||||
while (arr.length > 0 && !func(arr[0])) {
|
||||
arr.shift();
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "Implement an Element Skipper",
|
||||
"isUpcomingChange": false,
|
||||
"dashedName": "lab-element-skipper",
|
||||
"helpCategory": "JavaScript",
|
||||
"blockLayout": "link",
|
||||
"blockType": "lab",
|
||||
"usesMultifileEditor": true,
|
||||
"challengeOrder": [
|
||||
{
|
||||
"id": "a5deed1811a43193f9f1c841",
|
||||
"title": "Implement an Element Skipper"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -398,6 +398,7 @@
|
||||
"lab-dna-pair-generator",
|
||||
"lab-html-entitiy-converter",
|
||||
"lab-odd-fibonacci-sum-calculator",
|
||||
"lab-element-skipper",
|
||||
"lab-optional-arguments-sum-function",
|
||||
"review-javascript-fundamentals",
|
||||
"quiz-javascript-fundamentals"
|
||||
|
||||
Reference in New Issue
Block a user