Skip to content

labweek3 #8

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions js/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="index.js"></script>
</head>
<body>

</body>
</html>
35 changes: 34 additions & 1 deletion js/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@

console.log("!Estoy listo¡")

// Iteration 1: Names and Input
//

let hacker1 = "Peter";
console.log("El nombre del conductor es: ", hacker1);

let hacker2 = "Bob";
console.log("El nombre del navegante es:", hacker2);



// Iteration 2: Conditionals

if (hacker1.length > hacker2.length) {
console.log(`El conductor tiene el nombre más largo, tiene ${hacker1.length} caracteres.`);
} else if (hacker1.length < hacker2.length) {
console.log(`Parece que el navegante tiene el nombre más largo, tiene ${hacker2.length} caracteres.`);
} else {
console.log(`¡Vaya, ambos tienen nombres igual de largos, ${hacker1.length} caracteres!`);
}


// Iteration 3: Loops

const formattedHacker1 = hacker1.toUpperCase().split('').join(' ');
console.log(`Nombre del conductor en mayúsculas y separado por espacios: ${formattedHacker1}`);

const reversedHacker2 = hacker2.split('').reverse().join('');
console.log(`Nombre del navegante en orden inverso: ${reversedHacker2}`);

if (hacker1 < hacker2) {
console.log("El nombre del conductor va primero.");
} else if (hacker1 > hacker2) {
console.log("Yo, el navegante va primero definitivamente.");
} else {
console.log("¿Qué? ¿Los dos tienen el mismo nombre?");
}