Add Color on the first letter of each word

by Devbuddy Developer

HTML

<h1 id="heading">
The heading text here
</h1>

JavaScript

window.onload = (event) => {
	const headingTxt = document.getElementById('heading').innerText;
	const headingM = bTitleTxt.match(/\b(\w)/g);
	const headingTxtJ = bTitleM.join('');

	for(let i=0; i < headingTxtJ.length; i++){
		headingTxtJ[i].style.color = 'red';
	}
}