- Notifications
You must be signed in to change notification settings - Fork5.8k
[SAO-FT5-PP-W1D3]Bruno#486
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
Uh oh!
There was an error while loading.Please reload this page.
Closed
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
78 changes: 78 additions & 0 deletionsindex.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
console.log ("<------------------Nomes e Entrada------------------------->") | ||
/*Iteração 1: Nomes e Entrada*/ | ||
const hacker1 = "Bruno" | ||
console.log(`The driver's name is ${hacker1}`); | ||
const hacker2 = "Cardoso" | ||
console.log(`The navigator's name is ${hacker2}`); | ||
const contaHacker1 = hacker1.length; | ||
const contaHacker2 = hacker2.length; | ||
console.log ("<----------------------Condicionais------------------------>") | ||
/*Iteração 2: Condicionais*/ | ||
if (contaHacker1 < contaHacker2) { | ||
console.log(`Yo, navigator got the longest name, it has ${contaHacker2} characters`); | ||
} else if (contaHacker1 > contaHacker2) { | ||
console.log(`The Driver has the longest name, it has ${contaHacker1} characters`); | ||
} else { | ||
console.log(`Wow, you both got equally long names, ${contaHacker1} characters!`) | ||
} | ||
console.log ("<--------------------------Loops--------------------------->") | ||
/*Iteração 3: Loops*/ | ||
let hacker1Maiusculo = ' '; | ||
for (let i = 0; i < hacker1.length; i += 1) { | ||
hacker1Maiusculo += hacker1.charAt(i).toUpperCase() + ' '; | ||
} | ||
console.log(hacker1Maiusculo); | ||
let hackerInverso = ' '; | ||
for (let i = hacker2.length - 1; i >= 0; i -= 1) { | ||
hackerInverso += hacker2[i]; | ||
} | ||
console.log(hackerInverso) | ||
const nomeOrdem = hacker2.localeCompare(hacker1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. O padrão de código é sempre o Inlgês (boas práticas). | ||
if (nomeOrdem == 1) { | ||
console.log("The driver's name goes first.") | ||
} else if (nomeOrdem == -1) { | ||
console.log("Yo, the navigator goes first definitely.") | ||
} else { | ||
console.log("What?! You both got the same name?") | ||
} | ||
console.log ("<-------------------------Bônus---------------------------->") | ||
/*Bônus Time!*/ | ||
const textoIpsum = | ||
`Lorem Ipsum is simply dummy text of the printing and typesetting industry. | ||
Lorem Ipsum has been, the industry 's standard dummy text ever since et! the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. | ||
It has survived not only five, centuries but also the leap ET, inetet electronic typesetting, remaining essentially unchanged.`; | ||
const quantPalavras = textoIpsum.split(' ').length; | ||
console.log(quantPalavras); | ||
///pegar todos os "et" do texto, inclusive os que estão contidos em uma palavra. | ||
const letras = 'et'; | ||
const ipsumLowerCase = textoIpsum.toLowerCase(); | ||
let cont = 0; | ||
for (let i = 0; i < ipsumLowerCase.length; i++) { | ||
if (ipsumLowerCase.charAt(i) + ipsumLowerCase.charAt(i + 1) === letras) { | ||
cont++; | ||
} | ||
} | ||
console.log(cont); | ||
///Pega "et" que são palavras soltas. Está com expressão regular, não sei se poderia usar no exercício. | ||
const abc = textoIpsum.replace(/[\.,!()?-]/g, "").toLowerCase(); | ||
let final = abc.match(/ et /g).length; | ||
console.log(final); |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.