-
Notifications
You must be signed in to change notification settings - Fork 5.9k
PARIS - Frederic #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
PARIS - Frederic #361
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,96 +1,2 @@ | ||
|  | ||
|
|
||
| # JS | Basic Algorithms | ||
|
|
||
| Welcome to your first bootcamp exercise at IronHack! | ||
|
|
||
| The goal of this exercise is to get you acquainted with the different control structures we have in JavaScript. | ||
|
|
||
| Ready? | ||
|
|
||
| ## Introduction | ||
|
|
||
| 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 fine a REPL that runs in the browser for programming languages as JavaScript in [repl.it](https://repl.it/) | ||
|
|
||
| We could also type JavaScript code in an editor, and then execute it to see the results in the REPL. | ||
|
|
||
| Ready to start? | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Go to [repl.it](https://repl.it/languages/javascript) and create an account (or login if you have one) | ||
| - Open a new repl.it and make sure the language is ==JavaScript== | ||
| - Type this in the ==Code Editor== (left panel) | ||
|
|
||
| ```javascript | ||
| console.log("I'm Ready!"); | ||
| ``` | ||
| - Press `run ►` | ||
| - If you can see the message on the JavaScript REPL, you're ready!! | ||
|
|
||
|  | ||
|
|
||
| ## Submission | ||
|
|
||
| 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. | ||
|
|
||
|  | ||
|
|
||
| **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 | ||
|
|
||
| ## Exercise | ||
|
|
||
| ### Names and Input | ||
|
|
||
| 1. Create a variable `hacker1` with the driver's name | ||
|
|
||
| 2. Print `"The driver's name is XXXX"` | ||
|
|
||
| 3. Create a variable `hacker2` and [ask the user](https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt) for the navigator's name | ||
|
|
||
| 4. Print `"The navigator's name is YYYY"` | ||
|
|
||
| ### Conditionals | ||
|
|
||
| 5. Depending on which name [is longer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), print: | ||
| - `The Driver has the longest name, it has XX characters` or | ||
| - `Yo, navigator got the longest name, it has XX characters` or | ||
| - `wow, you both got equally long names, XX characters!!` | ||
|
|
||
| ### Loops | ||
|
|
||
| 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) | ||
| ie. `"J O H N"` | ||
|
|
||
| 7. Print all the characters of the navigator's name, in reverse order. | ||
| ie. `"nhoJ"` | ||
|
|
||
| 8. Depending on the [lexicographic order](https://en.wikipedia.org/wiki/Lexicographical_order) of the strings, print: | ||
| - `The driver's name goes first` | ||
| - `Yo, the navigator goes first definitely` | ||
| - `What?! You both got the same name?` | ||
|
|
||
| ### Bonus Time! | ||
|
|
||
| 9. Ask the user for a new string and check if it's a [Palindrome](https://en.wikipedia.org/wiki/Palindrome). 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". | ||
|
|
||
| 10. Go to [lorem ipsum generator](http://www.lipsum.com/) and: | ||
| - Generate 3 parragraphs. Store the text in a String | ||
| - Make your program count the number of words in the string | ||
| - Make your program count the number of times the latin word [`et`](https://en.wiktionary.org/wiki/et#Latin)appears | ||
|
|
||
| ## Extra Resources | ||
|
|
||
| - [prompt() - MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt) | Ask user for input | ||
| - [String - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) | ||
| - [if - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else) | ||
| - [while - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while) | ||
| - [for - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for) | ||
| # lab-javascript-basic-algorithms | ||
| An exercise designed to learn basic JS algorithms (var, loops, etc...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Names and Input | ||
| var hacker1 = "Guillaume"; | ||
| console.log("The driver's name is " + hacker1); | ||
| var hacker2; | ||
| var hacker2 = prompt ("What's your navigator name"); | ||
| console.log("The navitor's name is " + hacker2); | ||
|
|
||
| //Conditionals | ||
|
|
||
| if (hacker1.length > hacker2.length){ | ||
| console.log("The Driver has the longest name, it has " + hacker1.length + " characters.") | ||
| } | ||
| else if (hacker1.length < hacker2.length) { | ||
| console.log("Yo, navigator got the longest name, it has " + hacker2.length + " characters.") | ||
| } | ||
| else { | ||
| console.log("wow, you both got equally long names, XX characters!!") | ||
| } | ||
| var hacker1 = hacker1.toUpperCase(); | ||
| console.log(hacker1); | ||
| var hacker1 = hacker1.split('').join(" "); | ||
| console.log(hacker1); | ||
|
|
||
| function reverseString(hacker1) { | ||
| var reverseStringHacker1 =""; | ||
| for (var i = hacker1.length - 1; i >= 0; i--) { | ||
| reverseStringHacker1 = reverseStringHacker1 + hacker1[i]; | ||
| } | ||
| return reverseStringHacker1; | ||
| } | ||
| console.log(reverseString(hacker1)); | ||
| var reverseStringHacker1 = reverseString(hacker1); | ||
| console.log(reverseStringHacker1); | ||
|
|
||
| var tableau=[hacker1,hacker2]; | ||
| console.log(tableau); | ||
| tableau.sort(); | ||
| console.log(tableau); | ||
|
|
||
| if (tableau[0] === hacker1){ | ||
| console.log("The driver's Guillaume goes first"); | ||
| } | ||
| else if (tableau[1] === hacker2){ | ||
| console.log("The driver 2 goes first for sure") | ||
| } | ||
| else if (tableau[1] === tableau[2]){ | ||
| console.log("You have the same name") | ||
| } | ||
| else { | ||
| console.log("la fin des haricots si tu vois ça") | ||
| } | ||
|
|
||
| console.log("testgitpull") | ||
| // Lorem ipsum generator | ||
|
|
||
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tu l'as bien mis la, pas la peine de mettre les deux liegnes suivantes !