Check if an Array Contains a Given Number

Published by Bjarte in

Write a method to check if an array contains a particular number.

Examples

Check([1, 2, 3, 4, 5], 3) ➞ true

Check([1, 1, 2, 1, 1], 3) ➞ false

Check([5, 5, 5, 6], 5) ➞ true

Check([], 5) ➞ false

Notes

  • Don't forget to return the result.
  • If you get stuck on a challenge, find help in the Resources tab.
  • If you're really stuck, unlock solutions in the Solutions tab.
Watch a quick demo on how Edabit works.