const services = ['Design', 'Dezvoltare', 'SEO'];
const hasSeo = services.includes('SEO');
console.log(hasSeo);SEO exists in the collection, so the result is true.
LESSON 39 OF 50
Check whether an array contains a specific value.
Array.prototype.includes compares elements with the searched value and returns a boolean.
const services = ['Design', 'Dezvoltare', 'SEO'];
const hasSeo = services.includes('SEO');
console.log(hasSeo);SEO exists in the collection, so the result is true.
const hasSeo = true;
console.log(hasSeo);The boolean is hard-coded and does not inspect the array elements.
Store services.includes(“SEO”) in hasSeo and print the result.
Run the code to see the result.The search is tied to the real collection, and the output reflects the method result.
ANALYSIS REQUEST
The initial discussion is without obligation. You receive an honest recommendation, suitable stages and the factors that affect price.