Skip to content
Justice Tech School

Trim, Pad, Repeat and Case

trim removes spaces at the ends, padStart and padEnd fill to a length, repeat repeats and toUpperCase and toLowerCase change case.

Example
console.log("[" + "  hi  ".trim() + "]");
console.log("7".padStart(3, "0"), "ab".padEnd(5, "."), "ha".repeat(3));
console.log("Hello".toUpperCase(), "Hello".toLowerCase());

Exercise

Pad with zeros at the start.

"7".(3, "0")

Quiz Test

Which removes surrounding spaces?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.