DeveloperBreeze

JavaScript Check if Array Contains Element

// Array to check
let array = [1, 2, 3, 4, 5];

// Element to check for in the array
let element = 3;

// Check if the array contains the specified element
let containsElement = array.includes(element);

// Display the result
console.log('Array Contains Element:', containsElement);

Continue Reading

Handpicked posts just for you — based on your current read.

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!