Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,4 @@ Create a new variable `phraseToCheck` and have it contain some string value. Wri


__Happy coding!__ :heart:
# ironhack_misc
106 changes: 104 additions & 2 deletions 106 js/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,109 @@
// Iteration 1: Names and Input
let hacker1 = "Tina";
let hacker2 = "Bob";
console.log(`The drivers name is ${hacker1}`);
console.log(`The navigators name is ${hacker2}`);

// Iteration 2: Conditional

// Iteration 2: 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(`It seems that the navigator has the longest name, it has ${hacker2.length} characters.`);
}

// Iteration 3: Loops
if ( hacker1.length === hacker2.length){
console.log(`Wow, you both have equally long names, ${hacker1.length} characters!`);
}




// Iteration 3: Loops

for (i = 0; i < hacker1.length; i++) {
let newHacker = hacker1.split('').join(' ');
console.log(newHacker.toUpperCase())

}

for (i = 0; i < hacker2.length; i++) {
let newerHacker = hacker2.split('');
newerHacker = newerHacker.reverse();
var joinArray = newerHacker.join("");
console.log(joinArray);
}



if (hacker1[0] < hacker2[0]) {
console.log(`Yo, the navigator goes first definitely.`);
}

else if (hacker1[0] > hacker2[0]) {
console.log(`The driver's name goes first.`)
}

else {
console.log(`What?! You both have the same name?`)
}





let str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque in rhoncus purus. Sed consectetur in ex ac bibendum. Nulla vel elementum lectus, volutpat gravida dui. Nulla nulla felis, porta in nibh a, tempus molestie libero. Aenean dictum iaculis faucibus. Sed tincidunt nunc eu purus iaculis, non interdum sapien pulvinar. Vestibulum porta ipsum sit amet tincidunt consequat. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.Fusce eget ullamcorper ipsum. Proin molestie magna lorem. Morbi porttitor consequat ante quis sodales. Fusce porttitor arcu a risus malesuada faucibus. Morbi ultricies vel dolor eget iaculis. Proin quis elit nulla. Curabitur eget risus quis ante placerat hendrerit. Maecenas interdum elementum tellus sit amet volutpat. Maecenas ut mi fringilla, ultrices arcu semper, mattis diam. Etiam et ipsum dapibus, laoreet magna eget, aliquam orci.Fusce viverra purus urna, eu tincidunt dolor fringilla quis. Pellentesque ultrices enim ipsum. Aenean eros sapien, dictum in ullamcorper in, tempus et nisi. Morbi eu vehicula risus, eu feugiat purus. Pellentesque sit amet metus id arcu iaculis lacinia vitae ut turpis. Nam nisl ipsum, ullamcorper sit amet finibus vel, finibus eu mauris. Donec congue ante eget dignissim tempor. Morbi in ligula et sem laoreet posuere. Sed rhoncus lacus ex. Nam consectetur eleifend elit, in elementum felis. Praesent libero quam, consectetur in fermentum ut, viverra in tortor. Sed bibendum, augue nec faucibus efficitur, risus lorem condimentum diam, non feugiat nisl magna et massa. Sed ultricies luctus interdum. Aliquam posuere porta ante a iaculis."



newStr = str.split(' ');
console.log(newStr.length);

let total = [];
for (i = 0; i < newStr.length; i++) {
if (newStr[i] === "et") {
total.push(newStr[i])


}
}

console.log(total.length);




let phraseToCheck = "A man, a plan, a canal, Panama!"

let newPhrase = phraseToCheck.split('');
reversePhrase = newPhrase.reverse();
joinPhrase = reversePhrase.join('');

if (joinPhrase === phraseToCheck) {
console.log(`This is a palindrome`)
}

else {
console.log(`This is not a palindrome`)
}








// 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](https://en.wikipedia.org/wiki/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".

// __Hint__: If you use Google to help you to find solution to this iteration, you might run into some solutions that use advanced string or array methods (such as _join()_, _reverse()_, etc.). However, try to apply the knowledge you currently have since you can build pretty nice solution with just using `for` loop, `if-else` statements with some `break` and `continue`... Just sayin' :smiley:
Morty Proxy This is a proxified and sanitized view of the page, visit original site.