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.

  1. Check if the codes array currently holds the secretKey.
  2. Return the boolean result (true or false).

01EXAMPLE 1

Inputcodes = [123, 456], secretKey = 123
Outputtrue

Constraints

  • Return a boolean value.
FundamentalsArraysSearch
JavaScript
Loading...
3 Hidden

Input Arguments

codes[10,20]
secretKey10

Expected Output

true

Click RUN to test your solution