Digital Lifestyle

Tag: string

Javascript string in (includes)

Here a quick example how in javascript the includes function on an string works. In other programming language its also known as “in” or “contains” function.

var data = "Hello world, here is some test string to show the includes method.";
if(data.includes("test")) {
	console.log("The string includes test");
}

Output:

The string includes test

JS multiline string

In Javascript you can create an multiline string with the following char: `

var exampleVariable = `Here is a text,
over multiple lines in JS (Javascript).
Some another stuff here.`;

© 2021 Jannik Strelow

Theme by Anders NorenUp ↑