JS Strings

String Basics

Strings can be defined with single quotes, double quotes, or template literals:`Hello ${name}`.

Common String Methods

  • length
  • concat
  • includes
  • slice

Examples

const str = 'Hello';
console.log(str.length);
console.log(str.concat(' World'));
console.log(str.includes('ell'));
console.log(str.slice(1,4));