Welcome to your first JavaScript lab at Ironhack!
The goal of this exercise is to get you familiarized with the primitive data structures in JavaScript, which we have covered in the class. Feel free to reference lesson materials, and don't limit yourself; be curious and use Google to explore multiple solutions.
For this pair-programming activity, we are going to use a REPL. To make things as simple as possible, we are going to use an in-browser JavaScript REPL that is provided by the browser-based IDE, repl.it.
Ready to start?
-
Fork this repo
-
Clone this repo
-
Go to repl.it and create an account (or login if you have one)
-
Create a new reply by clicking on + Create Repl
-
Type this in the Code Editor (left panel)
console.log("I'm ready!");
-
Press
run ►
-
If you can see the message in the right side panel, you are really ready!
-
When you are done completely, or at any point after the first iteration, copy your code into the
index.js
file and follow the steps for submission.
Upon completion, run the following commands:
$ git add .
$ git commit -m "done"
$ git push origin master
Create a Pull Request so that the TAs can check your work.
You should make a PR (Pull Request) as soon as you make any significant change. You shouldn't have to wait until you're completely done with this or any other exercise to make the PR. After you do the first PR, any other time you push the changes (following the previous three steps), your change will appear automatically on the PR and your TAs will be able to check it.
1.1 Create a variable hacker1
with the driver's name.
1.2 Print "The driver's name is XXXX"
.
1.3 Create a variable hacker2
with the navigator's name.
1.4 Print "The navigator's name is YYYY"
.
2.1. Depending on which name is longer, print:
- The driver has the longest name, it has XX characters.
or
- It seems that the navigator has the longest name, it has XX characters.
or
- Wow, you both have equally long names, XX characters!
.
3.1 Print the characters of the driver's name, separated by space, and in capital letters, i.e., "J O H N"
.
3.2 Print all the characters of the navigator's name, in reverse order, i.e., "nhoJ"
.
3.3 Depending on the lexicographic order of the strings, print:
The driver's name goes first.
Yo, the navigator goes first definitely.
What?! You both have the same name?
Go to the lorem ipsum generator website and:
- Generate 3 paragraphs. Store the text in a new string variable named
longText
. - Make your program count the number of words in the string.
- Make your program count the number of times the Latin word
et
appears.
Create a new variable phraseToCheck
and have it contain some string value. Write a code that will check if the value we assigned to this variable is a Palindrome. Here are some examples of palindromes:
- "A man, a plan, a canal, Panama!"
- "Amor, Roma"
- "race car"
- "stack cats"
- "step on no pets"
- "taco cat"
- "put it up"
- "Was it a car or a cat I saw?" and "No 'x' in Nixon".
IMPORTANT: If you use Google to help you to find solution to this iteration, you might run into some advanced solutions that use string or array methods (such as join(), reverse(), etc.). However, we want you to apply the knowledge you currently have and try to come up with a solution by just using for
loop and if-else
statements with some break
and continue
.
Happy coding! ❤️