Skip to content

Lu Fernandez - LAB-JAVASCRIPT-BASIC-ALGORITHMS #2631

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 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Bonus 2 terminado
  • Loading branch information
LuCebreiro committed May 7, 2023
commit 83772f841f6f680145f575f63876447d4b013f9e
20 changes: 19 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,22 @@ for (let i = 0; i < longText.length; i++){

console.log(numberWords, latinWord);
/*cuenta los et, incluidos los que son palabra larga,
no solo los que tienen espacios*/
no solo los que tienen espacios*/

/*Create a new variable, phraseToCheck, containing some string value. Write a code to check if the value assigned to this variable is a Palindrome. Here are some examples of palindromes:*/

const phraseToCheck = prompt('Escribe la frase')
let result = ''
let resultReverse = ''

for (let i = 0; i < phraseToCheck.length; i++){
result = phraseToCheck[i].toLowerCase();
}
for (let i = phraseToCheck.length -1; i >=0; i--){
resultReverse = phraseToCheck[i].toLowerCase();
}
if (result === resultReverse){
console.log(`${phraseToCheck} is a Palindrome`)
}else {
console.log(`'${phraseToCheck}' is not a Palindrome`)
}