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

383
Visualizações
Why is charAt() not a function and newCase is undefined?

I'm working on some map() practice and am stuck. I am attempting to capitalize the first letter in each word.

I believe I am following the correct syntax for charAt() but it is getting word.charAt() is not a function.

const titleCased = () => {
    const cased = tutorials.map((string) => {
        return string.split(' ')
    })
    let newCase = cased.forEach((word) => {
        return word.charAt(0).toUpperCase() + word.slice(1)
    })
    return newCase
}

I'm not looking for an answer, I really wanna figure it out myself!

Hopefully someone can give me some tips though, when I run my debugger it completely skips past newCase as well.. I'm sure I a am misunderstanding my scope.

tutorials variable for ref.

const tutorials = [
    'what does the this keyword mean?',
    'What is the Constructor OO pattern?',
    'implementing Blockchain Web API',
    'The Test Driven Development Workflow',
    'What is NaN and how Can we Check for it',
    'What is the difference between stopPropagation and preventDefault?',
    'Immutable State and Pure Functions',
    'what is the difference between == and ===?',
    'what is the difference between event capturing and bubbling?',
    'what is JSONP?',
]

EDIT: Update

So this is where I've gotten, Phil(below) mentioned that my original forEach() funct now map() is doing nothing with the return value of the callback.

I am very new and doing my best, I'm struggling to understand how to relate the return value.

const titleCased = () => {
    const cased = tutorials.map((string) => {
        return string.split(' ')
    })
    let newCase = cased.map((word) => {
        return word[0].charAt(0).toUpperCase() + word[0].slice(1)
    })
    return newCase
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I finally did the thing

function titleCased() {
    const cased = tutorials.map((cb) => {
        const newCase = cb
            .split(' ')
            .map((word) => {
                return word.charAt(0).toUpperCase() + word.slice(1)
            })
            .join(' ')

        return newCase
    })
    return cased
}
about 4 years ago · Juan Pablo Isaza Relatório
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