• includes()

    • Description: Checks if a string contains a specified value, returning true or false.

    • Example:

      let str = 'Hello, World!';
      console.log(str.includes('World')); // Output: true
      
      
  • indexOf()

    • Description: Returns the position of the first occurrence of a specified value in a string.

    • Example:

      let str = 'Hello, World!';
      console.log(str.indexOf('World')); // Output: 7
      
      
  • lastIndexOf()

    • Description: Returns the position of the last occurrence of a specified value in a string.

    • Example:

      let str = 'Hello, World! Hello!';
      console.log(str.lastIndexOf('Hello')); // Output: 14
      
      
  • startsWith()

    • Description: Checks if a string starts with a specified value.

    • Example:

      let str = 'Hello, World!';
      console.log(str.startsWith('Hello')); // Output: true
      
      
  • endsWith()

    • Description: Checks if a string ends with a specified value.

    • Example:

      let str = 'Hello, World!';
      console.log(str.endsWith('!')); // Output: true