JSFiddle - React, Tailwind, and code Playground
JavaScript
// Initialize variable 'a'
var a = 'a,b,c,d,e,f,g';
// Define function capitalize
function capitalize(str) {
var c = str.charCodeAt(0);
if (97 <= c && c<= 122) c-=32 // http://www.ascii-code.com/
return String.fromCharCode(c) + str.slice(1)
// return str.charAt(0).toUpperCase() + str.slice(1)
}
// Remove all the commas and get the second element of the new string
var b = a.replace(/,/g, '').slice(1,2);
console.log(b);
// Capitalize the element
var results = capitalize(b);
console.log(results);