The Security Scanner
Easy+15 XP
Mission Briefing
The vault scanner needs to quickly verify if an ID badge matches any of the approved security codes. We don't care where it is, just if it is in the database.
The Concept: Searching Arrays
The .includes(item) method returns true if the item strictly exists anywhere in the array, and false if it doesn't. It's the cleanest way to check for basic presence without worrying about indexes.
The Objective
Your function receives an array codes and a secretKey.
- Check if the
codesarray currently holds thesecretKey. - Return the boolean result (
trueorfalse).
01EXAMPLE 1
Input
codes = [123, 456], secretKey = 123Output
trueConstraints
- Return a boolean value.
FundamentalsArraysSearch
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
codes[10,20]
secretKey10
Expected Output
true
Click RUN to test your solution