Strings have their own built-in variables and functions, also known as properties and methods. Here are some of the most common ones.
A string’s length property keeps track of how many characters it has.
// Example "caterpillar".length; // Output 11
// Example "THE KIDS".toLowerCase(); // Output "the kids"
A string’s toUpperCase method returns a copy of the string with its letters converted to capitals. Numbers, symbols, and other characters are not affected.
A string’s trim method returns a copy of the string with beginning and ending whitespace characters removed.
// Example " but keep the middle spaces ".trim(); // Output "but keep the middle spaces"