JavaScript String includes function

String includes is a function introduced to JavaScript in Escmascript 'es6' that returns a boolean true , or false based on the evaluation whether or not a string contains the string passed as an argument to the function
For example;

const str = "John swana"
// true

// false

Running string includes testing whether 'John swana' includes John returns trues as it's a fact.

Running the same string against duke returns false duke is not part of the string 'str'


Popular posts from this blog

What is 'this.' keyword in JavaScript

How to get user's ip address in JavaScript

How to create promises in JavaScript

How to make a static http server in nodejs using express

How to create zip archives in nodejs