* chore(i8n,learn): processed translations * fix: restore deleted test * fix: revert casing change Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
1.1 KiB
1.1 KiB
id, title, challengeType, forumTopicId, dashedName
id | title | challengeType | forumTopicId | dashedName |
---|---|---|---|---|
adf08ec01beb4f99fc7a68f2 | Rebote falsy | 5 | 16014 | falsy-bouncer |
--description--
Quita todos los valores falsos de un arreglo.
Los valores falsos en JavaScript son false
, null
, 0
, ""
, undefined
y NaN
.
Sugerencia: Intenta convertir cada valor a booleano.
--hints--
bouncer([7, "ate", "", false, 9])
debe devolver [7, "ate", 9]
.
assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9]);
bouncer(["a", "b", "c"])
debe devolver ["a", "b", "c"]
.
assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c']);
bouncer([false, null, 0, NaN, undefined, ""])
debe devolver []
.
assert.deepEqual(bouncer([false, null, 0, NaN, undefined, '']), []);
bouncer([null, NaN, 1, 2, undefined])
debe devolver [1, 2]
.
assert.deepEqual(bouncer([null, NaN, 1, 2, undefined]), [1, 2]);
--seed--
--seed-contents--
function bouncer(arr) {
return arr;
}
bouncer([7, "ate", "", false, 9]);
--solutions--
function bouncer(arr) {
return arr.filter(e => e);
}
bouncer([7, "ate", "", false, 9]);