-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[PTREMOTEES] Naiim Taefy #3840
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
base: master
Are you sure you want to change the base?
[PTREMOTEES] Naiim Taefy #3840
Conversation
sum += number.length; | ||
break; | ||
case "object": | ||
case "array": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case "array": |
Entiendo que lo hayas puesto pero si sacas por consola el typeof de un array te dira que es un object, cositas de javascript que estan "mal" jejejeje
let sum = 0; | ||
for (const number of numbers) { | ||
sum += number; | ||
} | ||
const result = numbers.length > 0 ? sum / numbers.length : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let sum = 0; | |
for (const number of numbers) { | |
sum += number; | |
} | |
const result = numbers.length > 0 ? sum / numbers.length : null; | |
const result = numbers.length > 0 ? sum(numbers) / numbers.length : null; |
Aplicando lo que has puesto esto seria interesante no?, así te ahorras poner el bucle que ya esta puesto en otro lado! :D
let sum = 0; | ||
for (const word of wordsArr) { | ||
sum += word.length; | ||
} | ||
const result = wordsArr.length > 0 ? sum / wordsArr.length : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let sum = 0; | |
for (const word of wordsArr) { | |
sum += word.length; | |
} | |
const result = wordsArr.length > 0 ? sum / wordsArr.length : null; | |
const result = wordsArr.length > 0 ? sum(wordsArr) / wordsArr.length : null; |
Mas de lo mismo no?
let sum = 0; | ||
for (const mixArr of mixArrs) { | ||
if (typeof mixArr === "string") { | ||
// sum += !Number.isNaN(Number(mixArr)) ? Number(mixArr) : mixArr.length; | ||
sum += mixArr.length; | ||
} else { | ||
sum += Number(mixArr); | ||
} | ||
} | ||
const result = mixArrs.length > 0 ? sum / mixArrs.length : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let sum = 0; | |
for (const mixArr of mixArrs) { | |
if (typeof mixArr === "string") { | |
// sum += !Number.isNaN(Number(mixArr)) ? Number(mixArr) : mixArr.length; | |
sum += mixArr.length; | |
} else { | |
sum += Number(mixArr); | |
} | |
} | |
const result = mixArrs.length > 0 ? sum / mixArrs.length : null; | |
const result = mixArrs.length > 0 ? sum(mixArrs) / mixArrs.length : null; |
And again and again... :D
Naaah!! perfecto tio de verdad super bien hecho y encima haciendo el de la matriz que es complejo, bien bien!!! sigue asi!! |
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. |
No description provided.