I want capitalize words in a string like...
Hello World, New York, First Name
...with JavaScript. But the trick is this I don't want to use any built-in JavaScript functions like toUpperCase
, split
, join
, etc. I have made one sample program but got stuck.
var myString = "Hello world!";
var myArray = [];
var out= ""
for (var i=0; i < myString.length; i++){
myArray.push(myString[i]);
if(myString[i] == " "){
continue;
}
alert(myString[i])
}
This doesn't use split
. I have converted my string in array
and then I search for a blank array with continue
.
Please don't recommend using CSS attributes such as text-transform:uppercase
. I know all these. I want to do this with JavaScript only.