• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

169
Views
Where to put the .join in this function in order to rejoin the separated strings of an array

Problem to solve is to capitlize the first letter of each word in a string using '.split' '.map' and 'join'. Currently implemented split and map to get the word capitlised and rejoined it, but confused as to where I need to put the .join.

Expected: "The Lord Of The Rings"
Received: ["The", "Lord", "Of", "The", "Rings"]

function titleCase(string) {
  return string.split(' ').map(word => word.charAt(0).toUpperCase() + word.substr(1))
  

}

almost 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

First: split the string

Second: Capitalize word

Third: Join words

return string.split(' ').map(word => word.charAt(0).toUpperCase() + word.substr(1)).join(' ');
almost 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error