QP School

Full Version: Check if an array contains a string in JavaScript
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
// Check if an array contains a string

const colors = ['red', 'green', 'blue'];
const result = colors.includes('red');

document.write(result);