- Notifications
You must be signed in to change notification settings - Fork5.8k
[MAD-PT DE] Teresa Pelinski#546
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Closed
Uh oh!
There was an error while loading.Please reload this page.
Closed
Changes fromall commits
Commits
Show all changes
11 commits Select commitHold shift + click to select a range
68c4007 iteration1 finished
pelinskif906d81 iteration 2 finished
pelinskib61aab4 3.1.done
pelinski6956475 finished 3.2.
pelinski461d75d finished 3.3
pelinskicb97190 bonus 1 finished
pelinskia1c3e88 finished bonus 2
pelinski2350826 corrected indent
pelinski236ccae added iteration titles as console.log
pelinski9168838 error fixed
pelinski4b65b9a accidentally deleted control.log in 3.1. fixed
pelinskiFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
91 changes: 89 additions & 2 deletionsjs/index.js
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,7 +1,94 @@ | ||
| // Iteration 1: Names and Input | ||
| console.log(">>Iteration 1"); | ||
| var hacker1 = "Teresa"; | ||
| console.log("The driver's name is", hacker1); | ||
| var hacker2 = "Pepita"; | ||
| console.log("The navigator's name is", hacker2); | ||
| console.log("\n\n"); | ||
| // Iteration 2: Conditionals | ||
| console.log(">>Iteration 2"); | ||
| 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( | ||
| "It seems that the navigator has the longest name, it has", | ||
| hacker2.length, | ||
| "characters." | ||
| ); | ||
| } else { | ||
| console.log( | ||
| "Wow, you both have equally long names,", | ||
| hacker1.length, | ||
| "characters!" | ||
| ); | ||
| } | ||
| console.log("\n\n"); | ||
| // Iteration 3: Loops | ||
| //3.1 | ||
| console.log(">>Iteration 3.1"); | ||
| console.log( | ||
| hacker1 | ||
| .toUpperCase() | ||
| .split("") | ||
| .join(" ") | ||
| ); | ||
| console.log("\n"); | ||
| //3.2 | ||
| console.log(">>Iteration 3.2"); | ||
| var aux = []; | ||
| for (let i = 0; i < hacker2.length; i++) { | ||
| aux[i] = hacker2[hacker2.length - i - 1]; | ||
| } | ||
| console.log(aux.join("")); | ||
| console.log("\n"); | ||
| //3.3 | ||
| console.log(">>Iteration 3.3"); | ||
| if (hacker1.localeCompare(hacker2) == -1) { | ||
| console.log("The driver's name goes first."); | ||
| } else if (hacker2.localeCompare(hacker1) == -1) { | ||
| console.log("Yo, the navigator goes first definitely."); | ||
| } else { | ||
| console.log("What?! You both have the same name?"); | ||
| } | ||
| console.log("\n\n"); | ||
| //Bonus 1 | ||
| console.log(">>Bonus 1"); | ||
| var lorem = | ||
| "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ex est, congue a pretium id, fermentum id justo. Duis consectetur tempor diam, nec ornare dolor commodo id. Pellentesque quis purus lacus. Donec rutrum mauris arcu, sed tincidunt dui dignissim nec. Duis hendrerit nibh vel purus consectetur, eu efficitur metus aliquet. Cras rutrum malesuada mauris sit amet tincidunt. Aliquam vestibulum dignissim eros, vitae aliquet quam condimentum non. Integer hendrerit, tortor et gravida tempor, erat nisi congue diam, sollicitudin efficitur lacus lacus eget dui. Donec vel ullamcorper mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur pellentesque varius elementum.\nQuisque ut magna sed turpis eleifend placerat. Integer tempus auctor turpis, sit amet feugiat odio volutpat ac. Donec vitae ipsum dui. Proin eu tortor eu justo finibus imperdiet. Integer porta turpis et lectus maximus gravida. Aliquam mollis ut nisi vel lacinia. Ut sodales lacus eu metus posuere, nec feugiat enim semper. Fusce ac magna in nulla cursus malesuada. Fusce fringilla ac justo at efficitur. Phasellus sollicitudin lorem non est vulputate laoreet.\nNunc ut ex pharetra velit elementum sodales. Morbi vehicula sit amet augue vitae lobortis. Nullam vestibulum rutrum cursus. Mauris non sapien lobortis, vestibulum massa et, semper orci. Etiam ac enim tellus. Cras nec odio nulla. Phasellus ultricies sollicitudin ligula eu posuere. Morbi cursus erat ac ultricies efficitur. Phasellus tempor imperdiet tincidunt. Phasellus condimentum ante nec quam fringilla mollis. Sed elementum mauris erat, nec imperdiet massa consectetur ut. Etiam blandit placerat nibh eu tincidunt. Donec elementum ante in nulla fringilla vulputate. Aenean vel nibh consequat, fringilla mauris dictum, venenatis massa. Quisque dignissim hendrerit imperdiet. Ut ultrices pulvinar nunc nec faucibus."; | ||
| var loremWords = lorem.split(" "); | ||
| var counter = 0; | ||
| for (let i = 0; i < loremWords.length; i++) { | ||
| if (loremWords[i] == "et") { | ||
| counter++; | ||
| } | ||
| } | ||
| console.log("et appears", counter, "times"); | ||
| console.log("\n\n"); | ||
| //Bonus 2 | ||
| console.log(">>Bonus 2"); | ||
| var { question } = require("readline-sync"); | ||
| var testPalindrome = question( | ||
| "Hey, write a string that you think MIGHT BE A PALINDROME. Thank you. >>" | ||
| ); | ||
| var inversePalindrome = []; | ||
| for (let i = 0; i < testPalindrome.length; i++) { | ||
| inversePalindrome[i] = testPalindrome[testPalindrome.length - i - 1]; | ||
| } | ||
| if (inversePalindrome.join("").toLowerCase() == testPalindrome.toLowerCase()) { | ||
| console.log("THIS IS A PALINDROME. Congrats"); | ||
| } else { | ||
| console.log("This is not a Palindrome. Just google it lol"); | ||
| } | ||
| console.log("\n\n"); |
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.