True Ones, False Zeros

Published by Deep Xavier in

Create a function that returns an array of booleans from a given number by iterating through the number one digit at a time and appending true into the array if the digit is 1 and false otherwise.

Examples

integerBoolean("100101") ➞ [true, false, false, true, false, true]

integerBoolean("10") ➞ [true, false]

integerBoolean("001") ➞ [false, false, true]

Notes

Expect numbers with 0 and 1 only.

Watch a quick demo on how Edabit works.