Skip to main content

String Exercises

The marked file is the file you'll be using in the part of the assignment.

  .
├── exercises
│ ..
│ ├── string-exercises
│ │ ├── css
│ │ │ └── style.css
│ │ ├── js
│ │ │ ├── __tests__
│ │ │ │ └── stringsExercises.js
│ │ │ ├── app.js
--│ │ │ └── strings.js ⬅️
│ │ └── index.html
│ └── ..
..

when opening the project in your browser, you will need to navigate to the string exercises assignment page to see the result of your work on the web page.

Some of these exercises are already done on the JS Exercises Assignment.

Instructions

  1. Open the string exercises html file in your browser: exercises/string-exercises/index.html
    • 🦉: Use Visual Studio Code's Live Server extension to open the file in your browser with live reloading.
    • 🦉: You can also run npm start to start a local server.
  2. Type something in the textarea; notice how the text is presented back as is in the paragraphs underneath.
    • 🦉: Check out exercises/string-exercises/js/app.js to see how the methods are being used and how the UI is being manipulated.
  3. Provide the correct implementation for the various methods in the exercises/string-exercises/js/strings.js file.
    • 🦉: The methods are already defined, you just need to provide the implementation.
    • Notice how the results on the web page change as you implement the methods.
  4. To run the automated checks for this assignment, run the following command: npm run test:unit:string.
    • This checks the correctness of your implementation of the methods in the strings.js file.
    • It doesn't interact with the UI, and doesn't check the UI.