Skip to content
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 .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
53 changes: 52 additions & 1 deletion starter-code/basic-algorithms.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,58 @@
// Names and Input
let hacker1 = 'Matias';
let hacker2 = '';

hacker2 = prompt('Write the name of the navigator')

console.log('The driver\'s name is ' + hacker1);

console.log('The navigator\'s name is ' + hacker2)

//Conditionals

if (hacker1.length > hacker2.length){
console.log('The Driver has the longest name, it has ' + hacker1 + ' characters');
} else if (hacker2.length > hacker1.length){
console.log('Yo, navigator got the longest name, it has ' + hacker2 + ' characters')
} else {
console.log('wow, you both got equally long names, ' + hacker1.length + ' characters!!');
}

//Loops
let driverName = [];
let driverNameReverse;
for(let i = 0; i < hacker1.length; i++){
driverName.push(hacker1[i])
}

driverNameReverse = driverName.reverse();
driverName = driverName.join(' ').toUpperCase();


console.log(driverName);

if(hacker1.localeCompare(hacker2) === -1){
console.log('The' + hacker1 + 'name goes first');
} else if (hacker1.localeCompare(hacker2) === 1) {
console.log('Yo, the ' + hacker2 + ' goes first definitely')
} else{
console.log('What?! You both got the same name?')
}

// Bunus

//Ingresa el mensaje en el prompt.
let palindrome = prompt('Wirte your messaje');
//Limpia el mensaje en el prompt quitando los espacios y caracteres especiales.
let cleanPalindrome = palindrome.replace(/[^A-Z0-9]/ig, "").toLowerCase();
//Escrible en revesa el palindromo para ser comparado.
let reversePalindrome = cleanPalindrome.split("").reverse().join("");;

console.log(cleanPalindrome);
console.log(reversePalindrome);

// Lorem ipsum generator
if(cleanPalindrome === reversePalindrome){
console.log('is a palindrome!');
} else {
console.log('isn\'t a palindrome');
}
14 changes: 14 additions & 0 deletions starter-code/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">

<head>
<title>Hello, world!</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>

<body>
<h1>Hello World</h1>
<script src="./basic-algorithms.js"></script>
</body>
</html>
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy