README.md 929 B

Check if an Array Contains a Given Number

by Helen Yu tags: arrays, validation, language_fundamentals

Summary

Write a function 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 Solution

Instructions

Write a function 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.