Online HTML Editor
Javascript Online Compiler
index.html
Change Theme
Compress code
Uncompress code
Download Code
Clear Code
Copy Code!
RunĀ
Click to run or ctrl+s
Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Article - JavaScript toUpperCase method 4</title> </head> <body> <h2><code>toUpperCase</code> method: used to capitalize the string in JavaScript.</h2> <p>Capitalizing first letter of the sentence.</p> <p>Press <kbd>F12</kbd> to open the console and see the output of the program.</p> <script> var string = "to do or not to do"; // capitalizing the first letter var capString = string.charAt(0).toUpperCase() + string.slice(1); console.log(capString); </script> </body> </html>
RunĀ