File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ <!DOCTYPE HTML>
2+ < html >
3+ < head >
4+ < title > My Programs in JavaScript </ title >
5+ < script >
6+
7+ function captwords ( ) {
8+
9+ var fs = "" ;
10+ var list = "z6amTPcq z1UiI 6sS0DNaXdzwszSsLw4W8JxsDIH5LXPPQ" + "<br>" + "VfTuw5dIL9QyUP bMuP JWkasF GE9jhXLo9lnAbPfYoH" ;
11+ list . split ( "\n" ) . forEach ( function ( line ) {
12+ if ( line !== "" ) {
13+ var words = line . split ( " " ) ;
14+ for ( var i = 0 ; i < words . length ; ++ i ) {
15+ var letter = words [ i ] [ 0 ] ;
16+
17+ if ( letter <= 'z' && letter >= 'a' ) {
18+ letter = String . fromCharCode ( letter . charCodeAt ( ) - 32 ) ;
19+ }
20+
21+ //alert("Caught: "+" \n "+letter+" in "+words[i]);
22+ fs = fs + letter + words [ i ] . substr ( 1 ) + " " ;
23+ }
24+
25+ fs = fs + "<br>" ;
26+ }
27+
28+ } ) ;
29+
30+ document . getElementById ( "demo" ) . innerHTML = "Input: " + "<br>" + list ;
31+ document . getElementById ( "result" ) . innerHTML = "Results: " + "<br>" + fs ;
32+ }
33+ </ script >
34+ </ head >
35+
36+ < body >
37+
38+
39+ < p id ="demo "> Result</ p > < br > < br >
40+ < p id ="result "> Answer</ p >
41+
42+ < button type ="button " onclick ="captwords() "> My Capitalize Words function!</ button >
43+
44+ </ body >
45+
46+
47+ </ html >
You can’t perform that action at this time.
0 commit comments