Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

167
Visualizações
Did I break the console with my range function?

range = (arg1, arg2, arg3) => {
    let arr = [];
    let min = Math.min(arg1, arg2);
    if (arg3 != undefined) {
        // let i = min;
        while (min <= Math.max(arg1, arg2)) {
            min += arg3;
            arr.push(min);
        }
    } else {
        for (let i = min; i <= Math.max(arg1, arg2); i++) {
            arr.push(i);
        }
    } 
    return arr;
}

console.log(range(1, 10));
// → [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
console.log(range(5, 2, -1));
// → [5, 4, 3, 2]
// console.log(sum(range(1, 10)));
// → 55


// sum = (arr) => {
//     let sum = 0;
//     for (let numbs of arr) {
//         sum += numbs;
//     }
//     return sum;
// }

// console.log(sum(range(1,10)));
// // 55

I really can't see where I went wrong with this. What's wrong here exactly??

And what's up with the cryptic error messages:

#
# Fatal error in , line 0
# Fatal JavaScript invalid size error 169220804
#
#
#
#FailureMessage Object: 0000009A0CAFE560
 1: 00007FF7D71E815F v8::internal::CodeObjectRegistry::~CodeObjectRegistry+114079
 2: 00007FF7D710343F std::basic_ostream<char,std::char_traits<char> >::operator<<+65023
 3: 00007FF7D7DE2EE2 V8_Fatal+162
 4: 00007FF7D7966D35 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArray+101
 5: 00007FF7D78271B2 v8::debug::Script::GetIsolate+16706
 6: 00007FF7D769A9A1 v8::internal::CompilationCache::IsEnabledScriptAndEval+26913
 7: 00007FF7D7B39701 v8::internal::SetupIsolateDelegate::SetupHeap+494417
 8: 00000239C87C9080

Please someone help me, I feel like I am blind, I can't begin to comprehend whether there's even any errors in this function.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda