How do i capitalize the first letter of each sentance in Javascript?
(I am creating a tool that would convert first letter of each sentance to upparcase(Sentance Case) on click in reactjs)
I want output like this,
How do i capitalize the first letter of each sentance in Javascript? How do i capitalize the first letter of each sentance in Javascript? How do i capitalize the first letter of each sentance in Javascript? How do i capitalize the first letter of each sentance in Javascript?
I am trying this but looks wrong,
let newText = text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
let result = newText.map((val) => val);
setText(result);