From aee89b025be221f7fea3d56eb78f47ca4832e982 Mon Sep 17 00:00:00 2001 From: Zaira <33151350+zairahira@users.noreply.github.com> Date: Mon, 22 Sep 2025 21:31:43 +0500 Subject: [PATCH] feat(curriculum): convert title case challenge to lab (#62108) Co-authored-by: Ilenia <26656284+ilenia-magoni@users.noreply.github.com> --- client/i18n/locales/english/intro.json | 6 ++ .../lab-title-case-converter/index.md | 9 ++ .../ab6137d4e35944e21037b769.md | 82 +++++++++++++++++++ .../blocks/lab-title-case-converter.json | 15 ++++ .../superblocks/full-stack-developer.json | 1 + 5 files changed, 113 insertions(+) create mode 100644 client/src/pages/learn/full-stack-developer/lab-title-case-converter/index.md create mode 100644 curriculum/challenges/english/blocks/lab-title-case-converter/ab6137d4e35944e21037b769.md create mode 100644 curriculum/structure/blocks/lab-title-case-converter.json diff --git a/client/i18n/locales/english/intro.json b/client/i18n/locales/english/intro.json index c0ce2634708..f7a0ca06cbc 100644 --- a/client/i18n/locales/english/intro.json +++ b/client/i18n/locales/english/intro.json @@ -3436,6 +3436,12 @@ "In these lectures, you will learn about the var keyword and why it is not recommended for use anymore. You will also learn about hoisting in JavaScript so you can avoid subtle bugs in your code." ] }, + "lab-title-case-converter": { + "title": "Build a Title Case Converter", + "intro": [ + "In this lab, you will build a function that converts a string to title case." + ] + }, "lab-falsy-remover": { "title": "Implement a Falsy Remover", "intro": [ diff --git a/client/src/pages/learn/full-stack-developer/lab-title-case-converter/index.md b/client/src/pages/learn/full-stack-developer/lab-title-case-converter/index.md new file mode 100644 index 00000000000..e2c428e3279 --- /dev/null +++ b/client/src/pages/learn/full-stack-developer/lab-title-case-converter/index.md @@ -0,0 +1,9 @@ +--- +title: Introduction to the Build a Title Case Converter +block: lab-title-case-converter +superBlock: full-stack-developer +--- + +## Introduction to the Build a Title Case Converter + +In this lab, you will build a function that converts a string to title case. diff --git a/curriculum/challenges/english/blocks/lab-title-case-converter/ab6137d4e35944e21037b769.md b/curriculum/challenges/english/blocks/lab-title-case-converter/ab6137d4e35944e21037b769.md new file mode 100644 index 00000000000..3529660a911 --- /dev/null +++ b/curriculum/challenges/english/blocks/lab-title-case-converter/ab6137d4e35944e21037b769.md @@ -0,0 +1,82 @@ +--- +id: ab6137d4e35944e21037b769 +title: Build a Title Case Converter +challengeType: 26 +dashedName: build-a-title-case-converter +--- + +# --description-- + +In this lab you will create a function that converts a string to title case. Title case means that the first letter of each word is capitalized and the rest of the word is in lower case. + +`"Web Development Is Awesome"` is an example of a title cased string. + +**Objective**: Fulfill the user stories below and get all the tests to pass to complete the lab. + +**User Stories:** + +1. You should have a `titleCase` function that takes a string as an argument. +1. The `titleCase` function should return a string with the first letter of each word capitalized and the rest of the word in lower case. +1. `titleCase("I like to code")` should return `"I Like To Code"`. +1. `titleCase("javaScript is fun")` should return `"Javascript Is Fun"`. + +# --hints-- + +You should create a function named `titleCase`. + +```js +assert.isFunction(titleCase); +``` + +`titleCase` should take a single argument. + +```js +assert.lengthOf(titleCase, 1); +``` + + +`titleCase("I'm a little tea pot")` should return a string. + +```js +assert.isString(titleCase("I'm a little tea pot")); +``` + +`titleCase("I'm a little tea pot")` should return the string `I'm A Little Tea Pot`. + +```js +assert.strictEqual(titleCase("I'm a little tea pot"), "I'm A Little Tea Pot"); +``` + +`titleCase("sHoRt AnD sToUt")` should return the string `Short And Stout`. + +```js +assert.strictEqual(titleCase('sHoRt AnD sToUt'), 'Short And Stout'); +``` + +`titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")` should return the string `Here Is My Handle Here Is My Spout`. + +```js +assert.strictEqual( + titleCase('HERE IS MY HANDLE HERE IS MY SPOUT'), + 'Here Is My Handle Here Is My Spout' +); +``` + +# --seed-- + +## --seed-contents-- + +```js + +``` + +# --solutions-- + +```js +function titleCase(str) { + return str + .split(' ') + .map(word => word.charAt(0).toUpperCase() + word.substring(1).toLowerCase()) + .join(' '); +} +``` diff --git a/curriculum/structure/blocks/lab-title-case-converter.json b/curriculum/structure/blocks/lab-title-case-converter.json new file mode 100644 index 00000000000..3230dd119d7 --- /dev/null +++ b/curriculum/structure/blocks/lab-title-case-converter.json @@ -0,0 +1,15 @@ +{ + "name": "Build a Title Case Converter", + "isUpcomingChange": false, + "dashedName": "lab-title-case-converter", + "helpCategory": "JavaScript", + "blockLayout": "link", + "blockType": "lab", + "challengeOrder": [ + { + "id": "ab6137d4e35944e21037b769", + "title": "Build a Title Case Converter" + } + ], + "usesMultifileEditor": true +} diff --git a/curriculum/structure/superblocks/full-stack-developer.json b/curriculum/structure/superblocks/full-stack-developer.json index 97bc8d5a898..f6d755afc51 100644 --- a/curriculum/structure/superblocks/full-stack-developer.json +++ b/curriculum/structure/superblocks/full-stack-developer.json @@ -382,6 +382,7 @@ "lab-pyramid-generator", "lab-gradebook-app", "lecture-the-var-keyword-and-hoisting", + "lab-title-case-converter", "lab-falsy-remover", "lab-inventory-management-program", "lecture-understanding-modules-imports-and-exports",