← JavaScript

String Methods

Returns a new string with all letters converted to uppercase.

Understanding String Methods in JavaScript

What it does: toLowerCase() returns a new string with all lowercase letters. trim() cleans up whitespace at the start and end of a string. toUpperCase() converts every letter to uppercase in a new string. JavaScript uses camelCase, so it must be toUpperCase. Without (), the method isn't actually called. JavaScript is case-sensitive, so it must be lowercase 'trim'. JavaScript's built-in method is toUpperCase(), not touppercase().

Common mistakes: 'trim' must be lowercase - a capital T causes an error. Method names are camelCase - it should be toUpperCase, not touppercase.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 21–30) and word search (Modules 21–52).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Does toUpperCase() return a new string in all caps?
YesNo
Matches
text.touppercase()
↓
Wrong - method names are camelCase: toUpperCase
Applying
Meanings
Term
toUpperCase()
Meaning
Returns a new string with all letters converted to uppercase.
Practice
let name = " Sam ";
Testing
Gaps
console.log(name.());
Check Answer
Spots
1let a = " hi ";
2console.log(a.Trim());

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Sea Dragon' badge — OOP Pioneer, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Does toUpperCase() return a new string in all caps?
A. Yes ✓
B. No
toUpperCase() converts every letter to uppercase in a new string.
2. Does toLowerCase() change the original string?
A. No ✓
B. Yes
toLowerCase() returns a new string - the original stays the same.
3. Does trim() remove whitespace from the start and end?
A. Yes ✓
B. No
trim() strips leading and trailing whitespace from a string.
4. Is 'touppercase' with no capitals valid JavaScript syntax?
A. Yes
B. No ✓
JavaScript uses camelCase, so it must be toUpperCase.
5. Do these string methods need parentheses to be called?
A. No
B. Yes ✓
Without (), the method isn't actually called.

Match the Pairs

name.toUpperCase() → Returns name in all uppercase letters
name.trim() → Returns name with whitespace removed from both ends
Converts every letter of a string to lowercase → text.toLowerCase()
Removes leading and trailing whitespace from a string → input.trim()
text.touppercase() → Wrong - method names are camelCase: toUpperCase
text.Trim() → Wrong - 'trim' must start with a lowercase t

Key Term

toUpperCase()
Returns a new string with all letters converted to uppercase.

Fill in the Blanks

1. console.log(name.toUpperCase());
Hint: Type the method that converts a string to all uppercase.
2. console.log(name.toLowerCase());
Hint: Type the method that converts a string to all lowercase.
3. console.log(name.trim());
Hint: Type the method that removes whitespace from both ends.
4. let upper = word.toUpperCase();
Hint: Type the method that converts a string to all uppercase.
5. let trimmed = input.trim();
Hint: Type the method that removes whitespace from both ends.

Spot the Error

Question 1
A let a = " hi ";
B console.log(a.Trim());
C console.log(a);
Line B — 'trim' must be lowercase - a capital T causes an error.
Question 2
A let b = "Hi";
B console.log(b.touppercase());
C console.log(b);
Line B — Method names are camelCase - it should be toUpperCase, not touppercase.
Question 3
A let f = "Hi";
B console.log(f);
C console.log(f.toUpperCase);
Line C — Missing parentheses - toUpperCase() needs to be called.
Question 4
A console.log(g.trim);
B let g = " hi ";
C console.log(g);
Line A — Missing parentheses - trim() needs to be called.
Question 5
A let h = "Hi";
B console.log(h.toUpperCase());
C console.log(h);
D console.log(h.touppercase());
Line D — Method names are camelCase - it should be toUpperCase, not touppercase.

Student with a class code? Join your class →