Check if All Values Are True

Published by Deep Xavier in

Write a function that returns true if all parameters are truthy, and false otherwise.

Examples

allTruthy("t", "te", "tes", "tesh", "tesha") ➞ true

allTruthy(true, true, true) ➞ true

allTruthy(true, false, true) ➞ false

allTruthy(5, 4, 3, 2, 1, 0) ➞ false

Notes

  • Falsy values include false, 0, "" (empty string), null, POSITIVE_INFINITY, NEGATIVE_INFINITY and NaN, everything else is truthy.
  • At least one parameter will be given.
Watch a quick demo on how Edabit works.