chore(curriculum): remove dsa blocks from JS modules (#57051)

This commit is contained in:
Dario-DC
2024-11-13 22:05:06 +01:00
committed by GitHub
parent 03484d95d4
commit e0126caf66
60 changed files with 77 additions and 7835 deletions

View File

@@ -3029,38 +3029,10 @@
"Test what you've learned in this quiz on JavaScript Functional Programming."
]
},
"lab-quicksort-algorithm": {
"title": "Build the Quicksort Algorithm",
"intro": [
"For this lab, you will implement the Quicksort algorithm using JavaScript."
]
},
"dtfv": { "title": "240", "intro": [] },
"quiz-searching-and-sorting-algorithms": {
"title": "Searching and Sorting Algorithms Quiz",
"intro": [
"Test what you've learned in this quiz on Searching and Sorting Algorithms."
]
},
"bnvw": { "title": "242", "intro": [] },
"xkhk": { "title": "243", "intro": [] },
"lab-roman-numeral-converter": {
"title": "Build a Roman Numeral Converter",
"intro": [
"For this lab, you'll build an application that converts integers to Roman numerals."
]
},
"yaxm": { "title": "245", "intro": [] },
"lab-telephone-number-validator": {
"title": "Build a Telephone Number Validator",
"intro": [
"For this lab, you'll build an application that checks if a number is a valid United States phone number."
]
},
"lab-cash-register": {
"title": "Build a Cash Register",
"intro": ["For this lab, you will build a cash register."]
},
"udia": { "title": "248", "intro": [] },
"review-javascript-functional-programming": {
"title": "JavaScript Functional Programming Review",
@@ -3068,12 +3040,6 @@
"Review the JavaScript Functional Programming concepts to prepare for the upcoming quiz."
]
},
"quiz-javascript-problem-solving-and-algorithmic-thinking": {
"title": "JavaScript Problem Solving and Algorithmic Thinking Quiz",
"intro": [
"Test what you've learned in this quiz on JavaScript Problem Solving and Algorithmic Thinking."
]
},
"mjbe": { "title": "251", "intro": [] },
"workshop-fcc-authors-page": {
"title": "Build an fCC Authors Page",
@@ -3105,118 +3071,41 @@
"kagw": { "title": "258", "intro": [] },
"mbib": { "title": "259", "intro": [] },
"oxiv": { "title": "260", "intro": [] },
"quiz-javascript-object-oriented-programming": {
"title": "JavaScript Object Oriented Programming Quiz",
"intro": [
"Test what you've learned in this quiz on JavaScript Object Oriented Programming."
]
},
"fjvx": { "title": "261", "intro": [] },
"nixz": { "title": "262", "intro": [] },
"lab-stack-class": {
"title": "Build a Stack Class",
"intro": [
"For this lab, you will build a stack class using JavaScript."
]
},
"lab-linked-list-class": {
"title": "Build a Linked List Class",
"intro": [
"For this lab, you will build a linked list class using JavaScript."
]
},
"lab-hash-table-class": {
"title": "Build a Hash Table Class",
"intro": ["For this lab, you will build a hash table using JavaScript."]
},
"muyw": { "title": "266", "intro": [] },
"quiz-javascript-data-structures": {
"title": "JavaScript Data Structures Quiz",
"intro": [
"Test what you've learned in this quiz on JavaScript Data Structures."
]
},
"rmpy": { "title": "268", "intro": [] },
"lab-depth-first-search": {
"title": "Implement the Depth-First Search Algorithm",
"intro": [
"For this lab, you will use JavaScript to implement the Depth-First Search algorithm."
]
},
"xdyh": { "title": "270", "intro": [] },
"quiz-graphs-and-trees": {
"title": "Graphs and Trees Quiz",
"intro": ["Test what you've learned in this quiz on Graphs and Trees."]
},
"vjgg": { "title": "272", "intro": [] },
"lab-nth-fibonacci-number-generator": {
"title": "Build the nth Fibonacci number generator",
"intro": [
"For this lab, you will implement the nth Fibonacci number generator."
]
},
"kaui": { "title": "274", "intro": [] },
"quiz-dynamic-programming": {
"title": "Dynamic Programming Quiz",
"intro": [
"Test what you've learned in this quiz on Dynamic Programming."
]
},
"sgau": { "title": "276", "intro": [] },
"clak": { "title": "277", "intro": [] },
"fcom": { "title": "278", "intro": [] },
"ffpt": { "title": "279", "intro": [] },
"lab-pokemon-search-app": {
"title": "Build a Pokémon Search App",
"intro": ["For this project, you will build a Pokémon search app."]
},
"vyzp": { "title": "281", "intro": [] },
"icdr": { "title": "283", "intro": [] },
"zdsj": { "title": "284", "intro": [] },
"mzae": { "title": "285", "intro": [] },
"gjbf": { "title": "286", "intro": [] },
"mbpv": { "title": "287", "intro": [] },
"eeez": { "title": "288", "intro": [] },
"quiz-web-standards": {
"title": "Web Standards Quiz",
"intro": ["Test what you've learned in this quiz on Web Standards."]
},
"khuu": { "title": "290", "intro": [] },
"xdly": { "title": "291", "intro": [] },
"rhhl": { "title": "292", "intro": [] },
"trvf": { "title": "293", "intro": [] },
"kwmg": { "title": "294", "intro": [] },
"nodx": { "title": "295", "intro": [] },
"erfj": { "title": "296", "intro": [] },
"cdfr": { "title": "263", "intro": [] },
"bgtd": { "title": "264", "intro": [] },
"ascd": { "title": "265", "intro": [] },
"quiz-react-basics": {
"title": "React Basics Quiz",
"intro": ["Test what you've learned in this quiz on React Basics."]
},
"hfwi": { "title": "298", "intro": [] },
"rnwr": { "title": "299", "intro": [] },
"oeqv": { "title": "300", "intro": [] },
"rdzk": { "title": "301", "intro": [] },
"vtpz": { "title": "302", "intro": [] },
"dfwl": { "title": "303", "intro": [] },
"adzm": { "title": "304", "intro": [] },
"rugw": { "title": "267", "intro": [] },
"rmpy": { "title": "268", "intro": [] },
"dbta": { "title": "269", "intro": [] },
"rnfe": { "title": "271", "intro": [] },
"xdyh": { "title": "270", "intro": [] },
"vjgg": { "title": "272", "intro": [] },
"ceds": { "title": "273", "intro": [] },
"quiz-react-state-and-hooks": {
"title": "React State and Hooks Quiz",
"intro": [
"Test what you've learned in this quiz on React State and Hooks."
]
},
"voks": { "title": "306", "intro": [] },
"uwum": { "title": "307", "intro": [] },
"ukem": { "title": "308", "intro": [] },
"sdjg": { "title": "309", "intro": [] },
"buzx": { "title": "310", "intro": [] },
"pexz": { "title": "311", "intro": [] },
"prlo": { "title": "312", "intro": [] },
"jsnd": { "title": "313", "intro": [] },
"ftmi": { "title": "275", "intro": [] },
"sgau": { "title": "276", "intro": [] },
"clak": { "title": "277", "intro": [] },
"fcom": { "title": "278", "intro": [] },
"ffpt": { "title": "279", "intro": [] },
"lrof": { "title": "280", "intro": [] },
"vyzp": { "title": "281", "intro": [] },
"zagz": { "title": "282", "intro": [] },
"quiz-advanced-react": {
"title": "Advanced React Quiz",
"intro": ["Test what you've learned in this quiz on Advanced React."]
},
"tkgg": { "title": "315", "intro": [] },
"zdsj": { "title": "284", "intro": [] },
"review-web-performance": {
"title": "Web Performance Review",
"intro": [
@@ -3227,20 +3116,7 @@
"title": "Web Performance Quiz",
"intro": ["Test what you've learned in this quiz on Web Performance."]
},
"hzab": { "title": "318", "intro": [] },
"ggea": { "title": "319", "intro": [] },
"vgvz": { "title": "320", "intro": [] },
"review-typescript": {
"title": "Typescript Review",
"intro": [
"Review the Typescript concepts to prepare for the upcoming quiz."
]
},
"quiz-typescript": {
"title": "TypeScript Quiz",
"intro": ["Test what you've learned in this quiz on TypeScript."]
},
"zhhp": { "title": "323", "intro": [] },
"mbpv": { "title": "287", "intro": [] },
"review-css-libraries-and-frameworks": {
"title": "CSS Libraries and Frameworks Review",
"intro": [
@@ -3253,7 +3129,7 @@
"Test what you've learned in this quiz on CSS Libraries and Frameworks."
]
},
"gora": { "title": "326", "intro": [] },
"khuu": { "title": "290", "intro": [] },
"review-testing": {
"title": "Testing Review",
"intro": [
@@ -3264,14 +3140,29 @@
"title": "Testing Quiz",
"intro": ["Test what you've learned in this quiz on Testing."]
},
"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": [
"Review the Typescript concepts to prepare for the upcoming quiz."
]
},
"quiz-typescript": {
"title": "TypeScript Quiz",
"intro": ["Test what you've learned in this quiz on TypeScript."]
},
"review-front-end-libraries": {
"title": "Front End Libraries Review",
"intro": [
"Review the Front End Libraries concepts to prepare for the upcoming quiz."
]
},
"mfwu": { "title": "330", "intro": [] },
"dfcd": { "title": "331", "intro": [] },
"rdzk": { "title": "301", "intro": [] },
"vtpz": { "title": "302", "intro": [] },
"workshop-bash-boilerplate": {
"title": "Build a Boilerplate",
"intro": [
@@ -3289,7 +3180,7 @@
"title": "Bash Commands Quiz",
"intro": ["Test what you've learned in this quiz on Bash Commands."]
},
"thsj": { "title": "335", "intro": [] },
"voks": { "title": "306", "intro": [] },
"workshop-mario-database": {
"title": "Build a Mario Database",
"intro": [
@@ -3315,7 +3206,7 @@
"Test what you've learned in this quiz on Relational Databases."
]
},
"ynqt": { "title": "340", "intro": [] },
"pexz": { "title": "311", "intro": [] },
"workshop-bash-five-programs": {
"title": "Build Five Programs",
"intro": [
@@ -3333,7 +3224,7 @@
"title": "Bash Scripting Quiz",
"intro": ["Test what you've learned in this quiz on Bash Scripting."]
},
"pegc": { "title": "344", "intro": [] },
"tkgg": { "title": "315", "intro": [] },
"workshop-sql-student-database-part-1": {
"title": "Build a Student Database: Part 1",
"intro": [
@@ -3383,7 +3274,7 @@
"title": "Bash and SQL Quiz",
"intro": ["Test what you've learned in this quiz on Bash and SQL."]
},
"movb": { "title": "353", "intro": [] },
"eeez": { "title": "324", "intro": [] },
"workshop-castle": {
"title": "Build a Castle",
"intro": [
@@ -3399,7 +3290,7 @@
"title": "Nano Quiz",
"intro": ["Test what you've learned in this quiz on Nano."]
},
"pzmc": { "title": "357", "intro": [] },
"rhhl": { "title": "328", "intro": [] },
"workshop-sql-reference-object": {
"title": "Build an SQL Reference Object",
"intro": [
@@ -3433,20 +3324,39 @@
"Review the Relational Databases concepts to prepare for the upcoming quiz."
]
},
"thsj": { "title": "335", "intro": [] },
"uwum": { "title": "336", "intro": [] },
"asfv": { "title": "337", "intro": [] },
"bvfx": { "title": "338", "intro": [] },
"buzx": { "title": "339", "intro": [] },
"ynqt": { "title": "340", "intro": [] },
"prlo": { "title": "341", "intro": [] },
"jsnd": { "title": "342", "intro": [] },
"sxdc": { "title": "343", "intro": [] },
"pegc": { "title": "344", "intro": [] },
"mzae": { "title": "345", "intro": [] },
"gjbf": { "title": "346", "intro": [] },
"hzab": { "title": "347", "intro": [] },
"ggea": { "title": "348", "intro": [] },
"vgvz": { "title": "349", "intro": [] },
"hfwi": { "title": "350", "intro": [] },
"rnwr": { "title": "351", "intro": [] },
"zhhp": { "title": "352", "intro": [] },
"movb": { "title": "353", "intro": [] },
"ngor": { "title": "354", "intro": [] },
"gora": { "title": "355", "intro": [] },
"xdly": { "title": "356", "intro": [] },
"pzmc": { "title": "357", "intro": [] },
"oeqv": { "title": "358", "intro": [] },
"mfwu": { "title": "359", "intro": [] },
"dfcd": { "title": "360", "intro": [] },
"dfwl": { "title": "361", "intro": [] },
"adzm": { "title": "362", "intro": [] },
"kaui": { "title": "363", "intro": [] },
"zpjj": { "title": "364", "intro": [] },
"ghfk": { "title": "365", "intro": [] },
"review-security-and-privacy": {
"title": "Security and Privacy Review",
"intro": [
"Review the Security and Privacy concepts to prepare for the upcoming quiz."
]
},
"quiz-security-and-privacy": {
"title": "Security and Privacy Quiz",
"intro": [
"Test what you've learned in this quiz on Security and Privacy."
]
},
"ukem": { "title": "366", "intro": [] },
"sdjg": { "title": "367", "intro": [] },
"qjov": { "title": "368", "intro": [] },
"hjku": { "title": "370", "intro": [] },
"kegi": { "title": "377", "intro": [] },
@@ -3454,6 +3364,7 @@
"rlli": { "title": "380", "intro": [] },
"rjpv": { "title": "381", "intro": [] },
"xbri": { "title": "382", "intro": [] },
"xfrd": { "title": "383", "intro": [] },
"nkjt": { "title": "384", "intro": [] },
"pgjj": { "title": "385", "intro": [] },
"exom": { "title": "386", "intro": [] },

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Build a Cash Register
block: lab-cash-register
superBlock: full-stack-developer
---
## Introduction to the Build a Cash Register
For this lab, you will build a cash register.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Implement the Depth-First Search Algorithm
block: lab-depth-first-search
superBlock: full-stack-developer
---
## Introduction to the Implement the Depth-First Search Algorithm
For this lab, you will use JavaScript to implement the Depth-First Search algorithm.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Build a Hash Table Class
block: lab-hash-table-class
superBlock: full-stack-developer
---
## Introduction to the Build a Hash Table Class
For this lab, you will build a hash table using JavaScript.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Build a Linked List Class
block: lab-linked-list-class
superBlock: full-stack-developer
---
## Introduction to the Build a Linked List Class
For this lab, you will build a linked list class using JavaScript.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Build the nth Fibonacci number generator
block: lab-nth-fibonacci-number-generator
superBlock: full-stack-developer
---
## Introduction to the Build the nth Fibonacci number generator
For this lab, you will implement the nth Fibonacci number generator.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Build a Pokémon Search App
block: lab-pokemon-search-app
superBlock: full-stack-developer
---
## Introduction to the Build a Pokémon Search App
For this project, you will build a Pokémon search app.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Build the Quicksort Algorithm
block: lab-quicksort-algorithm
superBlock: full-stack-developer
---
## Introduction to the Build the Quicksort Algorithm
For this lab, you will implement the Quicksort algorithm using JavaScript.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Build a Roman Numeral Converter
block: lab-roman-numeral-converter
superBlock: full-stack-developer
---
## Introduction to the Build a Roman Numeral Converter
For this lab, you'll build an application that converts integers to Roman numerals.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Build a Stack Class
block: lab-stack-class
superBlock: full-stack-developer
---
## Introduction to the Build a Stack Class
For this lab, you will build a stack class using JavaScript.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Build a Telephone Number Validator
block: lab-telephone-number-validator
superBlock: full-stack-developer
---
## Introduction to the Build a Telephone Number Validator
For this lab, you'll build an application that checks if a number is a valid United States phone number.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Dynamic Programming Quiz
block: quiz-dynamic-programming
superBlock: full-stack-developer
---
## Introduction to the Dynamic Programming Quiz
Test what you've learned in this quiz on Dynamic Programming.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Graphs and Trees Quiz
block: quiz-graphs-and-trees
superBlock: full-stack-developer
---
## Introduction to the Graphs and Trees Quiz
Test what you've learned in this quiz on Graphs and Trees.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the JavaScript Data Structures Quiz
block: quiz-javascript-data-structures
superBlock: full-stack-developer
---
## Introduction to the JavaScript Data Structures Quiz
Test what you've learned in this quiz on JavaScript Data Structures.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the JavaScript Object Oriented Programming Quiz
block: quiz-javascript-object-oriented-programming
superBlock: full-stack-developer
---
## Introduction to the JavaScript Object Oriented Programming Quiz
Test what you've learned in this quiz on JavaScript Object Oriented Programming.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the JavaScript Problem Solving and Algorithmic Thinking Quiz
block: quiz-javascript-problem-solving-and-algorithmic-thinking
superBlock: full-stack-developer
---
## Introduction to the JavaScript Problem Solving and Algorithmic Thinking Quiz
Test what you've learned in this quiz on JavaScript Problem Solving and Algorithmic Thinking.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Searching and Sorting Algorithms Quiz
block: quiz-searching-and-sorting-algorithms
superBlock: full-stack-developer
---
## Introduction to the Searching and Sorting Algorithms Quiz
Test what you've learned in this quiz on Searching and Sorting Algorithms.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Security and Privacy Quiz
block: quiz-security-and-privacy
superBlock: full-stack-developer
---
## Introduction to the Security and Privacy Quiz
Test what you've learned in this quiz on Security and Privacy.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Web Standards Quiz
block: quiz-web-standards
superBlock: full-stack-developer
---
## Introduction to the Web Standards Quiz
Test what you've learned in this quiz on Web Standards.

View File

@@ -1,9 +0,0 @@
---
title: Introduction to the Security and Privacy Review
block: review-security-and-privacy
superBlock: full-stack-developer
---
## Introduction to the Security and Privacy Review
Review the Security and Privacy concepts to prepare for the upcoming quiz.

View File

@@ -1,11 +0,0 @@
{
"name": "Build a Cash Register",
"blockType": "lab",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "lab-cash-register",
"superBlock": "full-stack-developer",
"challengeOrder": [{ "id": "aa2e6f85cab2ab736c9a9b24", "title": "Build a Cash Register" }],
"helpCategory": "JavaScript"
}

View File

@@ -1,11 +0,0 @@
{
"name": "Implement the Depth-First Search Algorithm",
"blockType": "lab",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "lab-depth-first-search",
"superBlock": "full-stack-developer",
"challengeOrder": [{ "id": "587d825d367417b2b2512c96", "title": "Implement the Depth-First Search Algorithm" }],
"helpCategory": "JavaScript"
}

View File

@@ -1,11 +0,0 @@
{
"name": "Build a Hash Table Class",
"blockType": "lab",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "lab-hash-table-class",
"superBlock": "full-stack-developer",
"challengeOrder": [{ "id": "66f1805aac05f00a7028fbcc", "title": "Build a Hash Table Class" }],
"helpCategory": "JavaScript"
}

View File

@@ -1,11 +0,0 @@
{
"name": "Build a Linked List Class",
"blockType": "lab",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "lab-linked-list-class",
"superBlock": "full-stack-developer",
"challengeOrder": [{ "id": "66dadcf18df3a76104054d95", "title": "Build a Linked List Class" }],
"helpCategory": "JavaScript"
}

View File

@@ -1,11 +0,0 @@
{
"name": "Build the nth Fibonacci number generator",
"blockType": "lab",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "lab-nth-fibonacci-number-generator",
"superBlock": "full-stack-developer",
"challengeOrder": [{ "id": "66d9af3897e7d75a895b72c2", "title": "Build the nth Fibonacci number generator" }],
"helpCategory": "JavaScript"
}

View File

@@ -1,11 +0,0 @@
{
"name": "Build a Pokémon Search App",
"blockType": "lab",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "lab-pokemon-search-app",
"superBlock": "full-stack-developer",
"challengeOrder": [{ "id": "6555c1d3e11a1574434cf8b5", "title": "Build a Pokémon Search App" }],
"helpCategory": "JavaScript"
}

View File

@@ -1,11 +0,0 @@
{
"name": "Build the Quicksort Algorithm",
"blockType": "lab",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "lab-quicksort-algorithm",
"superBlock": "full-stack-developer",
"challengeOrder": [{ "id": "587d825a367417b2b2512c89", "title": "Build the Quicksort Algorithm" }],
"helpCategory": "JavaScript"
}

View File

@@ -1,11 +0,0 @@
{
"name": "Build a Roman Numeral Converter",
"blockType": "lab",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "lab-roman-numeral-converter",
"superBlock": "full-stack-developer",
"challengeOrder": [{ "id": "657bdc8ba322aae1eac38390", "title": "Build a Roman Numeral Converter" }],
"helpCategory": "JavaScript"
}

View File

@@ -1,11 +0,0 @@
{
"name": "Build a Stack Class",
"blockType": "lab",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "lab-stack-class",
"superBlock": "full-stack-developer",
"challengeOrder": [{ "id": "587d8250367417b2b2512c5f", "title": "Build a Stack Class" }],
"helpCategory": "JavaScript"
}

View File

@@ -1,11 +0,0 @@
{
"name": "Build a Telephone Number Validator",
"blockType": "lab",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "lab-telephone-number-validator",
"superBlock": "full-stack-developer",
"challengeOrder": [{ "id": "657bdcb9a322aae1eac38391", "title": "Build a Telephone Number Validator" }],
"helpCategory": "JavaScript"
}

View File

@@ -1,16 +0,0 @@
{
"name": "Dynamic Programming Quiz",
"blockType": "quiz",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "quiz-dynamic-programming",
"superBlock": "full-stack-developer",
"challengeOrder": [
{
"id": "66edd5ffe490bef99ea99395",
"title": "Dynamic Programming Quiz"
}
],
"helpCategory": "JavaScript"
}

View File

@@ -1,16 +0,0 @@
{
"name": "Graphs and Trees Quiz",
"blockType": "quiz",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "quiz-graphs-and-trees",
"superBlock": "full-stack-developer",
"challengeOrder": [
{
"id": "66edd5c8ac5314f8e80a3fc0",
"title": "Graphs and Trees Quiz"
}
],
"helpCategory": "JavaScript"
}

View File

@@ -1,16 +0,0 @@
{
"name": "JavaScript Data Structures Quiz",
"blockType": "quiz",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "quiz-javascript-data-structures",
"superBlock": "full-stack-developer",
"challengeOrder": [
{
"id": "66edd5583761e4f6dae19606",
"title": "JavaScript Data Structures Quiz"
}
],
"helpCategory": "JavaScript"
}

View File

@@ -1,16 +0,0 @@
{
"name": "JavaScript Object Oriented Programming Quiz",
"blockType": "quiz",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "quiz-javascript-object-oriented-programming",
"superBlock": "full-stack-developer",
"challengeOrder": [
{
"id": "66edd5267b52f8f617d8364f",
"title": "JavaScript Object Oriented Programming Quiz"
}
],
"helpCategory": "JavaScript"
}

View File

@@ -1,16 +0,0 @@
{
"name": "JavaScript Problem Solving and Algorithmic Thinking Quiz",
"blockType": "quiz",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "quiz-javascript-problem-solving-and-algorithmic-thinking",
"superBlock": "full-stack-developer",
"challengeOrder": [
{
"id": "66edd4bc0ce399f475ad6f9b",
"title": "JavaScript Problem Solving and Algorithmic Thinking Quiz"
}
],
"helpCategory": "JavaScript"
}

View File

@@ -1,16 +0,0 @@
{
"name": "Searching and Sorting Algorithms Quiz",
"blockType": "quiz",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "quiz-searching-and-sorting-algorithms",
"superBlock": "full-stack-developer",
"challengeOrder": [
{
"id": "66edd476078cf3f3bc654271",
"title": "Searching and Sorting Algorithms Quiz"
}
],
"helpCategory": "JavaScript"
}

View File

@@ -1,13 +0,0 @@
{
"name": "Security and Privacy Quiz",
"blockType": "quiz",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "quiz-security-and-privacy",
"superBlock": "full-stack-developer",
"challengeOrder": [
{ "id": "66f1b0a939e913ccd3d4fa18", "title": "Security and Privacy Quiz" }
],
"helpCategory": "Backend Development"
}

View File

@@ -1,13 +0,0 @@
{
"name": "Web Standards Quiz",
"blockType": "quiz",
"blockLayout": "link",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "quiz-web-standards",
"superBlock": "full-stack-developer",
"challengeOrder": [
{ "id": "66f1a0fcab4dfe9fcdcb269d", "title": "Web Standards Quiz" }
],
"helpCategory": "HTML-CSS"
}

View File

@@ -1,12 +0,0 @@
{
"name": "Security and Privacy Review",
"blockType": "review",
"blockLayout": "link",
"isUpcomingChange": true,
"dashedName": "review-security-and-privacy",
"superBlock": "full-stack-developer",
"challengeOrder": [
{ "id": "6724e6548eec94290a26f410", "title": "Security and Privacy Review" }
],
"helpCategory": "Backend Development"
}

View File

@@ -1,244 +0,0 @@
---
id: aa2e6f85cab2ab736c9a9b24
title: Build a Cash Register
challengeType: 14
dashedName: build-a-cash-register
---
# --description--
Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. You should create a cash register drawer function `checkCashRegister()` that accepts purchase price as the first argument (`price`), payment as the second argument (`cash`), and cash-in-drawer (`cid`, which is is a 2D array listing available currency) as the third argument.
1. The `checkCashRegister()` function should always return an object with a `status` key and a `change` key.
1. If cash-in-drawer is less than the change due, or if you cannot return the exact change, the function should return `{status: "INSUFFICIENT_FUNDS", change: []}`.
1. If the cash-in-drawer is equal to the change due, the function should return `{status: "CLOSED", change: [...]}` with cash-in-drawer as the value for the key `change`.
1. Otherwise, the function should return `{status: "OPEN", change: [...]}`, with the change due in coins and bills, sorted in highest to lowest order, as the value of the `change` key.
<table><tbody><tr><th>Currency Unit</th><th>Amount</th></tr><tr><td>Penny</td><td>$0.01 (PENNY)</td></tr><tr><td>Nickel</td><td>$0.05 (NICKEL)</td></tr><tr><td>Dime</td><td>$0.1 (DIME)</td></tr><tr><td>Quarter</td><td>$0.25 (QUARTER)</td></tr><tr><td>Dollar</td><td>$1 (ONE)</td></tr><tr><td>Five Dollars</td><td>$5 (FIVE)</td></tr><tr><td>Ten Dollars</td><td>$10 (TEN)</td></tr><tr><td>Twenty Dollars</td><td>$20 (TWENTY)</td></tr><tr><td>One-hundred Dollars</td><td>$100 (ONE HUNDRED)</td></tr></tbody></table>
See below for an example of a cash-in-drawer array:
```js
[
["PENNY", 1.01],
["NICKEL", 2.05],
["DIME", 3.1],
["QUARTER", 4.25],
["ONE", 90],
["FIVE", 55],
["TEN", 20],
["TWENTY", 60],
["ONE HUNDRED", 100]
]
```
# --hints--
`checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])` should return an object.
```js
assert.deepEqual(
Object.prototype.toString.call(
checkCashRegister(19.5, 20, [
['PENNY', 1.01],
['NICKEL', 2.05],
['DIME', 3.1],
['QUARTER', 4.25],
['ONE', 90],
['FIVE', 55],
['TEN', 20],
['TWENTY', 60],
['ONE HUNDRED', 100]
])
),
'[object Object]'
);
```
`checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])` should return `{status: "OPEN", change: [["QUARTER", 0.5]]}`.
```js
assert.deepEqual(
checkCashRegister(19.5, 20, [
['PENNY', 1.01],
['NICKEL', 2.05],
['DIME', 3.1],
['QUARTER', 4.25],
['ONE', 90],
['FIVE', 55],
['TEN', 20],
['TWENTY', 60],
['ONE HUNDRED', 100]
]),
{ status: 'OPEN', change: [['QUARTER', 0.5]] }
);
```
`checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])` should return `{status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]}`.
```js
assert.deepEqual(
checkCashRegister(3.26, 100, [
['PENNY', 1.01],
['NICKEL', 2.05],
['DIME', 3.1],
['QUARTER', 4.25],
['ONE', 90],
['FIVE', 55],
['TEN', 20],
['TWENTY', 60],
['ONE HUNDRED', 100]
]),
{
status: 'OPEN',
change: [
['TWENTY', 60],
['TEN', 20],
['FIVE', 15],
['ONE', 1],
['QUARTER', 0.5],
['DIME', 0.2],
['PENNY', 0.04]
]
}
);
```
`checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])` should return `{status: "INSUFFICIENT_FUNDS", change: []}`.
```js
assert.deepEqual(
checkCashRegister(19.5, 20, [
['PENNY', 0.01],
['NICKEL', 0],
['DIME', 0],
['QUARTER', 0],
['ONE', 0],
['FIVE', 0],
['TEN', 0],
['TWENTY', 0],
['ONE HUNDRED', 0]
]),
{ status: 'INSUFFICIENT_FUNDS', change: [] }
);
```
`checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])` should return `{status: "INSUFFICIENT_FUNDS", change: []}`.
```js
assert.deepEqual(
checkCashRegister(19.5, 20, [
['PENNY', 0.01],
['NICKEL', 0],
['DIME', 0],
['QUARTER', 0],
['ONE', 1],
['FIVE', 0],
['TEN', 0],
['TWENTY', 0],
['ONE HUNDRED', 0]
]),
{ status: 'INSUFFICIENT_FUNDS', change: [] }
);
```
`checkCashRegister(19.5, 20, [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])` should return `{status: "CLOSED", change: [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]}`.
```js
assert.deepEqual(
checkCashRegister(19.5, 20, [
['PENNY', 0.5],
['NICKEL', 0],
['DIME', 0],
['QUARTER', 0],
['ONE', 0],
['FIVE', 0],
['TEN', 0],
['TWENTY', 0],
['ONE HUNDRED', 0]
]),
{
status: 'CLOSED',
change: [
['PENNY', 0.5],
['NICKEL', 0],
['DIME', 0],
['QUARTER', 0],
['ONE', 0],
['FIVE', 0],
['TEN', 0],
['TWENTY', 0],
['ONE HUNDRED', 0]
]
}
);
```
# --seed--
## --seed-contents--
```js
```
# --solutions--
```js
const denom = [
{ name: "ONE HUNDRED", val: 100 },
{ name: "TWENTY", val: 20 },
{ name: "TEN", val: 10 },
{ name: "FIVE", val: 5 },
{ name: "ONE", val: 1 },
{ name: "QUARTER", val: 0.25 },
{ name: "DIME", val: 0.1 },
{ name: "NICKEL", val: 0.05 },
{ name: "PENNY", val: 0.01 },
];
function checkCashRegister(price, cash, cid) {
const output = { status: null, change: [] };
let change = cash - price;
const register = cid.reduce(
function (acc, curr) {
acc.total += curr[1];
acc[curr[0]] = curr[1];
return acc;
},
{ total: 0 }
);
if (register.total === change) {
output.status = "CLOSED";
output.change = cid;
return output;
}
if (register.total < change) {
output.status = "INSUFFICIENT_FUNDS";
return output;
}
const change_arr = denom.reduce(function (acc, curr) {
let value = 0;
while (register[curr.name] > 0 && change >= curr.val) {
change -= curr.val;
register[curr.name] -= curr.val;
value += curr.val;
change = Math.round(change * 100) / 100;
}
if (value > 0) {
acc.push([curr.name, value]);
}
return acc;
}, []);
if (change_arr.length < 1 || change > 0) {
output.status = "INSUFFICIENT_FUNDS";
return output;
}
output.status = "OPEN";
output.change = change_arr;
return output;
}
```

View File

@@ -1,212 +0,0 @@
---
id: 587d825d367417b2b2512c96
title: Implement the Depth-First Search Algorithm
challengeType: 14
dashedName: implement-the-depth-first-search-algorithm
---
# --description--
<dfn>Depth-first search</dfn> (DFS) is an algorithm used to search through data structures such as trees or graphs. Starting from a root node, the search first goes down a path of edges as far as it can. Once it reaches one end of a path, the search will backtrack to the last node with an unvisited edge path and continue searching down the unvisited edge path.
**Objective:** Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. You should write a function `dfs()` that implements the <dfn>depth-first search</dfn> algorithm on a graph.
1. The function should keep track of the visited nodes.
1. The function should use a stack, an array where the last element added is the first to be removed, to make sure to visit the neighbors of the most recently added node.
1. The function should take an undirected, adjacency matrix `graph` and a node label `root` as parameters. The node label is the numeric value of the node between `0` and `n - 1`, where `n` is the total number of nodes in the graph.
1. The function should output an array of all nodes reachable from `root`.
# --hints--
The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` with a start node of `1` should return an array with `0`, `1`, `2`, and `3`.
```js
assert.sameMembers(
(function () {
var graph = [
[0, 1, 0, 0],
[1, 0, 1, 0],
[0, 1, 0, 1],
[0, 0, 1, 0]
];
return dfs(graph, 1);
})(),
[0, 1, 2, 3]
);
```
The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` with a start node of `3` should return an array with `3`, `2`, `1`, and `0`.
```js
assert.sameMembers(
(function () {
var graph = [
[0, 1, 0, 0],
[1, 0, 1, 0],
[0, 1, 0, 1],
[0, 0, 1, 0]
];
return dfs(graph, 3);
})(),
[3, 2, 1, 0]
);
```
The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` with a start node of `1` should return an array with four elements.
```js
assert(
(function () {
var graph = [
[0, 1, 0, 0],
[1, 0, 1, 0],
[0, 1, 0, 1],
[0, 0, 1, 0]
];
return dfs(graph, 1);
})().length === 4
);
```
The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 0]]` with a start node of `3` should return an array with `3`.
```js
assert.sameMembers(
(function () {
var graph = [
[0, 1, 0, 0],
[1, 0, 1, 0],
[0, 1, 0, 0],
[0, 0, 0, 0]
];
return dfs(graph, 3);
})(),
[3]
);
```
The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 0]]` with a start node of `3` should return an array with one element.
```js
assert(
(function () {
var graph = [
[0, 1, 0, 0],
[1, 0, 1, 0],
[0, 1, 0, 0],
[0, 0, 0, 0]
];
return dfs(graph, 3);
})().length === 1
);
```
The input graph `[[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]` with a start node of `3` should return an array with `2` and `3`.
```js
assert.sameMembers(
(function () {
var graph = [
[0, 1, 0, 0],
[1, 0, 0, 0],
[0, 0, 0, 1],
[0, 0, 1, 0]
];
return dfs(graph, 3);
})(),
[2, 3]
);
```
The input graph `[[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]` with a start node of `3` should return an array with two elements.
```js
assert(
(function () {
var graph = [
[0, 1, 0, 0],
[1, 0, 0, 0],
[0, 0, 0, 1],
[0, 0, 1, 0]
];
return dfs(graph, 3);
})().length === 2
);
```
The input graph `[[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]` with a start node of `0` should return an array with `0` and `1`.
```js
assert.sameMembers(
(function () {
var graph = [
[0, 1, 0, 0],
[1, 0, 0, 0],
[0, 0, 0, 1],
[0, 0, 1, 0]
];
return dfs(graph, 0);
})(),
[0, 1]
);
```
The input graph `[[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]` with a start node of `0` should return an array with two elements.
```js
assert(
(function () {
var graph = [
[0, 1, 0, 0],
[1, 0, 0, 0],
[0, 0, 0, 1],
[0, 0, 1, 0]
];
return dfs(graph, 0);
})().length === 2
);
```
# --seed--
## --seed-contents--
```js
```
# --solutions--
```js
function dfs(graph, root) {
const stack = [];
let tempV;
const visited = [];
let tempVNeighbors = [];
stack.push(root);
while (stack.length > 0) {
tempV = stack.pop();
if (visited.indexOf(tempV) == -1) {
visited.push(tempV);
tempVNeighbors = graph[tempV];
for (let i = 0; i < tempVNeighbors.length; i++) {
if (tempVNeighbors[i] == 1) {
stack.push(i);
}
}
}
}
return visited;
}
const exDFSGraph = [
[0, 1, 0, 0],
[1, 0, 1, 0],
[0, 1, 0, 1],
[0, 0, 1, 0]
];
console.log(dfs(exDFSGraph, 0));
```

View File

@@ -1,221 +0,0 @@
---
id: 66f1805aac05f00a7028fbcc
title: Build a Hash Table Class
challengeType: 14
dashedName: build-a-hash-table-class
---
# --description--
**Objective:** Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. You should define a class named `HashTable` with a `collection` property initialized as an empty object inside its `constructor` method. The `collection` object should store key-value pairs based on the hashed value of the key.
1. The `HashTable` class should have four instance methods, namely `hash`, `add`, `remove`, and `lookup`.
1. The `hash` method should take a string as a parameter and return the hashed value computed as the sum of the UTF-16 code unit of each character in the string. Use the `charCodeAt` method for that.
1. The `add` method should take a key-value pair as the parameters, and hash the key. The hashed value should be used to store the key-value pair inside the hash table (`collection` object). When the same hash value is produced by multiple different keys, each key-value pair should be stored using the same hash value.
1. The `remove` method should take a key as a parameter and remove the corresponding key-value pair from the hash table. If that's the last key-value pair, it should remove the hash key as well.
1. The `lookup` method should take a key as a parameter and return the corresponding value stored inside the hash table, or `null` if not present.
# --hints--
You should have a `HashTable` class.
```js
assert.isFunction(HashTable);
assert.isObject(new HashTable());
```
Your `HashTable` class should have a `collection` property initialized as an empty object.
```js
const table = new HashTable();
assert.isObject(table.collection);
assert.isEmpty(table.collection);
```
Your `HashTable` class should have a `hash` method.
```js
const table = new HashTable();
assert.isFunction(table.hash);
```
`new HashTable().hash("freeCodeCamp")` should return `1182`.
```js
const table = new HashTable();
assert.strictEqual(table.hash("freeCodeCamp"), 1182);
```
The `hash` method should take a string as a parameter and return the hashed value computed as the sum of the UTF-16 code unit of each character in the string using the `charCodeAt` method.
```js
const table = new HashTable();
assert.strictEqual(table.hash("Hey you"), 675);
```
Your `HashTable` class should have an `add` method.
```js
const table = new HashTable();
assert.isFunction(table.add);
```
After calling `hashTable.add("FCC", "freeCodeCamp")`, `hashTable.collection` should become `{ 204: { FCC: 'freeCodeCamp' } }`.
```js
const table = new HashTable();
table.add("FCC", "freeCodeCamp");
assert.deepEqual(table.collection, { 204: { FCC: 'freeCodeCamp' } });
```
The `add` method should take a key-value pair as the parameters, hash the key and store the key-value pair inside the hashed key of the `collection` object.
```js
const table = new HashTable();
table.add("test", "this is a test");
assert.deepEqual(table.collection, { 448: { test: 'this is a test' } });
```
After calling `hashTable.add("FCC", "freeCodeCamp")` and `hashTable.add("CFC", "chloroflourocarbon")`, `hashTable.collection` should become `{ 204: { FCC: 'freeCodeCamp', CFC: 'chloroflourocarbon' } }`.
```js
const table = new HashTable();
table.add("FCC", "freeCodeCamp");
table.add("CFC", "chloroflourocarbon");
assert.deepEqual(table.collection, { 204: { FCC: 'freeCodeCamp', CFC: 'chloroflourocarbon' } });
```
When the same hash value is produced by multiple different keys, the `add` method should store each key-value pair using the same hash value.
```js
const table = new HashTable();
table.add("pan", "frying");
table.add("nap", "sleeping");
assert.deepEqual(table.collection, { 319: { pan: 'frying', nap: 'sleeping' } });
```
Your `HashTable` class should have a `remove` method.
```js
const table = new HashTable();
assert.isFunction(table.remove);
```
When `hashtable.collection` is equal to `{ 204: { FCC: 'freeCodeCamp' } }`, `hashTable.remove("FCC")` should remove both the `FCC` key and the `204` key from the `collection` object.
```js
const table = new HashTable();
table.add("FCC", "freeCodeCamp");
table.remove("FCC");
assert.isEmpty(table.collection);
```
When `hashtable.collection` is equal to `{ 204: { FCC: 'freeCodeCamp', CFC: 'chloroflourocarbon' } }`, `hashTable.remove("FCC")` should only remove the `FCC` key from the value of the key `204`.
```js
const table = new HashTable();
table.add("FCC", "freeCodeCamp");
table.add("CFC", "chloroflourocarbon");
table.remove("FCC");
assert.deepEqual(table.collection, { 204: { CFC: 'chloroflourocarbon' } });
```
The `remove` method should accept a key as input and remove both the associated key value pair and the hash key when it is empty.
```js
const table = new HashTable();
table.add("FCC", "freeCodeCamp");
table.remove("FCC");
assert.isEmpty(table.collection);
```
The `remove` method should only remove the correct key value pair from the hash key object.
```js
const table = new HashTable();
table.add("pan", "frying");
table.add("nap", "sleeping");
table.remove("pan");
assert.deepEqual(table.collection, { 319: { nap: 'sleeping' } });
```
Your `HashTable` class should have a `lookup` method.
```js
const table = new HashTable();
assert.isFunction(table.lookup);
```
`hashTable.lookup("FCC")` should return the value of the `FCC` key stored within `hashtable.collection`.
```js
const table = new HashTable();
table.add("FCC", "freeCodeCamp");
table.add("CFC", "chloroflourocarbon");
assert.strictEqual(table.lookup("FCC"), "freeCodeCamp");
```
`hashTable.lookup("FCC")` should return `null` if there's no `FCC` key stored within `hashtable.collection`.
```js
const table = new HashTable();
table.add("FCC", "freeCodeCamp");
table.add("CFC", "chloroflourocarbon");
assert.isNull(table.lookup("x"));
```
# --seed--
## --seed-contents--
```js
```
# --solutions--
```js
class HashTable {
constructor() {
this.collection = {};
}
hash(string) {
let hashed = 0;
for (let i = 0; i < string.length; i++) {
hashed += string.charCodeAt(i);
}
return hashed
}
add(key, val) {
const theHash = this.hash(key);
if (!this.collection.hasOwnProperty(theHash)) {
this.collection[theHash] = {};
}
this.collection[theHash][key] = val;
}
remove(key) {
const theHash = this.hash(key);
const hashedObj = this.collection[theHash];
if (hashedObj.hasOwnProperty(key)) {
delete hashedObj[key];
}
if (!Object.keys(hashedObj).length) {
delete this.collection[theHash];
}
}
lookup(key) {
const theHash = this.hash(key);
if (this.collection.hasOwnProperty(theHash)) {
return this.collection[theHash][key];
}
return null
}
}
```

View File

@@ -1,267 +0,0 @@
---
id: 66dadcf18df3a76104054d95
title: Build a Linked List Class
challengeType: 14
dashedName: build-a-linked-list-class
---
# --description--
In this lab, you'll build a linked list, which is a linear collection of data elements, called <dfn>nodes</dfn>, where each node points to the next node in the linked list. Each node in a linked list contains two key pieces of information: the element itself, and a reference to the next node.
Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. You should create a class named `LinkedList` to represent a linked list data structure.
1. Each time a new `LinkedList` object is instantiated, its `length` and `head` properties should be set to `0` and `null`, respectively.
1. The `LinkedList` class should have a property `Node`, which is a class instantiated with an `element` property set to the value passed at the instantiation, and a `next` property set to `null`.
1. The `LinkedList` class should have a method `isEmpty` that returns `true` if the linked list is empty, and `false` otherwise.
1. The `LinkedList` class should have a method `add` that creates a `Node` object from its argument and adds it to the linked list.
1. The `add` method should either set the head to the new node when the node to be added is the first, or set the `next` property of the last node in the linked list to the node to be added.
1. Each time a new node is added to the list the length of the list should be incremented.
1. The `LinkedList` class should have a method `remove` that takes a single argument and removes the corresponding node from the list.
1. Whenever a node is removed from the linked list, the `next` property of the previous node should be set to the following node, and the length of the list should be decremented.
# --hints--
Your `LinkedList` class should instantiate objects with the `length` property set to `0`.
```js
const test = new LinkedList();
assert.strictEqual(test.length, 0);
```
Your `LinkedList` class should instantiate objects with the `head` property set to `null`.
```js
const test = new LinkedList();
assert.strictEqual(test.head, null);
```
Your `LinkedList` class should have a property `Node`.
```js
const test = new LinkedList();
assert.property(test, "Node");
```
Your `Node` property should be a class that instantiates objects with an `element` property set to the value passed at the instantiation.
```js
const test = new LinkedList();
const node = new test.Node("pig");
assert.strictEqual(node.element, "pig");
```
Your `Node` property should be a class that instantiates objects with a `next` property set to `null`.
```js
const test = new LinkedList();
const node = new test.Node("pig");
assert.strictEqual(node.next, null);
```
Your `LinkedList` class should have an `add` method.
```js
const test = new LinkedList();
assert.typeOf(test.add, 'function');
```
Your `add` method should assign `head` to the first node object added to the linked list.
```js
const test = new LinkedList();
test.add("pig");
const expected = { element: "pig", next: null }
assert.deepEqual(test.head, expected);
```
Your `add` method should set the `next` property of the last node in the linked list to the node to be added.
```js
const test = new LinkedList();
test.add("pig");
test.add("dog")
const expected = { element: "pig", next: {element: "dog", next: null} }
assert.deepEqual(test.head, expected);
```
Each time a new node is added to the list the `length` of the list should be incremented.
```js
const test = new LinkedList();
test.add("pig");
assert.strictEqual(test.length, 1);
test.add("dog");
assert.strictEqual(test.length, 2);
test.add("sheep");
assert.strictEqual(test.length, 3);
```
Your `LinkedList` class should have an `isEmpty` method.
```js
const test = new LinkedList();
assert.typeOf(test.isEmpty, 'function');
```
Your `isEmpty` method should return `false` when there is at least one element in the linked list.
```js
const test = new LinkedList();
test.add('pig');
test.add('dog');
test.add('kitten');
assert.isFalse(test.isEmpty());
```
Your `isEmpty` method should return `true` when there are no elements in linked list.
```js
const test = new LinkedList();
assert.isTrue(test.isEmpty());
```
The previous node in your `LinkedList` class should have a reference to the newest node created.
```js
const test = new LinkedList();
test.add("pig");
test.add("dog")
test.add("sheep");
assert(test.head.next.element === 'dog' && test.head.next.next.element === "sheep");
```
Your `LinkedList` class should have a `remove` method.
```js
const test = new LinkedList();
assert.typeOf(test.remove, 'function');
```
Your `remove` method should reassign `head` to the second node when the first node is removed.
```js
const test = new LinkedList();
test.add("pig");
test.add("dog");
test.add("sheep");
test.remove("pig");
const expected = { element: "dog", next: {element: "sheep", next: null} }
assert.deepEqual(test.head, expected);
```
Your `remove` method should decrease the `length` of the linked list by one for every node removed.
```js
const test = new LinkedList();
test.add("pig");
test.add("dog");
test.add("sheep");
test.remove("pig");
assert.strictEqual(test.length, 2);
test.remove("dog");
assert.strictEqual(test.length, 1);
test.remove("sheep");
assert.strictEqual(test.length, 0);
```
Your `remove` method should reassign the reference of the previous node of the removed node to the removed node's `next` reference.
```js
const test = new LinkedList();
test.add("pig");
test.add("dog");
test.add("sheep");
test.add("cat");
test.remove("sheep");
const expected = { element: "pig", next: {element: "dog", next: {element: "cat", next: null}} }
assert.deepEqual(test.head, expected);
```
Your `remove` method should not change the linked list if the element does not exist in the linked list.
```js
const test = new LinkedList();
test.add("pig");
test.add("dog");
test.add("sheep");
test.add("cat");
test.remove("elephant");
const expected = { element: "pig", next: {element: "dog", next: {element: "sheep", next: {element: "cat", next: null}}} }
assert.deepEqual(test.head, expected);
```
# --seed--
## --seed-contents--
```js
```
# --solutions--
```js
class LinkedList {
constructor() {
this.length = 0;
this.head = null;
}
Node = class {
constructor(element) {
this.element = element;
this.next = null;
}
}
isEmpty() {
return this.length === 0;
}
add(element) {
const node = new this.Node(element)
if (this.isEmpty()) {
this.head = node;
} else {
let currentNode = this.head;
while (currentNode.next !== null) {
currentNode = currentNode.next;
}
currentNode.next = node;
}
this.length++;
}
remove(element) {
if (this.isEmpty()) {
return
}
let previousNode;
let currentNode = this.head;
while (currentNode.next !== null && currentNode.element !== element) {
previousNode = currentNode;
currentNode = currentNode.next;
}
if (currentNode.next === null && currentNode.element !== element) {
return;
} else if (previousNode) {
previousNode.next = currentNode.next
} else {
this.head = currentNode.next;
}
this.length--
}
}
```

View File

@@ -1,131 +0,0 @@
---
id: 66d9af3897e7d75a895b72c2
title: Build the nth Fibonacci number generator
challengeType: 14
dashedName: lab-nth-fibonacci-number-generator
---
# --description--
In this lab you will use a dynamic programming approach to compute and return the `n`-th number from the Fibonacci sequence, in which each number is the sum of the two preceding numbers.
Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. You should define an array named `sequence` in the global scope. It should contain the number `0` and `1`.
1. You should create a function named `fibonacci`.
1. The `fibonacci` function should take a single parameter, which is a positive integer.
1. If the input is not a positive integer, the function should return `"Invalid input"`.
1. A call to `fibonacci(n)` should use a dynamic programming approach to compute and return the `n`-th number from the Fibonacci sequence.
1. Each computed number at the position `n` in the Fibonacci sequence should be stored at the index `n - 1` of the `sequence` array.
1. If the input number requests an already computed number, no new computations should happen and the number should be retrieved from the `sequence` array.
# --hints--
You should have a `sequence` array.
```js
assert.isArray(sequence);
```
The `sequence` array should contain `0` and `1` at definition.
```js
assert.match(__helpers.removeJSComments(code), /(let|const)\s+sequence\s*=\s*\[\s*0\s*,\s*1\s*\]\s*;?/)
```
You should create a `fibonacci` function.
```js
assert.isFunction(fibonacci);
```
`fibonacci(3.5)` should return `"Invalid input"`.
```js
assert.strictEqual(fibonacci(3.5), "Invalid input")
```
`fibonacci(0)` should return `"Invalid input"`.
```js
assert.strictEqual(fibonacci(0), "Invalid input")
```
`fibonacci(-1)` should return `"Invalid input"`.
```js
assert.strictEqual(fibonacci(-1), "Invalid input")
```
`fibonacci("three")` should return `"Invalid input"`.
```js
assert.strictEqual(fibonacci("three"), "Invalid input")
```
`fibonacci(1)` should return `0`.
```js
assert.strictEqual(fibonacci(1), 0)
```
`fibonacci(32)` should return `1346269`.
```js
assert.strictEqual(fibonacci(32), 1346269)
```
`fibonacci(5)` should return `3`.
```js
assert.strictEqual(fibonacci(5), 3);
```
`sequence` should contain numbers up to the highest call so far.
```js
sequence.length = 2
fibonacci(2)
assert.lengthOf(sequence, 2)
fibonacci(5)
assert.lengthOf(sequence, 5)
fibonacci(3)
assert.lengthOf(sequence, 5)
fibonacci(10)
assert.lengthOf(sequence, 10)
assert.deepEqual(sequence, [0, 1, 1, 2, 3, 5, 8, 13, 21, 34])
```
# --seed--
## --seed-contents--
```js
```
# --solutions--
```js
const sequence = [0, 1];
const fibonacci = (n) => {
if (typeof n !== "number" || n < 1 || n % 1 !== 0) {
console.log("Invalid input")
return "Invalid input"
}
if (n <= sequence.length) {
return sequence[n - 1];
}
for (let i = sequence.length; i < n; i++) {
sequence.push(sequence[i - 1] + sequence[i - 2]);
}
return sequence[n - 1]
}
```

View File

@@ -1,909 +0,0 @@
---
id: 6555c1d3e11a1574434cf8b5
title: Build a Pokémon Search App
challengeType: 14
dashedName: build-a-pokemon-search-app
demoType: onClick
---
# --description--
In this lab, you'll build an app that will search for Pokémon by name or ID and display the results to the user. To retrieve the Pokémon data and images, you'll use freeCodeCamp's <a href="https://pokeapi-proxy.freecodecamp.rocks/" target="_blank" rel="noopener noreferrer nofollow">PokéAPI Proxy</a>.
Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. You should have an `input` element with the `id="search-input"`.
1. You should have a `button` element with the `id="search-button"`.
1. You should ensure the following elements exist with their respective IDs:
- `#pokemon-name`
- `#pokemon-id`
- `#weight`
- `#height`
- `#types`
- `#hp`
- `#attack`
- `#defense`
- `#special-attack`
- `#special-defense`
- `#speed`
1. When your `#search-input` element contains the value `Red` and the `#search-button` element is clicked, an alert should appear with the text `"Pokémon not found"`
1. When your `#search-input` contains `Pikachu` and the `#search-button` is clicked:
- You should set the values for the following elements:
- `#pokemon-name`: `"PIKACHU"`
- `#pokemon-id`: `"#25"` or `25`
- `#weight`: `"Weight: 60"` or `60`
- `#height`: `"Height: 4"` or `4`
- `#hp`: `35`
- `#attack`: `55`
- `#defense`: `40`
- `#special-attack`: `50`
- `#special-defense`: `50`
- `#speed`: `90`
- You should add an `img` element with the `id` `"sprite"` and set its `src` to Pikachu's `front_default` sprite.
- Update the `#types` element to display `"ELECTRIC"` as its only inner element. Ensure the content is cleared between searches.
1. When your `#search-input` contains `94` and the `#search-button` is clicked:
- You should set the values for the following elements:
- `#pokemon-name`: `"GENGAR"`
- `#pokemon-id`: `"#94"` or `94`
- `#weight`: `"Weight: 405"` or `405`
- `#height`: `"Height: 15"` or `15`
- `#hp`: `60`
- `#attack`: `65`
- `#defense`: `60`
- `#special-attack`: `130`
- `#special-defense`: `75`
- `#speed`: `110`
- You should add an `img` element with the `id` `"sprite"` and set its `src` to Gengar's `front_default` sprite.
- Update the `#types` element to display two inner elements: `"GHOST"` and `"POISON"`. Ensure the content is cleared between searches.
**Note:** Be sure to link your stylesheet and the JavaScript file in your HTML.
# --hints--
You should have an `input` element with an `id` of `"search-input"` and is **required**.
```js
const el = document.getElementById('search-input');
assert.strictEqual(el?.nodeName?.toLowerCase(), 'input');
assert.isTrue(el?.required);
```
You should have a `button` element with an `id` of `"search-button"`.
```js
const el = document.getElementById('search-button');
assert.strictEqual(el?.nodeName?.toLowerCase(), 'button');
```
You should have an element with an `id` of `"pokemon-name"`.
```js
const el = document.getElementById('pokemon-name');
assert.exists(el);
```
You should have an element with an `id` of `"pokemon-id"`.
```js
const el = document.getElementById('pokemon-id');
assert.exists(el);
```
You should have an element with an `id` of `"weight"`.
```js
const el = document.getElementById('weight');
assert.exists(el);
```
You should have an element with an `id` of `"height"`.
```js
const el = document.getElementById('height');
assert.exists(el);
```
You should have an element with an `id` of `"types"`.
```js
const el = document.getElementById('types');
assert.exists(el);
```
You should have an element with an `id` of `"hp"`.
```js
const el = document.getElementById('hp');
assert.exists(el);
```
You should have an element with an `id` of `"attack"`.
```js
const el = document.getElementById('attack');
assert.exists(el);
```
You should have an element with an `id` of `"defense"`.
```js
const el = document.getElementById('defense');
assert.exists(el);
```
You should have an element with an `id` of `"special-attack"`.
```js
const el = document.getElementById('special-attack');
assert.exists(el);
```
You should have an element with an `id` of `"special-defense"`.
```js
const el = document.getElementById('special-defense');
assert.exists(el);
```
You should have an element with an `id` of `"speed"`.
```js
const el = document.getElementById('speed');
assert.exists(el);
```
When the `#search-input` element contains the value `Red` and the `#search-button` element is clicked, an alert should appear with the text `"Pokémon not found"`.
```js
async () => {
try {
const searchInput = document.getElementById('search-input');
const searchButton = document.getElementById('search-button');
let alertMessage;
window.alert = (message) => alertMessage = message; // Override alert and store message
searchInput.value = 'Red';
searchInput.dispatchEvent(new Event('change'));
searchButton.click();
const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/red'); // Fetch from proxy to simulate network delay
if (!res.ok) {
await new Promise(resolve => setTimeout(resolve, 1000)); // Additional delay to allow the alert to trigger
assert.include(['pokémon not found', 'pokemon not found'], alertMessage.trim().replace(/[.,?!]+$/g, '').toLowerCase());
}
} catch (err) {
throw new Error(err);
}
};
```
When the `#search-input` element contains the value `Pikachu` and the `#search-button` element is clicked, the values in the `#pokemon-name`, `#pokemon-id`, `#weight`, `#height`, `#hp`, `#attack`, `#defense`, `#special-attack`, `#special-defense`, and `#speed` elements should be `PIKACHU`, `#25` or `25`, `Weight: 60` or `60`, `Height: 4` or `4`, `35`, `55`, `40`, `50`, `50`, and `90`, respectively.
```js
async () => {
try {
const searchInput = document.getElementById('search-input');
const searchButton = document.getElementById('search-button');
searchInput.value = 'Pikachu';
searchInput.dispatchEvent(new Event('change'));
searchButton.click();
const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/pikachu'); // Fetch from proxy to simulate network delay
if (res.ok) {
await new Promise(resolve => setTimeout(resolve, 1000)); // Additional delay to allow UI to update
const pokemonName = document.getElementById('pokemon-name');
const pokemonID = document.getElementById('pokemon-id');
const weight = document.getElementById('weight');
const height = document.getElementById('height');
const hp = document.getElementById('hp');
const attack = document.getElementById('attack');
const defense = document.getElementById('defense');
const specialAttack = document.getElementById('special-attack');
const specialDefense = document.getElementById('special-defense');
const speed = document.getElementById('speed');
assert.strictEqual(pokemonName.innerText.trim().toLowerCase(), 'pikachu');
assert.include(['#25', '25'], pokemonID.innerText.trim());
assert.include(['weight: 60', '60'], weight.innerText.trim().toLowerCase());
assert.include(['height: 4', '4'], height.innerText.trim().toLowerCase());
assert.strictEqual(hp.innerText.trim(), '35');
assert.strictEqual(attack.innerText.trim(), '55');
assert.strictEqual(defense.innerText.trim(), '40');
assert.strictEqual(specialAttack.innerText.trim(), '50');
assert.strictEqual(specialDefense.innerText.trim(), '50');
assert.strictEqual(speed.innerText.trim(), '90');
}
} catch (err) {
throw new Error(err);
}
};
```
When the `#search-input` element contains the value `Pikachu` and the `#search-button` element is clicked, you should add an `img` element with the `id` of `"sprite"` and the `src` set to the Pokémon's `front_default` sprite to the page.
```js
async () => {
try {
const searchInput = document.getElementById('search-input');
const searchButton = document.getElementById('search-button');
searchInput.value = 'Pikachu';
searchInput.dispatchEvent(new Event('change'));
searchButton.click();
const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/pikachu'); // Fetch from proxy to simulate network delay
if (res.ok) {
await new Promise(resolve => setTimeout(resolve, 1000)); // Additional delay to allow UI to update
const sprite = document.getElementById('sprite');
assert.isTrue(sprite.src.endsWith('sprites/pokemon/25.png'));
}
} catch (err) {
throw new Error(err);
}
};
```
When the `#search-input` element contains the value `Pikachu` and the `#search-button` element is clicked, the `#types` element should contain a single inner element with the value `ELECTRIC`. Make sure the `#types` element content is cleared between searches.
```js
async () => {
try {
const searchInput = document.getElementById('search-input');
const searchButton = document.getElementById('search-button');
searchInput.value = 'Pikachu';
searchInput.dispatchEvent(new Event('change'));
searchButton.click();
const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/pikachu'); // Fetch from proxy to simulate network delay
if (res.ok) {
await new Promise(resolve => setTimeout(resolve, 1000)); // Additional delay to allow UI to update
const typesEl = document.getElementById('types');
assert.lengthOf(typesEl.children, 1);
assert.strictEqual(typesEl?.children[0]?.innerText.trim().toLowerCase(), 'electric');
}
} catch (err) {
throw new Error(err);
}
};
```
When the `#search-input` element contains the value `94` and the `#search-button` element is clicked, the values in the `#pokemon-name`, `#pokemon-id`, `#weight`, `#height`, `#hp`, `#attack`, `#defense`, `#special-attack`, `#special-defense`, and `#speed` elements should be `GENGAR`, `#94` or `94`, `Weight: 405` or `405`, `Height: 15` or `15`, `60`, `65`, `60`, `130`, `75`, and `110`, respectively.
```js
async () => {
try {
const searchInput = document.getElementById('search-input');
const searchButton = document.getElementById('search-button');
searchInput.value = '94';
searchInput.dispatchEvent(new Event('change'));
searchButton.click();
const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/94'); // Fetch from proxy to simulate network delay
if (res.ok) {
await new Promise(resolve => setTimeout(resolve, 1000)); // Additional delay to allow UI to update
const pokemonName = document.getElementById('pokemon-name');
const pokemonID = document.getElementById('pokemon-id');
const weight = document.getElementById('weight');
const height = document.getElementById('height');
const hp = document.getElementById('hp');
const attack = document.getElementById('attack');
const defense = document.getElementById('defense');
const specialAttack = document.getElementById('special-attack');
const specialDefense = document.getElementById('special-defense');
const speed = document.getElementById('speed');
assert.strictEqual(pokemonName.innerText.trim().toLowerCase(), 'gengar');
assert.include(['#94', '94'], pokemonID.innerText.trim());
assert.include(['weight: 405', '405'], weight.innerText.trim().toLowerCase());
assert.include(['height: 15', '15'], height.innerText.trim().toLowerCase());
assert.strictEqual(hp.innerText.trim(), '60');
assert.strictEqual(attack.innerText.trim(), '65');
assert.strictEqual(defense.innerText.trim(), '60');
assert.strictEqual(specialAttack.innerText.trim(), '130');
assert.strictEqual(specialDefense.innerText.trim(), '75');
assert.strictEqual(speed.innerText.trim(), '110');
}
} catch (err) {
throw new Error(err);
}
};
```
When the `#search-input` element contains the value `94` and the `#search-button` element is clicked, you should add an `img` element with the `id` of `"sprite"` and the `src` set to the Pokémon's `front_default` sprite to the page.
```js
async () => {
try {
const searchInput = document.getElementById('search-input');
const searchButton = document.getElementById('search-button');
searchInput.value = '94';
searchInput.dispatchEvent(new Event('change'));
searchButton.click();
const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/94'); // Fetch from proxy to simulate network delay
if (res.ok) {
await new Promise(resolve => setTimeout(resolve, 1000)); // Additional delay to allow UI to update
const sprite = document.getElementById('sprite');
assert.isTrue(sprite.src.endsWith('sprites/pokemon/94.png'));
}
} catch (err) {
throw new Error(err);
}
};
```
When the `#search-input` element contains the value `94` and the `#search-button` element is clicked, the `#types` element should contain two inner elements with the text values `GHOST` and `POISON`, respectively. Make sure the `#types` element content is cleared between searches.
```js
async () => {
try {
const searchInput = document.getElementById('search-input');
const searchButton = document.getElementById('search-button');
searchInput.value = '94';
searchInput.dispatchEvent(new Event('change'));
searchButton.click();
const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/94'); // Fetch from proxy to simulate network delay
if (res.ok) {
await new Promise(resolve => setTimeout(resolve, 1000)); // Additional delay to allow UI to update
const targetTypes = ['ghost', 'poison'];
const typesEl = document.getElementById('types');
assert.lengthOf(typesEl.children, 2);
assert.sameMembers(['ghost', 'poison'], [...typesEl.children].map(el => el.innerText.trim().toLowerCase()));
}
} catch (err) {
throw new Error(err);
}
};
```
When the `#search-input` element contains an invalid Pokemon name and the `#search-button` element is clicked, an alert should appear with the text `"Pokémon not found"`.
```js
async () => {
try {
const searchInput = document.getElementById('search-input');
const searchButton = document.getElementById('search-button');
let alertMessage;
window.alert = (message) => alertMessage = message; // Override alert and store message
const randomInvalidPokeId = crypto.randomUUID().substring(0, 6);
searchInput.value = randomInvalidPokeId;
searchInput.dispatchEvent(new Event('change'));
searchButton.click();
const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/' + randomInvalidPokeId); // Fetch from proxy to simulate network delay
if (!res.ok) {
await new Promise(resolve => setTimeout(resolve, 2000)); // Additional delay to allow the alert to trigger
assert.include(['pokémon not found', 'pokemon not found'], alertMessage.trim().replace(/[.,?!]+$/g, '').toLowerCase());
}
} catch (err) {
throw new Error(err);
}
};
```
When the `#search-input` element contains a valid Pokemon id and the `#search-button` element is clicked, the UI should be filled with the correct data.
```js
async () => {
try {
const searchInput = document.getElementById('search-input');
const searchButton = document.getElementById('search-button');
let alertMessage;
window.alert = (message) => alertMessage = message; // Override alert and store message
const randomValidPokeId = String(Math.floor(Math.random() * 1025) + 1);
searchInput.value = randomValidPokeId;
searchInput.dispatchEvent(new Event('change'));
searchButton.click();
const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/' + randomValidPokeId); // Fetch from proxy to simulate network delay
if (res.ok) {
await new Promise(resolve => setTimeout(resolve, 2000)); // Additional delay to allow UI to update
const data = await res.json();
const typesEl = document.getElementById('types');
const actualTypes = data.types.map(typeSlot => typeSlot.type.name);
assert.lengthOf(typesEl.children, actualTypes.length);
assert.sameMembers(actualTypes, [...typesEl.children].map(el => el.innerText.trim().toLowerCase()));
}
} catch (err) {
throw new Error(err);
}
};
```
# --seed--
## --seed-contents--
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pokémon Search App</title>
</head>
<body>
</body>
</html>
```
```css
```
```js
```
# --solutions--
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/png" href="https://cdn.freecodecamp.org/universal/favicons/favicon.ico" />
<title>Pokémon Search App</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<main>
<img class="freecodecamp-logo" src="https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg"
alt="freeCodeCamp Logo" />
<h1>Pokémon Search App</h1>
<div class="container">
<form role="search" id="search-form">
<label for="search-input">Search for Pokémon Name or ID:</label>
<input type="text" name="pokemon" id="search-input" required />
<button id="search-button">Search</button>
</form>
<div class="output">
<div class="top-container">
<div class="name-and-id">
<span id="pokemon-name"></span>
<span id="pokemon-id"></span>
</div>
<div class="size">
<span id="weight"></span>
<span id="height"></span>
</div>
<div id="sprite-container" class="sprite-container"></div>
<div id="types"></div>
</div>
<div class="bottom-container">
<table>
<tr>
<th>Base</th>
<th>Stats</th>
</tr>
<tr>
<td>HP:</td>
<td id="hp"></td>
</tr>
<tr>
<td>Attack:</td>
<td id="attack"></td>
</tr>
<tr>
<td>Defense:</td>
<td id="defense"></td>
</tr>
<tr>
<td>Sp. Attack:</td>
<td id="special-attack"></td>
</tr>
<tr>
<td>Sp. Defense:</td>
<td id="special-defense"></td>
</tr>
<tr>
<td>Speed:</td>
<td id="speed" class="speed"></td>
</tr>
</table>
</div>
</div>
</div>
<script src="./script.js"></script>
</main>
</body>
</html>
```
```css
/* CSS reset */
*,
*::before,
*::after {
box-sizing: border-box;
}
* {
margin: 0;
}
body {
line-height: 1.5;
}
img {
display: block;
}
/* Project styling */
body {
height: 100vh;
font-family: sans-serif;
background-color: #1b1b32;
color: #0a0a23;
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
main {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.freecodecamp-logo {
height: 30px;
margin: 25px 0;
}
h1 {
color: #f5f6f7;
font-size: 1.7em;
text-align: center;
}
.container {
width: 325px;
margin: 25px 0;
background-color: #f5f6f7;
border: 1px solid #f5f6f7;
border-radius: 15px;
box-shadow: 10px 10px 0px 0px rgba(223, 220, 220, 0.75);
}
.output,
#search-form {
display: flex;
justify-content: center;
}
#search-form {
flex-wrap: wrap;
margin: 10px 0;
padding: 5px;
border-radius: 8px 8px 0 0;
gap: 10px;
}
label {
align-self: center;
}
#search-input:focus-visible,
#search-button:focus-visible {
outline: 3px solid #198eee;
}
#search-input {
height: 40px;
padding-left: 10px;
width: 200px;
}
#search-button {
padding: 14px 0;
width: 80px;
border-radius: 20px;
text-align: center;
background-color: #7f21ab;
color: #f5f6f7;
border: none;
}
.output {
margin: 10px 0;
padding: 5px;
flex-direction: column;
align-items: center;
}
.top-container,
.bottom-container {
display: flex;
flex-direction: column;
width: 100%;
min-height: 325px;
}
.top-container {
margin-bottom: 10px;
padding: 10px;
background-color: #f0f1f7;
}
.name-and-id {
height: 28px;
font-size: 1.1em;
text-transform: capitalize;
margin-bottom: 5px;
}
.size {
height: 22px;
font-size: 0.85rem;
}
.sprite-container {
flex-grow: 2;
display: flex;
align-items: center;
justify-content: center;
}
#sprite {
width: 180px;
}
#types {
min-height: 30px;
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
gap: 5px;
}
.type {
width: 66px;
padding: 5px;
font-size: 0.7rem;
text-align: center;
border-radius: 5px;
background-color: red;
text-transform: uppercase;
}
table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
font-size: 1 rem;
color: #f5f6f7;
background-color: #7f21ab;
}
th:nth-child(even),
td:nth-child(even) {
border-left: 5px solid #f5f6f7;
}
tr {
border-bottom: 5px solid #f5f6f7;
}
td,
th {
text-align: center;
padding: 8px;
}
/* Special styling for Pokémon types */
.normal {
background-color: #b7b7aa;
}
.fire {
background-color: #ff6f52;
}
.water {
background-color: #42a1ff;
}
.electric {
background-color: #fecc33;
}
.grass {
background-color: #78cc55;
}
.ice {
background-color: #66ccfe;
}
.fighting {
background-color: #d3887e;
}
.poison {
background-color: #c68bb7;
}
.ground {
background-color: #dfba52;
}
.flying {
background-color: #8899ff;
}
.psychic {
background-color: #ff66a3;
}
.bug {
background-color: #aabb23;
}
.rock {
background-color: #baaa66;
}
.ghost {
background-color: #9995d0;
}
.dragon {
background-color: #9e93f1;
}
.dark {
background-color: #b59682;
}
.steel {
background-color: #abaabb;
}
.fairy {
background-color: #ed99ed;
}
@media screen and (min-width: 550px) {
h1 {
font-size: 2em;
}
.container {
width: 450px;
}
#search-form,
.top-container,
.bottom-container {
width: 95%;
}
.type {
width: 75px;
}
}
```
```js
const pokemonID = document.getElementById("pokemon-id");
const pokemonName = document.getElementById("pokemon-name");
const spriteContainer = document.getElementById("sprite-container");
const types = document.getElementById("types");
const height = document.getElementById("height");
const weight = document.getElementById("weight");
const hp = document.getElementById("hp");
const attack = document.getElementById("attack");
const defense = document.getElementById("defense");
const specialAttack = document.getElementById("special-attack");
const specialDefense = document.getElementById("special-defense");
const speed = document.getElementById("speed");
const searchForm = document.getElementById("search-form");
const searchInput = document.getElementById("search-input");
const getPokemon = async () => {
try {
const pokemonNameOrId = searchInput.value.toLowerCase();
const response = await fetch(
`https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/${pokemonNameOrId}`
);
const data = await response.json();
// Set Pokémon info
pokemonName.textContent = `${data.name.toUpperCase()}`;
pokemonID.textContent = `#${data.id}`;
weight.textContent = `Weight: ${data.weight}`;
height.textContent = `Height: ${data.height}`;
spriteContainer.innerHTML = `
<img id="sprite" src="${data.sprites.front_default}" alt="${data.name} front default sprite">
`;
// Set stats
hp.textContent = data.stats[0].base_stat;
attack.textContent = data.stats[1].base_stat;
defense.textContent = data.stats[2].base_stat;
specialAttack.textContent = data.stats[3].base_stat;
specialDefense.textContent = data.stats[4].base_stat;
speed.textContent = data.stats[5].base_stat;
// Set types
types.innerHTML = data.types
.map(
(obj) => `<span class="type ${obj.type.name}">${obj.type.name}</span>`
)
.join("");
} catch (err) {
resetDisplay();
alert("Pokémon not found");
console.log(`Pokémon not found: ${err}`);
}
};
const resetDisplay = () => {
const sprite = document.getElementById("sprite");
if (sprite) sprite.remove();
// reset stats
pokemonName.textContent = "";
pokemonID.textContent = "";
types.innerHTML = "";
height.textContent = "";
weight.textContent = "";
hp.textContent = "";
attack.textContent = "";
defense.textContent = "";
specialAttack.textContent = "";
specialDefense.textContent = "";
speed.textContent = "";
};
searchForm.addEventListener("submit", (e) => {
e.preventDefault();
getPokemon();
});
```

View File

@@ -1,142 +0,0 @@
---
id: 587d825a367417b2b2512c89
title: Build the Quicksort Algorithm
challengeType: 14
dashedName: build-the-quicksort-algorithm
---
# --description--
Quicksort is an algorithm that uses the divide and conquer approach to sort arrays.
It can be implemented as follows:
- Choose a pivot value among the elements of the input array (use the first or the last element of the array).
- Partition the input array into three subarrays containing elements greater than, lesser than, and equal to the pivot value.
- Recursively call `quicksort` to sort the subarrays.
Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. You should define a function named `quicksort` to implement the quicksort algorithm.
1. The `quicksort` function should take an array of integers as input and return an array of these integers in sorted order from least to greatest.
# --hints--
`quicksort` should be a function.
```js
assert.isFunction(quicksort);
```
`quicksort` should return a sorted array (least to greatest).
```js
function isSorted(a){
for(let i = 0; i < a.length - 1; i++)
if(a[i] > a[i + 1])
return false;
return true;
}
assert(
isSorted(
quicksort([
1,
4,
2,
8,
345,
123,
43,
32,
5643,
63,
123,
43,
2,
55,
1,
234,
92
])
)
);
```
`quicksort([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(
quicksort([
1,
4,
2,
8,
345,
123,
43,
32,
5643,
63,
123,
43,
2,
55,
1,
234,
92
]),
[1, 4, 2, 8, 345, 123, 43, 32, 5643, 63, 123, 43, 2, 55, 1, 234, 92]
);
```
`quicksort` should not use the built-in `.sort()` method.
```js
function isBuiltInSortUsed(){
let sortUsed = false;
const temp = Array.prototype.sort;
Array.prototype.sort = () => sortUsed = true;
quicksort([0, 1]);
Array.prototype.sort = temp;
return !sortUsed;
}
assert(isBuiltInSortUsed());
```
# --seed--
## --seed-contents--
```js
```
# --solutions--
```js
const quicksort = (array) => {
if (array.length === 0) {
return [];
}
const pivot = array[0];
let lesser = [];
let equal = [];
let greater = [];
for (let i of array) {
if (i < pivot) {
lesser.push(i);
} else if (i > pivot) {
greater.push(i);
} else {
equal.push(i);
}
}
return [...quicksort(lesser), ...equal, ...quicksort(greater)];
}
```

View File

@@ -1,483 +0,0 @@
---
id: 657bdc8ba322aae1eac38390
title: Build a Roman Numeral Converter
challengeType: 14
dashedName: build-a-roman-numeral-converter
demoType: onClick
---
# --description--
Roman numerals are based on seven symbols and can be written using various combinations to represent Arabic numerals. For example:
| Roman numerals | Arabic numerals |
|----------------|-----------------|
| M | 1000 |
| CM | 900 |
| D | 500 |
| CD | 400 |
| C | 100 |
| XC | 90 |
| L | 50 |
| XL | 40 |
| X | 10 |
| IX | 9 |
| V | 5 |
| IV | 4 |
| I | 1 |
Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. You should have an `input` element with an `id` of `"number"`.
1. You should have a `button` element with an `id` of `"convert-btn"`.
1. You should have a `div`, `span` or `p` element with an `id` of `output`.
1. When you click on the `#convert-btn` element without entering a value into the `#number` element, the `#output` element should contain the text `"Please enter a valid number"`.
1. When the `#number` element contains the number `-1` and the `#convert-btn` element is clicked, the `#output` element should contain the text `"Please enter a number greater than or equal to 1"`.
1. When the `#number` element contains the number `4000` or greater and the `#convert-btn` element is clicked, the `#output` element should contain the text `"Please enter a number less than or equal to 3999"`.
1. When the `#number` element contains the number `9` and the `#convert-btn` element is clicked, the `#output` element should contain the text `"IX"`.
1. When the `#number` element contains the number `16` and the `#convert-btn` element is clicked, the `#output` element should contain the text `"XVI"`.
1. When the `#number` element contains the number `649` and the `#convert-btn` element is clicked, the `#output` element should contain the text `"DCXLIX"`.
1. When the `#number` element contains the number `1023` and the `#convert-btn` element is clicked, the `#output` element should contain the text `"MXXIII"`.
1. When the `#number` element contains the number `3999` and the `#convert-btn` element is clicked, the `#output` element should contain the text `"MMMCMXCIX"`.
# --hints--
You should have an `input` element with an `id` of `"number"`.
```js
const el = document.getElementById('number');
assert.strictEqual(el?.nodeName?.toLowerCase(), 'input');
```
You should have a `button` element with an `id` of `"convert-btn"`.
```js
const el = document.getElementById('convert-btn');
assert.strictEqual(el?.nodeName?.toLowerCase(), 'button');
```
You should have a `div`, `span`, or `p` element with an `id` of `"output"`.
```js
const el = document.getElementById('output');
assert(['div', 'span', 'p'].includes(el?.nodeName?.toLowerCase()));
```
When you click on the `#convert-btn` element without entering a value into the `#number` element, the `#output` element should contain the text `"Please enter a valid number"`.
```js
const numberInputEl = document.getElementById('number');
const convertBtnEl = document.getElementById('convert-btn');
const outputEl = document.getElementById('output');
numberInputEl.value = '';
convertBtnEl.click();
assert.strictEqual(outputEl.innerText.trim().replace(/[.,?!]+$/g, '').toLowerCase(), 'please enter a valid number');
```
When the `#number` element contains the number `-1` and the `#convert-btn` element is clicked, the `#output` element should contain the text `"Please enter a number greater than or equal to 1"`.
```js
const numberInputEl = document.getElementById('number');
const convertBtnEl = document.getElementById('convert-btn');
const outputEl = document.getElementById('output');
numberInputEl.value = '-1';
numberInputEl.dispatchEvent(new Event('change'));
convertBtnEl.click();
assert.strictEqual(outputEl.innerText.trim().replace(/[.,?!]+$/g, '').toLowerCase(), 'please enter a number greater than or equal to 1');
```
When the `#number` element contains the number `4000` or greater and the `#convert-btn` element is clicked, the `#output` element should contain the text `"Please enter a number less than or equal to 3999"`.
```js
const numberInputEl = document.getElementById('number');
const convertBtnEl = document.getElementById('convert-btn');
const outputEl = document.getElementById('output');
numberInputEl.value = '4000';
numberInputEl.dispatchEvent(new Event('change'));
convertBtnEl.click();
assert.strictEqual(outputEl.innerText.trim().replace(/[.,?!]+$/g, '').toLowerCase(), 'please enter a number less than or equal to 3999');
```
When the `#number` element contains the number `9` and the `#convert-btn` element is clicked, the `#output` element should contain the text `"IX"`.
```js
const numberInputEl = document.getElementById('number');
const convertBtnEl = document.getElementById('convert-btn');
const outputEl = document.getElementById('output');
numberInputEl.value = '9';
numberInputEl.dispatchEvent(new Event('change'));
convertBtnEl.click();
assert.strictEqual(outputEl.innerText.trim(), 'IX');
```
When the `#number` element contains the number `16` and the `#convert-btn` element is clicked, the `#output` element should contain the text `"XVI"`.
```js
const numberInputEl = document.getElementById('number');
const convertBtnEl = document.getElementById('convert-btn');
const outputEl = document.getElementById('output');
numberInputEl.value = '16';
numberInputEl.dispatchEvent(new Event('change'));
convertBtnEl.click();
assert.strictEqual(outputEl.innerText.trim(), 'XVI');
```
When the `#number` element contains the number `649` and the `#convert-btn` element is clicked, the `#output` element should contain the text `"DCXLIX"`.
```js
const numberInputEl = document.getElementById('number');
const convertBtnEl = document.getElementById('convert-btn');
const outputEl = document.getElementById('output');
numberInputEl.value = '649';
numberInputEl.dispatchEvent(new Event('change'));
convertBtnEl.click();
assert.strictEqual(outputEl.innerText.trim(), 'DCXLIX');
```
When the `#number` element contains the number `1023` and the `#convert-btn` element is clicked, the `#output` element should contain the text `"MXXIII"`.
```js
const numberInputEl = document.getElementById('number');
const convertBtnEl = document.getElementById('convert-btn');
const outputEl = document.getElementById('output');
numberInputEl.value = '1023';
numberInputEl.dispatchEvent(new Event('change'));
convertBtnEl.click();
assert.strictEqual(outputEl.innerText.trim(), 'MXXIII');
```
When the `#number` element contains the number `3999` and the `#convert-btn` element is clicked, the `#output` element should contain the text `"MMMCMXCIX"`.
```js
const numberInputEl = document.getElementById('number');
const convertBtnEl = document.getElementById('convert-btn');
const outputEl = document.getElementById('output');
numberInputEl.value = '3999';
numberInputEl.dispatchEvent(new Event('change'));
convertBtnEl.click();
assert.strictEqual(outputEl.innerText.trim(), 'MMMCMXCIX');
```
When the `#number` element contains a random negative number and the `#convert-btn` element is clicked, the `#output` element should contain the text `"Please enter a number greater than or equal to 1"`.
```js
const numberInputEl = document.getElementById('number');
const convertBtnEl = document.getElementById('convert-btn');
const outputEl = document.getElementById('output');
const randomNegativeNumber = Math.floor(Math.random() * -4000) - 2;
numberInputEl.value = randomNegativeNumber;
numberInputEl.dispatchEvent(new Event('change'));
convertBtnEl.click();
assert.strictEqual(outputEl.innerText.trim().replace(/[.,?!]+$/g, '').toLowerCase(), 'please enter a number greater than or equal to 1');
```
When the `#number` element contains a number greater than 4000 and the `#convert-btn` element is clicked, the `#output` element should contain the text `"Please enter a number less than or equal to 3999"`.
```js
const numberInputEl = document.getElementById('number');
const convertBtnEl = document.getElementById('convert-btn');
const outputEl = document.getElementById('output');
const randomBigNumber = Math.floor(Math.random() * (1000000)) + 4000;
numberInputEl.value = randomBigNumber;
numberInputEl.dispatchEvent(new Event('change'));
convertBtnEl.click();
assert.strictEqual(outputEl.innerText.trim().replace(/[.,?!]+$/g, '').toLowerCase(), 'please enter a number less than or equal to 3999');
```
# --seed--
## --seed-contents--
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Roman Numeral Converter</title>
</head>
<body>
</body>
</html>
```
```css
```
```js
```
# --solutions--
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Castoro+Titling&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" type="text/css" href="styles.css" />
<link
rel="icon"
type="image/png"
href="https://cdn.freecodecamp.org/universal/favicons/favicon.ico"
/>
<title>Roman Numeral Converter</title>
</head>
<body>
<main>
<img
class="freecodecamp-logo"
src="https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg"
alt="freeCodeCamp Logo"
/>
<h1>Roman Numeral Converter</h1>
<form id="form" class="form">
<fieldset>
<label for="number">Enter a Number:</label><br />
<input type="number" id="number" required />
<button type="button" id="convert-btn">Convert</button>
</fieldset>
</form>
<div id="output" class="output hidden"></div>
</main>
<script src="script.js"></script>
</body>
</html>
```
```css
:root {
--gray-00: #ffffff;
--gray-05: #f5f6f7;
--gray-15: #d0d0d5;
--gray-75: #3b3b4f;
--gray-85: #1b1b32;
--gray-90: #0a0a23;
--blue-50: #198eee;
--error: #a94442;
--danger-color: #850000;
--danger-background: #ffadad;
}
*,
::before,
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
min-height: 100vh;
padding: 50px 20px;
font-family: 'Lato', Helvetica, Arial, sans-serif;
font-size: 18px;
background-color: var(--gray-85);
color: var(--gray-05);
}
main {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.freecodecamp-logo {
height: 30px;
margin-bottom: 20px;
}
h1 {
text-align: center;
margin: 20px auto;
max-width: 350px;
font-family: 'Castoro Titling', cursive;
}
form {
color: var(--gray-05);
margin: auto 25px;
padding: 15px auto;
border: 3px solid var(--gray-05);
text-align: center;
width: 90%;
max-width: 500px;
background-color: var(--gray-75);
}
fieldset {
border: 0 none;
height: 100%;
padding: 25px;
margin: 10px 20px;
}
label {
display: inline-block;
font-size: 1.5rem;
margin-bottom: 10px;
font-weight: bold;
}
input:focus-visible,
button:focus-visible {
outline: 3px solid var(--blue-50);
}
input {
display: block;
font-size: 2.5rem;
width: 100%;
height: 60px;
padding: 6px 12px;
margin: 10px 0;
line-height: 1.4;
color: white;
background-color: var(--gray-90);
border: 1px solid var(--gray-05);
}
button {
cursor: pointer;
margin-top: 15px;
text-decoration: none;
background-image: linear-gradient(#fecc4c, #ffac33);
border: 3px solid #feac32;
padding: 10px 16px;
font-size: 23px;
width: 100%;
}
.output {
color: white;
background-color: var(--gray-75);
border: 3px solid var(--gray-05);
font-size: 2.5rem;
width: 90%;
max-width: 500px;
min-height: 55px;
margin-top: 25px;
padding: 15px;
overflow-wrap: break-word;
text-align: center;
}
.alert {
font-size: 2rem;
background-color: var(--danger-background);
border: 3px solid var(--danger-color);
color: var(--danger-color);
}
.hidden {
display: none;
}
```
```js
const form = document.getElementById("form");
const convertButton = document.getElementById("convert-btn");
const output = document.getElementById("output");
const convertToRoman = (num) => {
const ref = [
["M", 1000],
["CM", 900],
["D", 500],
["CD", 400],
["C", 100],
["XC", 90],
["L", 50],
["XL", 40],
["X", 10],
["IX", 9],
["V", 5],
["IV", 4],
["I", 1],
];
const res = [];
ref.forEach(function (arr) {
while (num >= arr[1]) {
res.push(arr[0]);
num -= arr[1];
}
});
return res.join("");
};
const isValid = (str, int) => {
let errText = "";
if (!str || str.match(/[e.]/g)) {
errText = "Please enter a valid number.";
} else if (int < 1) {
errText = "Please enter a number greater than or equal to 1.";
} else if (int > 3999) {
errText = "Please enter a number less than or equal to 3999.";
} else {
// No errors detected
return true;
}
// Handle error text and output styling
output.innerText = errText;
output.classList.add("alert");
return false;
};
const clearOutput = () => {
output.innerText = "";
output.classList.remove("alert");
};
form.addEventListener("submit", (e) => {
e.preventDefault();
updateUI();
});
convertButton.addEventListener("click", () => {
updateUI();
});
const updateUI = () => {
const numStr = document.getElementById("number").value;
const int = parseInt(numStr, 10);
output.classList.remove("hidden");
clearOutput();
if (isValid(numStr, int)) {
output.innerText = convertToRoman(int);
}
};
```

View File

@@ -1,165 +0,0 @@
---
id: 587d8250367417b2b2512c5f
title: Build a Stack Class
challengeType: 14
dashedName: build-a-stack-class
---
# --description--
A stack is a data structure that stores an ordered collection of elements. It follows the *Last-In-First-Out* principle, where the last element inserted is removed first.
Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. You should define a `Stack` class that has a `collection` property initialized to an empty array. You'll use this array to mimic a stack.
1. The `Stack` class should have a `push` method that adds an item to the top of the stack.
1. The `Stack` class should have a `pop` method that removes and returns the element on the top of the stack.
1. The `Stack` class should have a `peek` method that returns the element on the top of the stack.
1. The `Stack` class should have an `isEmpty` method that returns `true` if the stack is empty, and `false` otherwise.
1. The `Stack` class should have a `clear` method that empties the stack.
# --hints--
Your `Stack` class should have a `collection` property initialized to an empty array.
```js
const test = new Stack();
assert.isArray(test.collection);
assert.lengthOf(test.collection, 0);
```
Your `Stack` class should have a `push` method.
```js
const test = new Stack();
assert.isFunction(test.push);
```
The `push` method should add an element to the end of the `collection` array.
```js
const test = new Stack();
test.push('CS61');
assert.lengthOf(test.collection, 1);
assert.strictEqual(test.collection[0], 'CS61');
test.push('CS50');
assert.lengthOf(test.collection, 2);
assert.strictEqual(test.collection[0], 'CS61');
assert.strictEqual(test.collection[1], 'CS50');
```
Your `Stack` class should have a `pop` method.
```js
const test = new Stack();
assert.isFunction(test.pop);
```
Your `Stack` class should have a `peek` method.
```js
const test = new Stack();
assert.isFunction(test.peek);
```
Your `Stack` class should have an `isEmpty` method.
```js
const test = new Stack();
assert.isFunction(test.isEmpty);
```
Your `Stack` class should have a `clear` method.
```js
const test = new Stack();
assert.isFunction(test.clear);
```
The `peek` method should return the top element of the stack.
```js
const test = new Stack();
test.push('CS61');
test.push('CS50');
assert.strictEqual(test.peek(), 'CS50');
assert.strictEqual(test.peek(), 'CS50');
```
The `pop` method should remove and return the top element of the stack.
```js
const test = new Stack();
test.push('CS61');
test.push('CS50');
assert.strictEqual(test.pop(), 'CS50');
assert.lengthOf(test.collection, 1);
assert.strictEqual(test.collection[0], 'CS61');
assert.strictEqual(test.pop(), 'CS61');
assert.lengthOf(test.collection, 0);
```
The `isEmpty` method should return `true` if the stack does not contain any elements.
```js
const test = new Stack();
assert.isTrue(test.isEmpty());
```
The `isEmpty` method should return `false` if the stack contains elements.
```js
const test = new Stack();
test.push('CS61');
assert.isFalse(test.isEmpty());
```
The `clear` method should remove all element from the stack
```js
const test = new Stack();
test.push('CS61');
test.push('CS50');
test.clear();
assert.isTrue(test.isEmpty());
```
# --seed--
## --seed-contents--
```js
```
# --solutions--
```js
class Stack {
constructor() {
this.collection = [];
}
push = function (item) {
this.collection.push(item);
}
pop = function () {
return this.collection.pop();
}
peek = function () {
return this.collection[this.collection.length - 1];
}
isEmpty = function () {
return this.collection.length === 0;
}
clear = function () {
this.collection.length = 0;
}
}
```

View File

@@ -1,752 +0,0 @@
---
id: 657bdcb9a322aae1eac38391
title: Build a Telephone Number Validator
challengeType: 14
dashedName: lab-telephone-number-validator
demoType: onClick
---
# --description--
In the US, phone numbers can be formatted in many ways. Here are some examples of valid formats for US phone numbers:
<blockquote>
1 555-555-5555<br>
1 (555) 555-5555<br>
1(555)555-5555<br>
1 555 555 5555<br>
5555555555<br>
555-555-5555<br>
(555)555-5555<br>
</blockquote>
Note that the area code is required. Also, if the country code is provided, you must confirm that the country code is `1`.
Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. You should have an `input` element with an `id` of `"user-input"`.
1. You should have a `button` element with an `id` of `"check-btn"`.
1. You should have a `button` element with an `id` of `"clear-btn"`.
1. You should have a `div`, `span` or `p` element with an `id` of `"results-div"`.
1. When you click on the `#check-btn` element without entering a value into the `#user-input` element, an alert should appear with the text `"Please provide a phone number"`.
1. When you click on the `#clear-btn` element, the content within the `#results-div` element should be removed.
1. When the `#user-input` element contains `1 555-555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 1 555-555-5555"`.
1. When the `#user-input` element contains `1 (555) 555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 1 (555) 555-5555"`.
1. When the `#user-input` element contains `5555555555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 5555555555"`.
1. When the `#user-input` element contains `555-555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 555-555-5555"`.
1. When the `#user-input` element contains `(555)555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: (555)555-5555"`.
1. When the `#user-input` element contains `1(555)555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 1(555)555-5555"`.
1. When the `#user-input` element contains `555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 555-5555"`.
1. When the `#user-input` element contains `5555555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 5555555"`.
1. When the `#user-input` element contains `1 555)555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 1 555)555-5555"`.
1. When the `#user-input` element contains `1 555 555 5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 1 555 555 5555"`.
1. When the `#user-input` element contains `1 456 789 4444` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 1 456 789 4444"`.
1. When `#user-input` contains `123**&!!asdf#` and `#check-btn` is clicked, `#results-div` should contain the text `"Invalid US number: 123**&!!asdf#"`.
1. When the `#user-input` element contains `55555555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 55555555"`.
1. When the `#user-input` element contains `(6054756961)` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: (6054756961)"`.
1. When the `#user-input` element contains `2 (757) 622-7382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 2 (757) 622-7382"`.
1. When the `#user-input` element contains `0 (757) 622-7382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 0 (757) 622-7382"`.
1. When the `#user-input` element contains `-1 (757) 622-7382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: -1 (757) 622-7382"`.
1. When the `#user-input` element contains `2 757 622-7382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 2 757 622-7382"`.
1. When the `#user-input` element contains `10 (757) 622-7382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 10 (757) 622-7382"`.
1. When the `#user-input` element contains `27576227382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 27576227382"`.
1. When the `#user-input` element contains `(275)76227382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: (275)76227382"`.
1. When the `#user-input` element contains `2(757)6227382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 2(757)6227382"`.
1. When the `#user-input` element contains `2(757)622-7382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 2(757)622-7382"`.
1. When the `#user-input` element contains `555)-555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 555)-555-5555"`.
1. When the `#user-input` element contains `(555-555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: (555-555-5555"`.
1. When `#user-input` contains `(555)5(55?)-5555` and `#check-btn` is clicked, `#results-div` should contain the text `"Invalid US number: (555)5(55?)-5555"`.
1. When the `#user-input` element contains `55 55-55-555-5` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 55 55-55-555-5"`.
1. When the `#user-input` element contains `11 555-555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 11 555-555-5555"`.
# --hints--
You should have an `input` element with an `id` of `"user-input"`.
```js
const el = document.getElementById('user-input');
assert.strictEqual(el?.nodeName?.toLowerCase(), 'input');
```
You should have a `button` element with an `id` of `"check-btn"`.
```js
const el = document.getElementById('check-btn');
assert.strictEqual(el?.nodeName?.toLowerCase(), 'button');
```
You should have a `button` element with an `id` of `"clear-btn"`.
```js
const el = document.getElementById('clear-btn');
assert.strictEqual(el?.nodeName?.toLowerCase(), 'button');
```
You should have a `div`, `span`, or `p` element with an `id` of `"results-div"`.
```js
const el = document.getElementById('results-div');
assert(['div', 'span', 'p'].includes(el?.nodeName?.toLowerCase()));
```
When you click on the `#check-btn` element without entering a value into the `#user-input` element, an alert should appear with the text `"Please provide a phone number"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
let alertMessage;
window.alert = (message) => alertMessage = message; // Override alert and store message
userInput.value = '';
checkBtn.click();
assert.strictEqual(alertMessage.trim().replace(/[.,?!]+$/g, '').toLowerCase(), 'please provide a phone number');
```
When you click on the `#clear-btn` element, the content within the `#results-div` element should be removed.
```js
const resultsDiv = document.getElementById('results-div');
const clearBtn = document.getElementById('clear-btn');
resultsDiv.innerHTML = `Testing testing 123
Ladies and gentlemen, we are floating in space.`;
clearBtn.click();
assert.isEmpty(resultsDiv.textContent);
```
When the `#user-input` element contains `1 555-555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 1 555-555-5555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '1 555-555-5555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'valid us number: 1 555-555-5555');
```
When the `#user-input` element contains `1 (555) 555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 1 (555) 555-5555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '1 (555) 555-5555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'valid us number: 1 (555) 555-5555');
```
When the `#user-input` element contains `5555555555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 5555555555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '5555555555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'valid us number: 5555555555');
```
When the `#user-input` element contains `555-555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 555-555-5555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '555-555-5555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'valid us number: 555-555-5555');
```
When the `#user-input` element contains `(555)555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: (555)555-5555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '(555)555-5555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'valid us number: (555)555-5555');
```
When the `#user-input` element contains `1(555)555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 1(555)555-5555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '1(555)555-5555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'valid us number: 1(555)555-5555');
```
When the `#user-input` element contains `555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 555-5555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '555-5555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 555-5555');
```
When the `#user-input` element contains `5555555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 5555555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '5555555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 5555555');
```
When the `#user-input` element contains `1 555)555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 1 555)555-5555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '1 555)555-5555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 1 555)555-5555');
```
When the `#user-input` element contains `1 555 555 5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 1 555 555 5555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '1 555 555 5555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'valid us number: 1 555 555 5555');
```
When the `#user-input` element contains `1 456 789 4444` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Valid US number: 1 456 789 4444"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '1 456 789 4444';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'valid us number: 1 456 789 4444');
```
When `#user-input` contains `123**&!!asdf#` and `#check-btn` is clicked, `#results-div` should contain the text `"Invalid US number: 123**&!!asdf#"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '123**&!!asdf#';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 123**&!!asdf#');
```
When the `#user-input` element contains `55555555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 55555555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '55555555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 55555555');
```
When the `#user-input` element contains `(6054756961)` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: (6054756961)"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '(6054756961)';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: (6054756961)');
```
When the `#user-input` element contains `2 (757) 622-7382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 2 (757) 622-7382"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '2 (757) 622-7382';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 2 (757) 622-7382');
```
When the `#user-input` element contains `0 (757) 622-7382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 0 (757) 622-7382"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '0 (757) 622-7382';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 0 (757) 622-7382');
```
When the `#user-input` element contains `-1 (757) 622-7382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: -1 (757) 622-7382"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '-1 (757) 622-7382';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: -1 (757) 622-7382');
```
When the `#user-input` element contains `2 757 622-7382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 2 757 622-7382"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '2 757 622-7382';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 2 757 622-7382');
```
When the `#user-input` element contains `10 (757) 622-7382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 10 (757) 622-7382"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '10 (757) 622-7382';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 10 (757) 622-7382');
```
When the `#user-input` element contains `27576227382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 27576227382"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '27576227382';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 27576227382');
```
When the `#user-input` element contains `(275)76227382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: (275)76227382"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '(275)76227382';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: (275)76227382');
```
When the `#user-input` element contains `2(757)6227382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 2(757)6227382"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '2(757)6227382';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 2(757)6227382');
```
When the `#user-input` element contains `2(757)622-7382` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 2(757)622-7382"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '2(757)622-7382';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 2(757)622-7382');
```
When the `#user-input` element contains `555)-555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 555)-555-5555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '555)-555-5555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 555)-555-5555');
```
When the `#user-input` element contains `(555-555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: (555-555-5555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '(555-555-5555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: (555-555-5555');
```
When `#user-input` contains `(555)5(55?)-5555` and `#check-btn` is clicked, `#results-div` should contain the text `"Invalid US number: (555)5(55?)-5555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '(555)5(55?)-5555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: (555)5(55?)-5555');
```
When the `#user-input` element contains `55 55-55-555-5` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 55 55-55-555-5"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '55 55-55-555-5';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 55 55-55-555-5');
```
When the `#user-input` element contains `11 555-555-5555` and the `#check-btn` element is clicked, the `#results-div` element should contain the text `"Invalid US number: 11 555-555-5555"`.
```js
const userInput = document.getElementById('user-input');
const checkBtn = document.getElementById('check-btn');
const resultsDiv = document.getElementById('results-div');
resultsDiv.innerHTML = '';
userInput.value = '11 555-555-5555';
userInput.dispatchEvent(new Event('change'));
checkBtn.click();
assert.strictEqual(resultsDiv.innerText.trim().toLowerCase(), 'invalid us number: 11 555-555-5555');
```
# --seed--
## --seed-contents--
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Telephone Number Validator</title>
</head>
<body>
</body>
</html>
```
```css
```
```js
```
# --solutions--
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="icon"
type="image/png"
href="https://cdn.freecodecamp.org/universal/favicons/favicon.ico"
/>
<title>Telephone Number Validator</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<main>
<img
class="freecodecamp-logo"
src="https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg"
alt="freeCodeCamp Logo"
/>
<h1>Telephone Number Validator</h1>
<div class="phone-container">
<div class="phone-background">
<div class="phone-camera"></div>
</div>
<label for="user-input">Enter a Phone Number:</label>
<input maxlength="20" type="text" id="user-input" value="" />
<div id="results-div"></div>
<div class="phone-footer">
<button class="btn-styles" id="check-btn">Check</button>
<button class="btn-styles" id="clear-btn">Clear</button>
</div>
</div>
</main>
<script src="script.js"></script>
</body>
</html>
```
```css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--phone-colors: #dfdfe2;
--center-text: center;
--gray-00: #fff;
}
body {
background-color: #3b3b4f;
font-family: Verdana, Geneva, Tahoma, sans-serif;
color: #0a0a23;
}
main {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
flex-direction: column;
padding: 40px 10px;
}
.freecodecamp-logo {
width: 100%;
height: 30px;
margin-bottom: 20px;
}
h1 {
color: white;
width: 100%;
max-width: 480px;
margin: 15px 0;
text-align: var(--center-text);
}
.phone-container {
position: relative;
background-color: var(--phone-colors);
width: 250px;
height: 460px;
margin: 30px auto;
border-radius: 15px;
border: 15px solid black;
display: flex;
flex-direction: column;
align-items: center;
}
.phone-background {
background-color: black;
width: 100%;
height: 25px;
}
.phone-camera {
background-color: var(--phone-colors);
width: 10px;
height: 10px;
border-radius: 50%;
margin: auto;
}
label {
margin: 10px auto 5px;
}
#user-input {
display: block;
margin: 10px auto;
padding: 5px;
border: 1px solid black;
border-radius: 10px;
text-align: var(--center-text);
width: 90%;
height: 42px;
font-size: 16px;
}
.phone-footer {
background-color: black;
width: 100%;
height: 40px;
position: absolute;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
}
.btn-styles {
cursor: pointer;
width: 100px;
margin: 10px;
color: #0a0a23;
font-size: 18px;
background-color: #ffffff;
background-image: linear-gradient(#ffffff, #928d86);
border-color: #ffffff;
border-width: 3px;
}
#results-div {
overflow-y: auto;
height: 265px;
width: 100%;
}
.results-text {
font-size: 1.2rem;
padding: 5px;
text-align: var(--center-text);
margin: 10px 0;
}
```
```js
const userInput = document.getElementById("user-input");
const checkBtn = document.getElementById("check-btn");
const clearBtn = document.getElementById("clear-btn");
const resultsDiv = document.getElementById("results-div");
const checkValidNumber = (input) => {
if (input === "") {
alert("Please provide a phone number");
return;
}
const countryCode = "^(1\\s?)?";
const areaCode = "(\\([0-9]{3}\\)|[0-9]{3})";
const spacesDashes = "[\\s\\-]?";
const phoneNumber = "[0-9]{3}[\\s\\-]?[0-9]{4}$";
const phoneRegex = new RegExp(
`${countryCode}${areaCode}${spacesDashes}${phoneNumber}`,
);
const pTag = document.createElement("p");
pTag.className = "results-text";
phoneRegex.test(input)
? (pTag.style.color = "#00471b")
: (pTag.style.color = "#4d3800");
pTag.appendChild(
document.createTextNode(
`${phoneRegex.test(input) ? "Valid" : "Invalid"} US number: ${input}`,
),
);
resultsDiv.appendChild(pTag);
};
checkBtn.addEventListener("click", () => {
checkValidNumber(userInput.value);
userInput.value = "";
});
userInput.addEventListener("keydown", (e) => {
if (e.key === "Enter") {
checkValidNumber(userInput.value);
userInput.value = "";
}
});
clearBtn.addEventListener("click", () => {
resultsDiv.textContent = "";
});
```

View File

@@ -1,455 +0,0 @@
---
id: 66edd5ffe490bef99ea99395
title: Dynamic Programming Quiz
challengeType: 8
dashedName: quiz-dynamic-programming
---
# --description--
To pass the quiz, you must correctly answer at least 17 of the 20 of the questions below.
# --quizzes--
## --quiz--
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer

View File

@@ -1,455 +0,0 @@
---
id: 66edd5c8ac5314f8e80a3fc0
title: Graphs and Trees Quiz
challengeType: 8
dashedName: quiz-graphs-and-trees
---
# --description--
To pass the quiz, you must correctly answer at least 17 of the 20 of the questions below.
# --quizzes--
## --quiz--
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer
### --question--
#### --text--
Placeholder question
#### --distractors--
Placeholder distractor 1
---
Placeholder distractor 2
---
Placeholder distractor 3
#### --answer--
Placeholder answer

View File

@@ -1,455 +0,0 @@
---
id: 66edd5583761e4f6dae19606
title: JavaScript Data Structures Quiz
challengeType: 8
dashedName: quiz-javascript-data-structures
---
# --description--
To pass the quiz, you must correctly answer at least 17 of the 20 of the questions below.
# --quizzes--
## --quiz--
### --question--
#### --text--
Which of the following operations is not performed on a stack?
#### --distractors--
Push
---
Pop
---
Peek
#### --answer--
Enqueue
### --question--
#### --text--
What happens to the time complexity of appending an element to a dynamic array when it is resized due to capacity limits?
#### --distractors--
Stays O(1)
---
Stays O(n)
---
Changes to O(log n) when resizing occurs
#### --answer--
Changes to O(n) when resizing occurs
### --question--
#### --text--
Which of the following is a property of a binary min-heap?
#### --distractors--
Tree is always balanced
---
Root contains the largest element
---
Elements are sorted in ascending order
#### --answer--
Root contains the smallest element
### --question--
#### --text--
Choose the correct statement about hash collisions in a hash map?
#### --distractors--
They are resolved using sorting
---
They are impossible to occur
---
They can crash the program
#### --answer--
They are resolved using linked lists (chaining method) or open addressing
### --question--
#### --text--
What is the time complexity of inserting a node at the end of a singly linked list?
#### --distractors--
O(1)
---
O(log n)
---
O(n log n)
#### --answer--
O(n)
### --question--
#### --text--
What is the time complexity of accessing an element in a hash map in the average case?
#### --distractors--
O(n)
---
O(n log n)
---
O(log n)
#### --answer--
O(1)
### --question--
#### --text--
Which of the following is used to implement a priority queue?
#### --distractors--
Stack
---
Queue
---
Linked List
#### --answer--
Heap
### --question--
#### --text--
In a doubly linked list, what does each node contain?
#### --distractors--
Data and only a pointer to the previous node
---
Data and a pointer to the next node
---
Data only
#### --answer--
Data and two pointers (next and previous nodes)
### --question--
#### --text--
The value of each node in a max-heap is:
#### --distractors--
Equal to its children
---
Unrelated to the value of its children
---
Less than or equal to the value of its children
#### --answer--
Greater than or equal to the value of its children
### --question--
#### --text--
Which of the following is true for a singly linked list?
#### --distractors--
It allows traversal in both directions
---
Each node has two pointers
---
The list is circular by default
#### --answer--
Each node contains data and a pointer to the next node
### --question--
#### --text--
What is the primary benefit of using a hash set over an array?
#### --distractors--
Reduced memory usage
---
Random access to elements
---
Maintaining order of elements
#### --answer--
Faster insertion and search times due to hash function
### --question--
#### --text--
Which operation is faster in a doubly linked list compared to a singly linked list?
#### --distractors--
Searching for an element
---
Reversing the list
---
Insertion at the end
#### --answer--
Deleting a node when a reference to that node is provided
### --question--
#### --text--
What is the main difference between a queue and a stack?
#### --distractors--
Stack allows random access while queue does not
---
Queue follows "Last in, first out" (LIFO) and stack follows "First in, first out" (FIFO)
---
Both follow the same order of operations
#### --answer--
Stack follows "Last in, first out" (LIFO) and queue follows "First in, first out" (FIFO)
### --question--
#### --text--
What is the time complexity of accessing an element in a static array?
#### --distractors--
O(log n)
---
O(n log n)
---
O(n)
#### --answer--
O(1)
### --question--
#### --text--
What is the order of insertion and deletion in a stack?
#### --distractors--
Random access
---
First in, last out (FILO)
---
First in, first out (FIFO)
#### --answer--
Last in, first out (LIFO)
### --question--
#### --text--
A set data structure:
#### --distractors--
Guarantees sorted order
---
Allows duplicate elements
---
Allows access by index
#### --answer--
Does not allow duplicate elements
### --question--
#### --text--
What differentiates a dynamic array from a static array?
#### --distractors--
Dynamic arrays require less memory than Static Arrays
---
Static arrays are always slower
---
Static arrays are only used in Java
#### --answer--
Dynamic arrays can grow whereas static arrays have fixed size
### --question--
#### --text--
What is the time complexity of inserting an element in a binary heap?
#### --distractors--
O(1)
---
O(n)
---
O(n log n)
#### --answer--
O(log n)
### --question--
#### --text--
In a circular queue, if rear == front, what does it indicate?
#### --distractors--
Queue is at capacity
---
Queue is full
---
Queue is undefined
#### --answer--
Queue is empty
### --question--
#### --text--
Which of the following is a disadvantage of static arrays?
#### --distractors--
Expensive insertion
---
Expensive access time
---
Unsorted Elements
#### --answer--
Fixed Size

View File

@@ -1,471 +0,0 @@
---
id: 66edd5267b52f8f617d8364f
title: JavaScript Object Oriented Programming Quiz
challengeType: 8
dashedName: quiz-javascript-object-oriented-programming
---
# --description--
To pass the quiz, you must correctly answer at least 17 of the 20 of the questions below.
# --quizzes--
## --quiz--
### --question--
#### --text--
From the statements below, which one correctly defines OOP?
#### --distractors--
It is a programming model that is more concerned with functions.
---
It is a programming model that is focused on the logic of the program.
---
It is a programming model that applies to all programming problems to solve challenges.
#### --answer--
It is a programming model concerned with data.
### --question--
#### --text--
The following are advantages of OOP except ONE, which one?
#### --distractors--
Achieves security.
---
Enhances code reusability.
---
It makes a program flexible.
#### --answer--
It makes multi-threading easier.
### --question--
#### --text--
Which of the following statements is true for OOP?
#### --distractors--
Multiple instances of objects cannot exist.
---
OOP can be applied in all cases.
---
Procedural programs are more secure than OOP programs.
#### --answer--
Private members are meant to achieve encapsulation.
### --question--
#### --text--
The following are concepts of OOP except ONE. Which one?
#### --distractors--
Polymorphism.
---
Encapsulation.
---
Inheritance.
#### --answer--
Data destruction.
### --question--
#### --text--
Which statement is FALSE for OOP in Javascript language?
#### --distractors--
Classes are absent in traditional Javascript language.
---
Objects inherit from other objects.
---
Constructors initialize objects.
#### --answer--
Methods can be public, or protected.
### --question--
#### --text--
From the statements below, which one is FALSE about an object?
#### --distractors--
It is also called an instance.
---
Models a real-world.
---
It can be broken down into properties and methods.
#### --answer--
Objects have to be unique.
### --question--
#### --text--
```js
function Person(age, gender) {
this.age = age;
this.gender = gender;
}
```
What is `this` used for in the code above ?
#### --distractors--
It is used to emphasize an object.
---
It is used to achieve inheritance.
---
It is used to achieve polymorphism.
#### --answer--
It refers to the newly created instance of an object.
### --question--
#### --text--
Which concept of OOP is achieved by using the 'extends' keyword?
#### --distractors--
Abstraction.
---
Aggregation.
---
Metamorphism.
#### --answer--
Inheritance.
### --question--
#### --text--
Which of the following is NOT an advantage of encapsulation?
#### --distractors--
Integrity.
---
Security.
---
Maintainability.
#### --answer--
Efficiency.
### --question--
#### --text--
From the statements below, which one differentiates encapsulation from data abstraction?
#### --distractors--
Data abstraction binds data while encapsulation removes unnecessary detail.
---
Data abstraction subtracts additional data while encapsulation exposes data.
---
Data abstraction exposes data while encapsulation binds data.
#### --answer--
Data abstraction removes unnecessary details while encapsulation binds data.
### --question--
#### --text--
Which keyword is used to create a new instance of an object in JavaScript?
#### --distractors--
This.
---
Class.
---
Function.
#### --answer--
New.
### --question--
#### --text--
Which of the following is TRUE?
#### --distractors--
Code reusability is achieved by polymorphism.
---
OOP in Javascript is different from other programming languages.
---
Objects contain methods and properties.
#### --answer--
All of the options are true.
### --question--
#### --text--
What is the purpose of a constructor function in JavaScript?
#### --distractors--
To extend object properties.
---
To encapsulate methods.
---
To create classes.
#### --answer--
To instantiate objects.
### --question--
#### --text--
Which one of the following is TRUE about classes?
#### --distractors--
A class contains objects with similar properties and methods.
---
Objects are instances of classes.
---
Different classes can have similar methods.
#### --answer--
All of the options are true.
### --question--
#### --text--
What instantiates a class?
#### --distractors--
Object.
---
Keywords.
---
Variables.
#### --answer--
Constructor.
### --question--
#### --text--
```js
class Course {
#module;
constructor(module) {
this.#module = module;
}
}
```
Which access modifier is added to `#module` above?
#### --distractors--
Public.
---
Personal.
---
Global.
#### --answer--
Private.
### --question--
#### --text--
The keyword `super` is used to call the properties and methods of which class?
#### --distractors--
Child.
---
Private.
---
Personal.
#### --answer--
Parent.
### --question--
#### --text--
Which of the following is true about private members?
#### --distractors--
It can be accessed from outside of the class.
---
It can be called at any point in the program.
---
It enhances security.
#### --answer--
None of the above.
### --question--
#### --text--
which of the following is FALSE in OOP?
#### --distractors--
Polymorphism changes the characteristics.
---
Inheritance gets the characteristics from a base class.
---
Both inheritance and polymorphism can be used to reduce redundancy in the code.
#### --answer--
Private members can be inherited outside the class.
### --question--
#### --text--
Which of the following is FALSE about encapsulation?
#### --distractors--
It restricts access to members.
---
It binds data.
---
It binds methods.
#### --answer--
Encapsulation is the way in which the same method is applied to different objects and the methods respond with different outputs.

View File

@@ -1,455 +0,0 @@
---
id: 66edd4bc0ce399f475ad6f9b
title: JavaScript Problem Solving and Algorithmic Thinking Quiz
challengeType: 8
dashedName: quiz-javascript-problem-solving-and-algorithmic-thinking
---
# --description--
To pass the quiz, you must correctly answer at least 17 of the 20 of the questions below.
# --quizzes--
## --quiz--
### --question--
#### --text--
The Fibonacci sequence is a series where each number is the sum of the two preceding ones, starting with `0` and `1`. The sequence goes: `0, 1, 1, 2, 3, 5, 8, 13, 21...` and so on. What is the best approach to calculate `nth` number in the sequence?
#### --distractors--
Use the formula `fib(n) = fib(n-1) * fib(n-2)`.
---
Use recursion with memoization to avoid recalculating subproblems where `fib(n) = (n-1) + (n-2)`.
---
Use a for loop to calculate iteratively where `fib(n) = fib(n-1) + (n-2)`.
#### --answer--
Use recursion with memoization to avoid recalculating subproblems where `fib(n) = fib(n-1) + fib(n-2)`.
### --question--
#### --text--
A binary string, such as `"1011"`, represents a number in base-2, where each digit corresponds to a power of `2`. What process can be used to convert this binary string into its decimal equivalent?
#### --distractors--
Use the `parseInt()` function with base `10`.
---
Convert the string to an array, then sum the digits using bitwise operations.
---
Use the `Number()` function directly with a binary string.
#### --answer--
Multiply each character by powers of `2` and sum them up.
### --question--
#### --text--
Which of the following algorithm will move all zeroes in an array to the end while keeping the order of other elements unchanged? For example, given `[0, 1, 0, 3, 12]`, return `[1, 3, 12, 0, 0]`.
#### --distractors--
Sort the array in decreasing order and place zeros at the start.
---
Sort the array in ascending order.
---
Use recursion to remove all zeros and add them to the front.
#### --answer--
Use a two-pointer technique to swap non-zero elements with zero elements.
### --question--
#### --text--
Given a sentence, such as `"I am a frontend engineer"`, what approach can be taken to reverse the order of the words, producing the output `"engineer frontend a am I"`?
#### --distractors--
Split the string into words using `split(" ")`, reverse the array, and join it back into a string using `join("_")`.
---
Sort the words alphabetically and return the result.
---
Use regular expressions to reverse each word.
#### --answer--
Split the string into words using `split(" ")`, reverse the array, and join it back into a string using `join(" ")`.
### --question--
#### --text--
Given a string, what approach would be used to find the first non-repeating character? For example, in the string `"codecamp"`, it would be `'o'`.
#### --distractors--
Sort the string and check for consecutive duplicates.
---
Convert the string to an array, then filter for unique elements.
---
Use a regular expression to find the first non-repeat.
#### --answer--
Iterate over the string twice, once to count number of occurrences and once to find the first unique character.
### --question--
#### --text--
What approach can be used to encode a string by counting consecutive repeated characters? For example, given the input` "mississippi"`, the output should be `"m1i1s2i1s2i1p2i1"`.
#### --distractors--
Use regular expressions to match repeated characters.
---
Use `map()` to map consecutive characters to the output.
---
Sort the string and count occurrences.
#### --answer--
Iterate through the string, counting consecutive occurrences of each character while building the answer.
### --question--
#### --text--
What approach can be used to reverse the digits of an integer? For example, given the input `1234`, the output should be `4321`.
#### --distractors--
Use bitwise operations to reverse the digits.
---
Convert the integer to a binary number and reverse it.
---
Use the `reverse()` method directly on the integer.
#### --answer--
Use a loop to extract digits from the integer and reconstruct the reversed integer.
### --question--
#### --text--
What approach would be used to generate Pascal's Triangle up to `n` rows? For example, for `n = 3`, the result would be `[[1], [1, 1], [1, 2, 1]]`.
#### --distractors--
Generate rows by using a function that outputs prime numbers and maps them to each row.
---
Use a loop to generate each row by multiplying adjacent elements from the previous row.
---
Use `Math.random()` to generate the rows.
#### --answer--
Use a loop to generate each row by adding adjacent elements from the previous row.
### --question--
#### --text--
Which algorithm is most efficient for sorting an array of size `n` containing numbers from `1` to `n`?
#### --distractors--
Bubble Sort
---
Merge Sort
---
Quick Sort
#### --answer--
Cyclic Sort
### --question--
#### --text--
Which algorithmic approach is best for solving the problem of finding the minimum number of coins for a given amount when only one type of coin is provided?
#### --distractors--
Dynamic Programming
---
Divide and Conquer
---
Backtracking
#### --answer--
Greedy Algorithm
### --question--
#### --text--
Which of the following problems can be solved efficiently using the two-pointer technique?
#### --distractors--
Sorting an array.
---
Traversing a tree level by level.
---
Finding the middle element of a linked list.
#### --answer--
Finding two numbers in a sorted array that sum up to a target value.
### --question--
#### --text--
Given a Roman numeral string, convert it to its corresponding integer value. For example, `"IX"` should return `9`.
#### --distractors--
Parse the string from left to right and add the values of individual numerals.
---
Parse each character and multiply by its index.
---
Use the `parseInt()` function on the Roman numeral string.
#### --answer--
Parse the string from right to left, adding the values of individual numerals and subtracting when a smaller numeral comes before a larger numeral.
### --question--
#### --text--
How can one check if a given string is a palindrome (the same forwards and backwards), for example `"madam"`?
#### --distractors--
Use Slow and Fast Pointer.
---
Compare it to its reverse after sorting the string.
---
Use regular expressions to remove all non-alphabetic characters and check equality.
#### --answer--
Compare the string to its reverse.
### --question--
#### --text--
Given a number `n`, write a function that prints numbers from `1` to `n`. For multiples of `3`, print `"Fizz"` for multiples of `5`, print `"Buzz"` and for multiples of both `3` and `5`, print `"FizzBuzz"`. What is the simplest approach to this?
#### --distractors--
Use `Math.random()` to generate numbers between `1` and `n` and check the result.
---
Use a for loop and check divisibility in-order of `3`, `5` and `15` with if conditions or switch.
---
Create a recursive function that checks divisibility by `3` and `5`.
#### --answer--
Use a for loop and check divisibility in-order of `15`, `5` and `3` with if conditions or switch.
### --question--
#### --text--
The Caesar cipher is a simple encryption technique where each letter in a string is shifted forward by a fixed number of positions in the alphabet. How would you shift all letters in a string by `3` positions?
#### --distractors--
Subtract `3` from the ASCII value of each character.
---
Replace each vowel with the next consonant.
---
Add `3` to the ASCII value of each character, but only for uppercase letters.
#### --answer--
Add `3` to the ASCII value of each character, wrapping around for `'z'` and `'Z'`.
### --question--
#### --text--
Anagrams are words formed by rearranging letters of another word. How can one determine if two strings are anagrams?
#### --distractors--
Compare total number of letters in both strings.
---
Reverse one string and compare with the other.
---
Use regular expressions to remove duplicate letters and check equality.
#### --answer--
Sort both strings and check if they are equal.
### --question--
#### --text--
Which of the following is the correct approach to check if a given number is prime?
#### --distractors--
Check if the number is divisible by `2` and `3`. If not, it's prime.
---
Check if the number is divisible by any odd number between `3` and the square root of the number.
---
Convert the number to binary and check if it has exactly two 1s.
#### --answer--
Loop from `2` to up to the square root of the prime candidate, and make sure none of the number divides it evenly.
### --question--
#### --text--
Which of the following describes the correct approach to find the greatest common divisor (GCD) of two numbers?
#### --distractors--
Find the average of the two numbers and round to the nearest integer.
---
Multiply the two numbers together and then divide by their least common divisor.
---
Add the two numbers together and divide by `2`.
#### --answer--
Use recursion where `gcd(a, b) = gcd(b, a % b)` where the base case would be to return first parameter when second parameter is zero.
### --question--
#### --text--
The factorial of a non-negative integer `n` (denoted `n!`) is the product of all positive integers from `1` to `n`, with `0! = 1`. Which of the following approaches can be used to calculate the factorial of a given number `n`?
#### --distractors--
Add the numbers from `1` to `n`.
---
Raise `n` to the power of `n-1`.
---
Find the prime factorization of n and then multiply the prime factors together.
#### --answer--
Multiplying numbers from `1` to `n` in a loop.
### --question--
#### --text--
Which of the following is the most efficient approach to search for a given integer within a distinct, sorted array of integers?
#### --distractors--
Linear Search.
---
Sort the array and search using Linear Search.
---
Create a hash table with the array elements and check for the given integer.
#### --answer--
Binary Search.

View File

@@ -1,455 +0,0 @@
---
id: 66edd476078cf3f3bc654271
title: Searching and Sorting Algorithms Quiz
challengeType: 8
dashedName: quiz-searching-and-sorting-algorithms
---
# --description--
To pass the quiz, you must correctly answer at least 17 of the 20 of the questions below.
# --quizzes--
## --quiz--
### --question--
#### --text--
What is the time complexity of binary search in the worst case?
#### --distractors--
O(n)
---
O(n^2)
---
O(1)
#### --answer--
O(log n)
### --question--
#### --text--
Which of the following is NOT a divide and conquer algorithm?
#### --distractors--
Merge Sort
---
Quick Sort
---
Insertion Sort
#### --answer--
Bubble Sort
### --question--
#### --text--
What is the time complexity of linear search in the worst case?
#### --distractors--
O(log n)
---
O(1)
---
O(n log n)
#### --answer--
O(n)
### --question--
#### --text--
Which sorting algorithm divides the array into smaller subarrays and merges them in sorted order?
#### --distractors--
Quick Sort
---
Insertion Sort
---
Bubble Sort
#### --answer--
Merge Sort
### --question--
#### --text--
What is the best-case time complexity of bubble sort?
#### --distractors--
O(n^2)
---
O(log n)
---
O(n log n)
#### --answer--
O(n)
### --question--
#### --text--
What is the time complexity of quicksort in the average case?
#### --distractors--
O(n^2)
---
O(n)
---
O(log n)
#### --answer--
O(n log n)
### --question--
#### --text--
What does divide and conquer refer to in algorithm design?
#### --distractors--
Sorting elements one by one
---
Searching through an array linearly
---
Swapping adjacent elements
#### --answer--
Breaking a problem into smaller subproblems
### --question--
#### --text--
Which of the following algorithms is the most efficient for large datasets in the average case?
#### --distractors--
Bubble Sort
---
Merge Sort
---
Insertion Sort
#### --answer--
Quick Sort
### --question--
#### --text--
In binary search, what condition is required for the array?
#### --distractors--
The array must contain unique elements
---
The array must be unsorted
---
The array must have an even number of elements
#### --answer--
The array must be sorted
### --question--
#### --text--
What is the space complexity of merge sort?
#### --distractors--
O(log n)
---
O(1)
---
O(n^2)
#### --answer--
O(n)
### --question--
#### --text--
What is the worst-case time complexity of bubble sort?
#### --distractors--
O(n)
---
O(n log n)
---
O(1)
#### --answer--
O(n^2)
### --question--
#### --text--
What is the best-case time complexity of binary search?
#### --distractors--
O(n)
---
O(log n)
---
O(n^2)
#### --answer--
O(1)
### --question--
#### --text--
Which of the following is a key characteristic of quicksort?
#### --distractors--
It sorts elements in linear time
---
It does not require recursion
---
It splits arrays into two equal parts
#### --answer--
It uses pivot elements to partition arrays
### --question--
#### --text--
What is the average-case time complexity of linear search?
#### --distractors--
O(n^2)
---
O(n log n)
---
O(log n)
#### --answer--
O(n)
### --question--
#### --text--
In quicksort, what happens when the pivot divides the array perfectly in half?
#### --distractors--
The time complexity becomes O(n^2)
---
The time complexity becomes O(n)
---
The time complexity becomes O(log n)
#### --answer--
The time complexity becomes O(n log n)
### --question--
#### --text--
What is the primary advantage of merge sort over quicksort?
#### --distractors--
Merge sort has lower time complexity
---
Merge sort has better space complexity
---
Merge sort avoids recursion
#### --answer--
Merge sort has guaranteed O(n log n) performance in the worst case
### --question--
#### --text--
Which sorting algorithm uses adjacent element comparisons and swaps?
#### --distractors--
Quick Sort
---
Merge Sort
---
Selection Sort
#### --answer--
Bubble Sort
### --question--
#### --text--
What is the time complexity of quicksort when the pivot is always the smallest or largest element?
#### --distractors--
O(n)
---
O(log n)
---
O(n log n)
#### --answer--
O(n^2)
### --question--
#### --text--
What does divide and conquer achieve in sorting algorithms?
#### --distractors--
Improves space complexity
---
Avoids recursion
---
Works only on sorted arrays
#### --answer--
Allows subproblems to be solved recursively
### --question--
#### --text--
What is the space complexity of quicksort in the best case?
#### --distractors--
O(n)
---
O(n log n)
---
O(n^2)
#### --answer--
O(log n)

View File

@@ -1,455 +0,0 @@
---
id: 66f1b0a939e913ccd3d4fa18
title: Security and Privacy Quiz
challengeType: 8
dashedName: quiz-security-and-privacy
---
# --description--
To pass the quiz, you must correctly answer at least 17 of the 20 of the questions below.
# --quizzes--
## --quiz--
### --question--
#### --text--
What is the difference between security and privacy?
#### --distractors--
Security handles identity verification, whereas privacy handles encryption.
---
Security ensures the accuracy of data, whereas privacy focuses on data anonymity.
---
Security monitors data integrity to prevent corruption, whereas privacy restricts the sharing of data between authorized users.
#### --answer--
Security involves protecting data from unauthorized access, whereas privacy involves controlling who can access the data.
### --question--
#### --text--
What is the main reason HTTPS is important for websites?
#### --distractors--
It allows for more data storage capacity when visiting a website.
---
It restricts websites from accessing specific data from the user.
---
It protects users from potential malware that may go undetected by the website.
#### --answer--
It encrypts the information shared between the user and the website.
### --question--
#### --text--
What does HTTPS stand for?
#### --distractors--
HighText Transfer Protocol Secure.
---
HyperText Transfer Protocol Service.
---
HyperText Transmission Protocol Secure.
#### --answer--
HyperText Transfer Protocol Secure.
### --question--
#### --text--
Why does the Same-Origin Policy exist in web browsers?
#### --distractors--
To allow webpages to access resources from domains without restrictions, thereby enabling seamless integration of content.
---
To ensure that all webpages are encrypted during data transfer.
---
To allow scripts to automatically run on all web pages when making a request.
#### --answer--
To prevent data leaks by restricting web pages from making requests to domains outside of their own.
### --question--
#### --text--
What does CORS do in web development?
#### --distractors--
Increases the speed of webpages by preventing them from overloading their cache.
---
Ensures that all scripts on a web page run in a single-threaded environment.
---
Encrypts all cross-origin network communications, preventing memory leaks.
#### --answer--
Enables web pages to securely request resources from different domains.
### --question--
#### --text--
Which of the following CORS headers is responsible for permitting HTTP methods for cross-origin requests?
#### --distractors--
`Access-Control-Expose-Headers`
---
`Access-Control-Allow-Credentials`
---
`Access-Control-Allow-Headers`
#### --answer--
`Access-Control-Allow-Methods`
### --question--
#### --text--
What is the potential security or privacy risk associated with the use of cookies?
#### --distractors--
Cookies store unencrypted settings and preferences.
---
Cookies can be accessed by third-party advertisers to cater to user interests.
---
Cookies enhance page load speed by storing user data; however, this can prevent your local machine from detecting abnormalities.
#### --answer--
Cookies may store session data that can potentially be intercepted or exploited by a malicious user.
### --question--
#### --text--
Which of the following best describes a tracking cookie?
#### --distractors--
A cookie that saves a user's login credentials for the current session.
---
A cookie that stores user settings and preferences to enhance load speed in future sessions.
---
A cookie that stores user settings and preferences across all devices.
#### --answer--
A cookie that monitors user behavior across all websites for advertising purposes.
### --question--
#### --text--
Which of the following is a common web security issue?
#### --distractors--
Insecure Direct Object References
---
Distributed Denial of Service
---
SQL Injection
#### --answer--
Cross-Site Scripting
### --question--
#### --text--
Which of the following is an effective against Cross-Site Request Forgery attacks?
#### --distractors--
Encrypting all data inputted by the user.
---
Setting a short cookie expiration date.
---
Using SSL certificates to securely transmit data and verify domain ownership.
#### --answer--
Using CSRF tokens and SameSite cookies to validate all requests.
### --question--
#### --text--
What is the purpose of Content Security Policy (CSP)
#### --distractors--
To encrypt all user login credentials before sending them to the server
---
To protect data from unauthorized access.
---
To monitor user behavior and activity on a website
#### --answer--
To restrict the sources of resources and prevent the execution of malicious scripts.
### --question--
#### --text--
What is the role of permission policies in web security?
#### --distractors--
To prevent the installation of unauthorized software.
---
To grant or deny access to data that is stored on the user's device.
---
To restrict all JavaScript and TypeScript execution within the user's browser.
#### --answer--
To specify which browser features a website is allowed to use (e.g., camera access or location).
### --question--
#### --text--
Which one of these is an example of Personally Identifiable Information (PII)?
#### --distractors--
City or Zip Code
---
Gender
---
Device Type
#### --answer--
Name or Email
### --question--
#### --text--
What is the consequence of a PII data breach?
#### --distractors--
Minor inconvenience with no long-term impact.
---
Increase search engine ranking.
---
Increase transparency of user data for internal reporting.
#### --answer--
Identity theft, financial loss, and legal consequences.
### --question--
#### --text--
What are key strategies for organizations to protect PII while ensuring user privacy and confidentiality?
#### --distractors--
Allow unrestricted access to employee data for transparency.
---
Sharing PII with third-party vendors to create better market insights.
---
Using unencrypted storage systems for faster and easier data access.
#### --answer--
Minimizing data collection and only gathering essential information from users.
### --question--
#### --text--
Which of the following statements is true about GDPR and COPPA?
#### --distractors--
GDPR is a United States regulation, whereas COPPA is an EU regulation.
---
GDPR and COPPA only apply to large corporations.
---
GDPR focuses on encryption for all websites, while COPPA only applies to companies considered financial institutions
#### --answer--
COPPA focuses on protecting children's data and GDPR is concerned with protecting all user data within the EU.
### --question--
#### --text--
Under GDPR, what is required from organizations when collecting user data?
#### --distractors--
User data must be fully anonymized to protect privacy.
---
All data must be encrypted upon collection.
---
Organizations are not allowed collect data from users that are not residing in the EU.
#### --answer--
Organizations must acquire consent from users before collecting any data.
### --question--
#### --text--
What is the key difference between authentication and authorization?
#### --distractors--
Authentication determines access rights, whereas authorization allows users to manage their data.
---
Authentication grants permissions, and authorization verifies credentials.
---
Authentication ensures data integrity and authorization is responsible for encrypting the data.
#### --answer--
Authentication involves verifying a user's identity, while authorization determines their access rights.
### --question--
#### --text--
How does Two-Factor Authentication (2FA) contribute to the authentication process?
#### --distractors--
It replaces all passwords with QR codes.
---
It allows users to enter their password more seamlessly.
---
It provides a more secure and streamlined verification process.
#### --answer--
It adds an extra layer of security by requiring additional verification.
### --question--
#### --text--
Which of the following is an example of an authorization process?
#### --distractors--
Sending a user's verification code to different devices.
---
Allowing employees unrestricted access to all company data.
---
Verifying if the email is associated with a human during sign-up.
#### --answer--
Allowing users with a manager role to view employee records.

View File

@@ -1,455 +0,0 @@
---
id: 66f1a0fcab4dfe9fcdcb269d
title: Web Standards Quiz
challengeType: 8
dashedName: quiz-web-standards
---
# --description--
To pass the quiz, you must correctly answer at least 17 of the 20 of the questions below.
# --quizzes--
## --quiz--
### --question--
#### --text--
Which protocol is responsible for domain name resolution?
#### --distractors--
HTTP
---
FTP
---
SMTP
#### --answer--
DNS
### --question--
#### --text--
What does the 404 HTTP response code indicate?
#### --distractors--
Server error
---
Unauthorized access
---
Redirect
#### --answer--
Resource not found
### --question--
#### --text--
What is the full form of TCP in TCP/IP?
#### --distractors--
Transfer Control Protocol
---
Transmission Connection Protocol
---
Transfer Connection Protocol
#### --answer--
Transmission Control Protocol
### --question--
#### --text--
Which of the following is a static file type?
#### --distractors--
ASP.NET
---
Node.js
---
PHP
#### --answer--
HTML
### --question--
#### --text--
Which response code class represents a successful operation?
#### --distractors--
1xx
---
3xx
---
4xx
#### --answer--
2xx
### --question--
#### --text--
Which part of a URL is 'freecodecamp.org' in 'https://www.freecodecamp.org'?
#### --distractors--
Protocol
---
Subdomain
---
TLD
#### --answer--
Domain
### --question--
#### --text--
What is the main function of the HTTP protocol?
#### --distractors--
Send emails
---
Resolve IP addresses
---
Stream media
#### --answer--
Transfer hypertext documents between clients and servers
### --question--
#### --text--
What does W3C stand for?
#### --distractors--
World Web Communication
---
Web Creation Committee
---
Web Coding Center
#### --answer--
World Wide Web Consortium
### --question--
#### --text--
What does a web hosting service provide?
#### --distractors--
Domain name registration
---
DNS management
---
Browser rendering
#### --answer--
Server space for storing web files
### --question--
#### --text--
What does the 301 HTTP response code indicate?
#### --distractors--
Temporary redirect
---
Unauthorized
---
Bad request
#### --answer--
Permanent redirect
### --question--
#### --text--
What is the purpose of a domain registrar?
#### --distractors--
Store web content
---
Manage DNS records
---
Allocate IP addresses
#### --answer--
Register domain names
### --question--
#### --text--
Which of the following standards bodies is primarily focused on the development of HTML?
#### --distractors--
W3C
---
IETF
---
IEEE
#### --answer--
WHATWG
### --question--
#### --text--
What are the key aspect that differentiates the POST method from GET in terms of form submissions?
#### --distractors--
GET requests are more secure than POST
---
POST includes data in the URL, while GET sends data in the body
---
POST is idempotent, whereas GET is not
#### --answer--
GET is limited by URL length, while POST is not
### --question--
#### --text--
What does the TCP three-way handshake process achieve in web communication?
#### --distractors--
Establishes a secure communication channel
---
Initiates and terminates an HTTP request
---
Encodes the IP address for DNS resolution
#### --answer--
Confirms the connection between client and server for reliable data transfer
### --question--
#### --text--
What is the one disadvantage of using dynamic content over static content on a website?
#### --distractors--
Dynamic content loads faster than static content
---
Static content cannot be updated without modifying server-side code
---
Dynamic content does not require server-side languages
#### --answer--
Dynamic content is difficult to cache effectively
### --question--
#### --text--
Which of the following is a key principle of web standards?
#### --distractors--
Platform dependency
---
High vendor lock-in
---
Proprietary formats
#### --answer--
Backward compatibility
### --question--
#### --text--
Which of the following is not a type of asset returned in an HTTP response?
#### --distractors--
HTML file
---
CSS file
---
JavaScript file
#### --answer--
SSH key
### --question--
#### --text--
What is the primary advantage of dynamic files over static files?
#### --distractors--
Faster load times
---
No server-side processing required
---
More cacheable by browsers
#### --answer--
Ability to generate content based on user input
### --question--
#### --text--
What is the main benefit of following web standards during development?
#### --distractors--
Higher performance on proprietary browsers
---
Allows for vendor-specific features
---
Excludes older devices from support
#### --answer--
Ensures cross-browser compatibility
### --question--
#### --text--
Which phase of the web standards lifecycle comes after 'Working Draft'?
#### --distractors--
Public implementation
---
Editors Draft
---
Final Recommendation
#### --answer--
Candidate Recommendation

View File

@@ -1,16 +0,0 @@
---
id: 6724e6548eec94290a26f410
title: Security and Privacy Review
challengeType: 24
dashedName: review-security-and-privacy
---
# --description--
Review the concepts below to prepare for the upcoming quiz.
# --assignment--
Review the Security and Privacy topics and concepts.

View File

@@ -471,14 +471,6 @@
{
"dashedName": "functional-programming",
"blocks": [
{ "dashedName": "lab-quicksort-algorithm" },
{ "dashedName": "quiz-searching-and-sorting-algorithms" },
{ "dashedName": "lab-roman-numeral-converter" },
{ "dashedName": "lab-telephone-number-validator" },
{ "dashedName": "lab-cash-register" },
{
"dashedName": "quiz-javascript-problem-solving-and-algorithmic-thinking"
},
{ "dashedName": "review-javascript-functional-programming" },
{ "dashedName": "quiz-javascript-functional-programming" }
]
@@ -487,16 +479,6 @@
"dashedName": "asynchronous-javascript",
"blocks": [
{ "dashedName": "workshop-fcc-authors-page" },
{ "dashedName": "quiz-javascript-object-oriented-programming" },
{ "dashedName": "lab-stack-class" },
{ "dashedName": "lab-linked-list-class" },
{ "dashedName": "lab-hash-table-class" },
{ "dashedName": "quiz-javascript-data-structures" },
{ "dashedName": "lab-depth-first-search" },
{ "dashedName": "quiz-graphs-and-trees" },
{ "dashedName": "lab-nth-fibonacci-number-generator" },
{ "dashedName": "quiz-dynamic-programming" },
{ "dashedName": "lab-pokemon-search-app" },
{ "dashedName": "review-asynchronous-javascript" },
{ "dashedName": "quiz-asynchronous-javascript" }
]
@@ -513,10 +495,7 @@
"modules": [
{
"dashedName": "react-fundamentals",
"blocks": [
{ "dashedName": "quiz-web-standards" },
{ "dashedName": "quiz-react-basics" }
]
"blocks": [{ "dashedName": "quiz-react-basics" }]
},
{
"dashedName": "react-state-hooks-and-routing",
@@ -624,18 +603,6 @@
}
]
},
{
"dashedName": "security-and-privacy",
"modules": [
{
"dashedName": "security-and-privacy",
"blocks": [
{ "dashedName": "review-security-and-privacy" },
{ "dashedName": "quiz-security-and-privacy" }
]
}
]
},
{
"dashedName": "exam-certified-full-stack-developer",
"modules": [

View File

@@ -1223,30 +1223,10 @@ const duplicatedProjectIds = [
// Number Sorter Project
// Quick Sort Algorithm
'587d825a367417b2b2512c89',
// Roman Numeral Converter
'657bdc8ba322aae1eac38390',
// Dice Game Project
// Telephone Number Validator
'657bdcb9a322aae1eac38391',
// Cash Register
'aa2e6f85cab2ab736c9a9b24',
// Shopping Cart
// Stacks
'587d8250367417b2b2512c5f',
// Depth-first Search
'587d825d367417b2b2512c96',
// Nth Fibonacci Number
// FCC Authors Page
'641d9a19bff38d34d5a5edb8',
'641da3c6b6fbd742bff6ee40',
@@ -1281,9 +1261,6 @@ const duplicatedProjectIds = [
// Forum Leaderboard
// Pokemon Search
'6555c1d3e11a1574434cf8b5',
/*** Front End Libraries ***/
// 25+5 Clock