const arr = [10, 20, 30];
arr.includes(20); // true
arr.includes(99); // falseArray.includes() is a built-in linear search that returns a boolean.
This exercise focuses on checking if an element exists in an array without needing its index. This is useful when you only care about presence, not location.
function elementExists(arr: number[], target: number): boolean {
// Return true if target exists in arr, false otherwise
}
elementExists([10, 20, 30], 20) // true
elementExists([10, 20, 30], 99) // false