Skip to content

Instantly share code, notes, and snippets.

@tararoutray
Created August 31, 2021 15:36
Show Gist options
  • Save tararoutray/173fb059b0dd86cc06f953532a71d2e3 to your computer and use it in GitHub Desktop.
Save tararoutray/173fb059b0dd86cc06f953532a71d2e3 to your computer and use it in GitHub Desktop.
// String.includes()
// The includes() method returns true if a string contains a specified value, otherwise false.
let message = "The movie is yet to begin!";
message.includes("begin"); // This will return true.
// String.startsWith()
// The startsWith() method returns true if a string begins with a specified value, otherwise false.
let message = "The movie is yet to begin!";
message.startsWith("The"); // This will return true.
// String.endsWith()
// The endsWith() method returns true if a string ends with a specified value, otherwise false.
let message = "The movie is yet to begin!";
message.endsWith("begin!"); // This will return true.
message.endsWith("begin"); // This will return false.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment