QP School
Check if an array contains a number in JavaScript - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: JavaScript Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=6)
+--- Thread: Check if an array contains a number in JavaScript (/showthread.php?tid=4072)



Check if an array contains a number in JavaScript - Qomplainerz - 04-04-2023

// Check if an array contains a number

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

let result = ratings.includes(4);

document.write(result);