Capitalize a string

PHOTO EMBED

Wed Jan 05 2022 11:22:08 GMT+0000 (Coordinated Universal Time)

Saved by @desiboli ##javascript ##js

const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1)
capitalize("follow for more")
// Result: Follow for more
content_copyCOPY

Javascript doesn’t have an inbuilt capitalize function, so we can use the following code for this purpose.

https://blog.devgenius.io/15-javascript-codes-you-will-always-need-e8569903dd1