|
1 |
| - |
| 1 | + |
2 | 2 |
|
3 |
| -# JS | Basic Algorithms |
| 3 | +# Lab | JS Basic Algorithms |
4 | 4 |
|
5 |
| -Welcome to your first bootcamp exercise at IronHack! |
| 5 | +Welcome to your first bootcamp exercise at Ironhack! |
6 | 6 |
|
7 |
| -The goal of this exercise is to get you acquainted with the different control structures we have in JavaScript. |
| 7 | +The goal of this exercise is to get you familiarized with the different data structures we have in JavaScript. |
8 | 8 |
|
9 | 9 | Ready?
|
10 | 10 |
|
11 | 11 | ## Introduction
|
12 | 12 |
|
13 |
| -For this Pair-Programming activity we are going to use a [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop). You can find a REPL that runs in the browser for programming languages as JavaScript in [repl.it](https://repl.it/) |
14 |
| - |
15 |
| -We could also type JavaScript code in an editor, and then execute it to see the results in the REPL. |
| 13 | +For this **pair-programming** activity we are going to use a [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop). You can find a REPL that runs in the browser for programming languages as JavaScript in [https://repl.it/languages/nodejs](https://repl.it/languages/nodejs) |
16 | 14 |
|
17 | 15 | Ready to start?
|
18 | 16 |
|
19 | 17 | ## Requirements
|
20 | 18 |
|
21 |
| -- Go to [repl.it](https://repl.it/languages/javascript) and create an account (or login if you have one) |
22 |
| -- Open a new repl.it and make sure the language is ==JavaScript== |
23 |
| -- Type this in the ==Code Editor== (left panel) |
| 19 | +- Go to [repl.it](https://repl.it/languages/nodejs) and create an account (or login if you have one) |
| 20 | +- Type this in the *Code Editor* (left panel) |
24 | 21 |
|
25 | 22 | ```javascript
|
26 |
| - console.log("I'm Ready!"); |
| 23 | + console.log("I'm ready!"); |
27 | 24 | ```
|
28 | 25 | - Press `run ►`
|
29 |
| -- If you can see the message on the JavaScript REPL, you're ready!! |
| 26 | +- If you can see the message in the right side panel, you are really ready! |
30 | 27 |
|
31 |
| -  |
| 28 | + <!--  --> |
| 29 | +  |
32 | 30 |
|
33 | 31 | ## Submission
|
34 | 32 |
|
35 |
| -When you are done and you have checked that everything works fine, go to https://gist.github.com/, create a new [secret gist](https://help.github.com/articles/about-gists/#secret-gists) and send it to your Instructor. |
36 |
| - |
37 |
| -  |
| 33 | +When you are done and you have checked that everything works fine, click on the **Share** button and copy the link from the *Share Link* field. Send this link to your TAs so they can check up your work. |
| 34 | + |
| 35 | + |
38 | 36 |
|
39 |
| -**Remember:** Remember to add the extension of the file `fileName`**.js** in the *"Filename including extension"* input box so you can enjoy [syntax highlighting](https://en.wikipedia.org/wiki/Syntax_highlighting) in your gist |
40 | 37 |
|
41 |
| -## Exercise |
| 38 | +## Instructions |
42 | 39 |
|
43 |
| -### Names and Input |
| 40 | +### Iteration 1: Names and Input |
44 | 41 |
|
45 |
| -1. Create a variable `hacker1` with the driver's name |
| 42 | + 1.1 Create a variable `hacker1` with the driver's name. |
46 | 43 |
|
47 |
| -2. Print `"The driver's name is XXXX"` |
| 44 | + 1.2 Print `"The driver's name is XXXX"`. |
48 | 45 |
|
49 |
| -3. Create a variable `hacker2` with the navigator's name |
| 46 | + 1.3 Create a variable `hacker2` with the navigator's name. |
50 | 47 |
|
51 |
| -4. Print `"The navigator's name is YYYY"` |
| 48 | + 1.4 Print `"The navigator's name is YYYY"`. |
52 | 49 |
|
53 |
| -### Conditionals |
| 50 | +### Iteration 2: Conditionals |
54 | 51 |
|
55 |
| -5. Depending on which name [is longer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), print: |
56 |
| - - `The Driver has the longest name, it has XX characters` or |
57 |
| - - `Yo, navigator got the longest name, it has XX characters` or |
58 |
| - - `wow, you both got equally long names, XX characters!!` |
| 52 | + 2.1. Depending on which name [is longer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), print: |
| 53 | + - `The Driver has the longest name, it has XX characters` or |
| 54 | + - `Yo, navigator got the longest name, it has XX characters` or |
| 55 | + - `Wow, you both got equally long names, XX characters!` |
59 | 56 |
|
60 |
| -### Loops |
| 57 | +### Iteration 3: Loops |
61 | 58 |
|
62 |
| -6. Print all the characters of the driver's name, separated by a space and [in capitals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase) |
63 |
| - ie. `"J O H N"` |
| 59 | + 3.1 Print all the characters of the driver's name, separated by a space and [in capitals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase) |
| 60 | + i.e. `"J O H N"` |
64 | 61 |
|
65 |
| -7. Print all the characters of the navigator's name, in reverse order. |
66 |
| - ie. `"nhoJ"` |
| 62 | + 3.2 Print all the characters of the navigator's name, in reverse order. |
| 63 | + i.e. `"nhoJ"` |
67 | 64 |
|
68 |
| -8. Depending on the [lexicographic order](https://en.wikipedia.org/wiki/Lexicographical_order) of the strings, print: |
69 |
| - - `The driver's name goes first` |
70 |
| - - `Yo, the navigator goes first definitely` |
71 |
| - - `What?! You both got the same name?` |
| 65 | + 3.3 Depending on the [lexicographic order](https://en.wikipedia.org/wiki/Lexicographical_order) of the strings, print: |
| 66 | + - `The driver's name goes first.` |
| 67 | + - `Yo, the navigator goes first definitely.` |
| 68 | + - `What?! You both got the same name?` |
72 | 69 |
|
73 | 70 | ### Bonus Time!
|
74 | 71 |
|
75 |
| -9. Go to [lorem ipsum generator](http://www.lipsum.com/) and: |
76 |
| - - Generate 3 paragraphs. Store the text in a String |
77 |
| - - Make your program count the number of words in the string |
78 |
| - - Make your program count the number of times the latin word [`et`](https://en.wiktionary.org/wiki/et#Latin) appears |
| 72 | +Go to [lorem ipsum generator](http://www.lipsum.com/) and: |
| 73 | + - Generate 3 paragraphs. Store the text in a variable type of string. |
| 74 | + - Make your program count the number of words in the string. |
| 75 | + - Make your program count the number of times the Latin word [`et`](https://en.wiktionary.org/wiki/et#Latin) appears. |
79 | 76 |
|
80 | 77 | ## Extra Resources
|
81 | 78 |
|
|
0 commit comments