Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

381
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!