Skip to content

Conversation

thsc47
Copy link

@thsc47 thsc47 commented May 24, 2021

Olá, boa noite!
Segue o lab JavaScript Functions and Arrays para avaliação!
Desde já agradeço

Copy link

@d-kunrath d-kunrath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mto bom Thiago! Gostei que usou até alguns métodos que vamos ver mais pra frente tb, como o reducee o filter! Vamos usá-los bastante!

Abaixo só uns pequenos pontos de atenção, mas ótimo trabalho!

function sum(arr){
let sum = 0;
if(arr.length === 0){
return null

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Olha a pegadinha do Jasmine!
Nesse aqui ele pede para que retorne 0, se o array vier vazio!

switch(typeof arr[i]){
case 'boolean':
if(arr[i]){sum +=1}
else{sum -=1}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E no caso, "false" pode ser considerado como 0 para a soma ;)


// Iteration #6: Find elements
const wordsFind = ['machine', 'subset', 'trouble', 'starting', 'matter', 'eating', 'truth', 'disobedience'];
function doesWordExist(arr, word){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aqui faltou só a condição de borda, array vazio.

@stale
Copy link

stale bot commented Jun 26, 2021

This pull request has been automatically marked as stale because it didn't have any recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 26, 2021
@stale
Copy link

stale bot commented Jun 28, 2021

This pull request is closed. Thank you.

@stale stale bot closed this Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants