Hamburger Icon
  • Labs icon Lab
  • Core Tech
Labs

Create a String Manipulation Library in JavaScript

In this hands-on lab, you'll learn to refactor JavaScript modules related to the command-line interface of a library. You will refactor variable declarations and strings used for help and usage text. You'll also use JavaScript Symbols in the main module to provide globally unique values. By the end of the lab, you'll also have learned to use string interpolation and raw string processing.

Labs

Path Info

Level
Clock icon Beginner
Duration
Clock icon 45m
Published
Clock icon Apr 14, 2023

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Refactor variables imported with require

    In this module, we will refactor JavaScript modules related to the command-line interface of the library. This will involve refactoring variable declarations and strings used for help and usage text. By the end we'll use string interpolation and raw string processing. We'll also use JavaScript Symbols in the main module to provide globally unique values. ### Solution To view the solution, run git diff origin/master..module-2-solution in the Terminal, and press Enter to see the next lines of the difference.

    You may also browse the files of the solution by stashing your changes with git stash and running git checkout module-2-solution to switch branches.

  2. Challenge

    Create a template tag

    In this module, we'll implement custom template tags to allow consumers of our library to quickly transform text. These tags will also enable consumers to disable line transformations on a given class using a global symbol. By the end we'll demonstrate the use of several string methods by writing tests that ensure our template tags work as expected. ### Solution To view the solution, run git diff origin/master..module-3-solution in the Terminal, and press Enter to see the next lines of the difference.

    You may also browse the files of the solution by stashing your changes with git stash and running git checkout module-3-solution to switch branches.

AJ is a software developer who is passionate about technical education. He loves creating with code and volunteering with youth robotics programs.

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.