-4
var fullnames =["george bush","barrack obama","donald trump"] 

and return

var fullNames =["George Bush","Barrack Obama","Donald Trump"] 
Rajesh
  • 24,354
  • 5
  • 48
  • 79
  • What about `George walker bush`? – Rajesh Dec 22 '16 at 11:18
  • Have you tried anything to solve the problem yourself? – lxg Dec 22 '16 at 11:19
  • 3
    Possible duplicate of [Convert string to title case with javascript](http://stackoverflow.com/questions/196972/convert-string-to-title-case-with-javascript) – Rajesh Dec 22 '16 at 11:20
  • Explode each string individually using space as a delimiter, make the first letter caps for each of the new strings and recombine. Also dupe. – ZombieTfk Dec 22 '16 at 11:26

1 Answers1

0
["george bush","barrack obama","donald trump"].map(function(name){return name.replace(/\b\w/g, function(firstLetter){return firstLetter.toUpperCase()})})
lhl
  • 26
  • 2