One partner should fork this repo. Then after it's been forked, add the other partner(s) as collaborators. Afterwards, all group members should be able to clone down the forked repository and all group members should be able to push and pull from that repository to their AWS environment. You can all work off the master branch, you do not need to create new branches unless you want to.
Work with your partner to implement the functions under the "Problems" section below. Write your solution in the app.js file. For each exercise, one partner should be the Navigator and the other should be the Driver.
- Navigator(s) should describe what the function should do.
- Describe, in plain English, what the function should take in as a parameter and what it should console.log or return.
- Driver writes out the test cases.
- For each problem, invoke the function with a parameter and describe the expected results.
- We've suggested some test cases for the problems, but you should come up with some of your own, too!
- Navigator(s) explains how to implement the function while Driver writes the code.
- Driver tests the code by running the applcation using
node app.jsin the terminal.- Did the code work? Did it print out what youw expected it you print out?
- Do some refactoring if needed, or add additional test cases if desired.
Switch roles for each of the problems below. Once you finish this problem, the driver should commit and push the code up to Github. Verify that your changes are in the remote repo, then have your group members pull those changes down.
- You should manually test your code by running the program. From the project's root directory, type
node app.jsin the terminal and see if the program does out what you expect it to. - You should also run the automated test cases built into this lab.
- From the project's root directory, type and run
npm installin your terminal. Each partner only need to do this once. - Then, every time you want to run the automated test cases, run
npm testin the terminal.
- From the project's root directory, type and run
- Watch this video tutorial on how to to set up and do paired programming activites.
- Write a function called
sayHellothat takes in one parameter, a person's name, and logs a greeting to the console based on their name.
sayHello('Ann'); // Hello, Ann;
sayHello('Reuben'); // Hello, Reuben;- Write a function called
letterCountthat takes in one parameter, a person's name, and logs a greeting including the number of letters to the console. If the name is longer than four letters, it should say"That's a pretty long name!", otherwise, it should say"That name's not that long!"
letterCount('Ann'); // Ann, your name has 3 letters. That name's not that long!
letterCount('Reuben'); // Reuben, your name has 6 letters. That's a pretty long name!- Write a function called
greetPeoplethat takes in an array of names as an argument. For each name, we should log a greeting to the console based on their name, and a greeting based on the number of letters. You should leverage the methods you've already written. As a best practice, programmers follow the DRY (Don't Repeat Yourself) principle.
For example, greetPeople(["Ann", "Reuben"]) should log these four lines to the console.
greetPeople(["Ann", "Reuben"])
//Hello, Ann
//Ann, your name has 3 letters. That name's not that long!
//Hello, Reuben
//Reuben, your name has 6 letters. That's a pretty long name!- Write a function called
speakingGrandmathat takes in a string. Whatever you say to grandma (whatever you type in), she should respond with'HUH?! SPEAK UP, DEAR!'', unless you shout it (type in all capitals). If you shout, she can hear you (or at least she thinks so) and yells back,'NO, NOT SINCE 1938!'In either case, you should log her message to the console.
speakingGrandma('Hello, grandma'); // HUH? SPEAK UP, DEAR!
speakingGrandma('HELLO, GRANDMA'); // NO, NOT SINCE 1938!Hint: Use MDN documentation on toUpperCase()
Run npm test in the terminal to see if you've done problems 1 thorugh 4 correctly. If you get an error sh: jest: command not found npm ERR! Test failed. See above for more details, run npm install in your terminal, then try running npm test again.
- Write a function called
kebabToTitleCasethat takes in an array of file names inkebab-case. For each file name, it console.logs the file name transformed intoTitleCase. At the end of the function, it should also return a new array containing all the TitleCase files names!
kebabToTitleCase(['hello-there.txt', 'another-file.txt', 'multiple-words-together.jpg'])
// HelloThere.txt
// AnotherFile.txt
// MultipleWordsTogether.jpg
=> [ 'HelloThere.txt', 'AnotherFile.txt', 'MultipleWordsTogether.jpg' ]Hint: Use the following MDN documentation: