I have JavaScript Array that store String variable in it. I have tried below code that help me to convert Javascript variable to uppercase letter,
<html>
<body>
<p id="demo"></p>
<button onclick="toUppar()">Click Here</button>
<script>
Array.prototype.myUcase=function()
{
for (i=0;i<this.length;i++)
{
this[i]=this[i].toUpperCase();
}
}
function toUppar()
{
var numArray = ["one", "two", "three", "four"];
numArray.myUcase();
var x=document.getElementById("demo");
x.innerHTML=numArray;
}
</script>
</body>
</html>
but i want to convert only first character of Javascript Variable to Upper case.
Desired output : One,Two,Three,Four