Advertisement
728x90
You can use the test() method of regular expression in order to search a string for a pattern, and return true or false depending on the result.
javascript
1var pattern = /you/;
2
3console.log(pattern.test("How are you?")); //trueAdvertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 75
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
160of476