Strings 5/5
Changing Cases of String Variables
In JavaScript, we can convert lower-case string values to upper-case and vice versa. To convert lower-case string to upper-case we use the method toUpperCase() while the method toLowerCase() is for converting string into lower-case. Let’s look at an example.
12console.log('JavaScript'.toUpperCase()); console.log('JavaScript'.toLowerCase());
Swipe to start coding
The titles of the books are usually written in upper-case. In the code below, a variable named bookTitle with the value Think and grow rich has been given to you. Your task is to display the value of the above variable in the upper-case.
Solución
Summary:
- In JavaScript, we can declare string variables in three ways, single-quotes, double-quotes, and backticks.
- We can use different kinds of special characters like
\nis a special character used for entering a new line. - To get a character at a position we , use:
[]or.charAt(). - The
toLowerCase()andtoUpperCase()are the methods for converting cases in JavaScript.
¡Gracias por tus comentarios!
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Awesome!
Completion rate improved to 2
Strings 5/5
Desliza para mostrar el menú
Changing Cases of String Variables
In JavaScript, we can convert lower-case string values to upper-case and vice versa. To convert lower-case string to upper-case we use the method toUpperCase() while the method toLowerCase() is for converting string into lower-case. Let’s look at an example.
12console.log('JavaScript'.toUpperCase()); console.log('JavaScript'.toLowerCase());
Swipe to start coding
The titles of the books are usually written in upper-case. In the code below, a variable named bookTitle with the value Think and grow rich has been given to you. Your task is to display the value of the above variable in the upper-case.
Solución
Summary:
- In JavaScript, we can declare string variables in three ways, single-quotes, double-quotes, and backticks.
- We can use different kinds of special characters like
\nis a special character used for entering a new line. - To get a character at a position we , use:
[]or.charAt(). - The
toLowerCase()andtoUpperCase()are the methods for converting cases in JavaScript.
¡Gracias por tus comentarios!
single