Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

make first letter capital

const names = ["alice", "bob", "charlie", "danielle"]
// -->        ["Alice", "Bob", "Charlie", "Danielle"]

//Just use some anonymous function and iterate through each of the elements in the array
//and take string as another array
let namescap = names.map((x)=>{
    return x[0].toUpperCase()+x.slice(1)
    
})
console.log(namescap)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #letter #capital
ADD COMMENT
Topic
Name
8+9 =