How to capitalize first letter in JavaScript

Strings
By Jad Joubran · 
Last updated Dec 26, 2018
let str = "welcome to code to go";

str = str[0].toUpperCase() + str.substring(1);
Welcome to code to go