Skip to content

Instantly share code, notes, and snippets.

@sonichandni
Last active February 24, 2022 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonichandni/06e891a752b382d2da033c87307f1fc1 to your computer and use it in GitHub Desktop.
Save sonichandni/06e891a752b382d2da033c87307f1fc1 to your computer and use it in GitHub Desktop.
// find sub string
const string = "foo";
const substring = "oo";
console.log(string.includes(substring)); // true
// replace string
let text = "Visit Microsoft!";
let result = text.replace("Microsoft", "W3Schools");
//regex for height
var regex = /\d\'\d\'\'/; //Example: 5'7''
var regex1 = /\d\'\d\d\'\'/; //Example: 5'11''
if (regex.test(height) === true || regex1.test(height) === true ) {
new_height = height;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment