Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

PTWD BCN 12/19 - ELENA LUCAS#605

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
elucserr wants to merge5 commits intoironhack-labs:masterfromelucserr:master
Closed
Show file tree
Hide file tree
Changes fromall 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
Binary file added.DS_Store
View file
Open in desktop
Binary file not shown.
45 changes: 44 additions & 1 deletionjs/index.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,50 @@
// Iteration 1: Names and Input
let hacker1 = "Elena";
console.log("The driver's name is " + hacker1);

let hacker2 = "Chrome";
console.log("The navigator's name is " + hacker2);

// 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.");
} else if (hacker1.length = hacker2.length) {
console.log("Wow, you both have equally long names, " + hacker1.length + " characters!")
}

// Iteration 3: Loops
let spaceName = ' ';
for (let i = 0; i < hacker1.length; i++) {
spaceName =spaceName + hacker1[i].toUpperCase() + ' ';
}
console.log(spaceName)

// Iteration 3: Loops
let reverseName = '';
for(let i = hacker2.length -1; i >= 0; i--) {
reverseName = reverseName + hacker2[i];
}
console.log(reverseName);

let orderName = hacker1.localeCompare(hacker2);
if(orderName === -1) {
console.log("The driver's name goes first.")
} else if (orderName === 1){
console.log("Yo, the navigator goes first definitely.")
}else if (orderName === 0){
console.log("What?! You both have the same name?")
}


// Bonus 1
const lorem= "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sodales id erat non ultricies. Aenean interdum velit sed posuere ultricies. Phasellus eu mi odio. Duis interdum mattis urna eget rutrum. Morbi ac felis mattis, suscipit arcu vel, euismod dui. Vivamus a dui euismod sapien posuere sagittis vel in nibh. Vivamus interdum velit ut interdum sagittis. Ut egestas fringilla dapibus.Maecenas tempor nibh sed turpis vestibulum, eu molestie leo aliquet. Nulla ultricies ante vitae nibh vulputate, ut rhoncus augue luctus. Donec convallis lacinia urna a congue. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tincidunt lectus diam, tempus consequat nibh vehicula a. Nunc at nunc massa. Donec non lobortis tellus. Nam justo quam, placerat id feugiat nec, accumsan id dolor. Vivamus ante ipsum, congue nec ex vel, ornare luctus massa.Aliquam ac ligula non libero vulputate tempus. Vivamus eu luctus ex. Donec vel lectus vulputate, scelerisque est ac, varius ante. Morbi ultrices mattis mi, sed tincidunt lectus. Nulla lectus justo, pulvinar ac dolor ut, congue dictum eros. Donec sit amet semper mi, sed tincidunt tortor. Vestibulum mattis ligula sit amet eros ullamcorper, sit amet laoreet nunc gravida. Integer id est eu leo auctor porta ac id elit. In sagittis eget sem sit amet scelerisque. Maecenas eu lacus quis lacus congue feugiat. Vestibulum non est arcu. Pellentesque sit amet imperdiet eros.";

function countOfWords(string) {
test= [];
test= string.split("");
console.log(`the number of words in the string is equal to ${test.length}`)
}
countOfWords (lorem);

// Bonus 2

[8]ページ先頭

©2009-2025 Movatter.jp