QP School

Full Version: Check if an array contains a number 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 number

const ratings = [1, 2, 3, 4, 5];

let result = ratings.includes(4);

document.write(result);