Questions tagged [falsy]
19 questions
0
votes
0 answers
What's the difference between a value of a database field being 'empty' and the field not existing? Are both not falsy?
I have the following problem:
const barcodeValue = element.dataset.barcode;
// the above value is sent as an argument to be verified by the function below..
if(!barcodeValue){
// run code
}
now dataset.barcode comes from the database...…

Alim Bolar
- 479
- 4
- 17
-1
votes
1 answer
Remove Falsy values from array solved but not understood
I just solved this challenge on freecodecamp
Remove all falsy values from an array. Return a new array; do not mutate the original array.
Falsy values in JavaScript are false, null, 0, "", undefined, and NaN.
Hint: Try converting each value to a…

christian olori
- 7
- 3
-1
votes
1 answer
Why is document.all 'false'?
So I was playing around with document in JavaScript, as an alternate way of using document.getElementById. But why does document.all equal null? I ran a few commands to prove it's even more 'falsy'.
document.all //…

DaCuteRaccoon
- 224
- 2
- 13
-1
votes
5 answers
How to check for falsey string value when concatenating?
In the following examples both ex1 & ex2 variables will render an empty string with a space and not a falsy value. Whereas ex3 will be falsy and render the right side of the || operator. How can I test for empty string in the first two examples…

coolps811
- 193
- 4
- 11