Created
August 17, 2023 15:54
-
-
Save suhailgupta03/558b7eda07fd34acc1dc5bc80a2a2f3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let string = `Hi! Recently India celebrated its | |
Independence Day` | |
// If we want to know if the string ends with a particular | |
// word / character or not | |
// we can use the $ sign to check if the string ends with | |
// a particular word or not | |
// Like we have ^ to check if the string starts with a character / word | |
// we have $ to check if the string ends with a character / word | |
let pattern = /day$/i | |
console.log(pattern.test(string)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment