0
0
Typescriptprogramming~5 mins

String manipulation types (Uppercase, Lowercase) in Typescript - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the toUpperCase() method do in TypeScript strings?
It converts all the letters in a string to uppercase letters. For example, "hello" becomes "HELLO".
Click to reveal answer
beginner
What is the purpose of the toLowerCase() method in TypeScript?
It changes all the letters in a string to lowercase letters. For example, "WORLD" becomes "world".
Click to reveal answer
beginner
How would you convert the string "TypeScript" to uppercase in TypeScript?
Use the code: "TypeScript".toUpperCase(). This returns "TYPESCRIPT".
Click to reveal answer
beginner
How do you convert a string to lowercase in TypeScript?
Call the toLowerCase() method on the string. For example, "HELLO".toLowerCase() returns "hello".
Click to reveal answer
intermediate
Are toUpperCase() and toLowerCase() methods destructive (do they change the original string)?
No, strings in TypeScript are immutable. These methods return a new string with the changes, leaving the original string unchanged.
Click to reveal answer
What will "hello world".toUpperCase() return?
A"HELLO world"
B"hello world"
C"Hello World"
D"HELLO WORLD"
Which method converts a string to all lowercase letters?
AtoLower()
BtoUpperCase()
CtoLowerCase()
DlowerCase()
If you run let s = "Test"; s.toUpperCase(); console.log(s);, what is printed?
A"Test"
B"TEST"
C"test"
DError
What type of value do toUpperCase() and toLowerCase() return?
AAn array
BA new string
CA number
DUndefined
Which of these is NOT true about toUpperCase() and toLowerCase()?
AThey change the original string.
BThey return a new string.
CThey work on string values.
DThey do not modify the original string.
Explain how to convert a string to uppercase and lowercase in TypeScript. Include what happens to the original string.
Think about string immutability and method names.
You got /4 concepts.
    Describe a real-life example where converting text to uppercase or lowercase might be useful in a program.
    Consider how computers treat letters differently by case.
    You got /4 concepts.