How to check if a string contains a substring in JavaScript

Опубликовано: 12 Октябрь 2024
на канале: Read Write Exercise
830
9

There are two simple methods for checking if a string contains a substring in JavaScript. In this video I touch on using the ES6 method of includes, which may not work with Internet Explorer, as well as the slightly more reliable method of indexOf. Both of these will be helpful when doing string comparisons in JS.

In this playlist
Part 1:    • How to Flatten an Array in JavaScript  
Part 2:    • How to remove an element from a JavaS...  
Part 3:    • How to check if a string contains a s...  
Part 4:    • Slice vs splice JavaScript array methods