Skip to content

done #13

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 1 commit into
base: master
Choose a base branch
from
Open

done #13

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 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="./js/index.js"
</head>
<body>

</body>
</html>
37 changes: 33 additions & 4 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
// Iteration 1: Names and Input
//
// Iteration 2: Conditionals
let hacker1 = "Javi";
let conductor = `El nombre del controlador es ${hacker1}`;
console.log(conductor);

let hacker2 = "Berto";
let navegante = `El nombre del navegante es ${hacker2}`;
console.log(navegante);

// Iteration 3: Loops
// console.log(hacker1.length)
// console.log(hacker2.length)

if (hacker1.length >= hacker2.length) {
console.log(
`El conductor tiene el nombre más largo, ${hacker1.length} tiene 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!`
);
}

console.log(hacker1.toUpperCase().split(""));
console.log(hacker2.split("").reverse());

let v1 = "El nombre del conductor va primero.";
let v2 = "Yo, el navegador va primero definitivamente.";
let v3 = "¿Qué? ¿Los dos tienen el mismo nombre?";

let cadenas = [v1, v2, v3];
cadenas.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
console.log(cadenas);