Includes Method

Snippets Listjavascriptstringarray

str.includes()

The includes() method determines whether a string contains the characters of a specified string.

let str = "Hello world, welcome to the universe.";
let n = str.includes("world");

array.includes()

The includes() method determines whether a array contains specified element.

let fruits = ["Banana", "Orange", "Apple", "Mango"];
let n = fruits.includes("Mango");

Where I do my experimentalAHHHRT

Go