<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Arrays</h1>
<h2>The includes() Method</h2>
<p>includes() returns true if an array contains a specified element:</p>
<p id="workingcode"></p>
<script>
const fruits = ["Java", "ServiceNow", "PHP", "JavaScript", "Angular"];
document.getElementById("workingcode").innerHTML = fruits.includes("ServiceNow");
</script>
</body>
</html>
Output:
JavaScript Arrays
The includes() Method
includes() returns true if an array contains a specified element:
true
includes() returns true if an array contains a specified element
admin Changed status to publish December 19, 2023