xxxxxxxxxx
import React from 'react';
function CheckArrayItems() {
const myArray = [1, 2, 3, 4, 5];
const itemToCheck = 3;
const isItemInArray = myArray.includes(itemToCheck);
return (
<div>
<p>{isItemInArray ? 'Item found in array!' : 'Item not found in array!'}</p>
</div>
);
}
export default CheckArrayItems;