Determine whether other key-value pairs in the object except Boolean values are empty?


let joke ={
    a:"1",
    b:"2",
    c:false
}
for(let key in joke){
    if(joke[key]==""){
        alert("")
    }
}

as above, in the loop check, c is a Boolean value false, judgment pops up alert, ask how to ignore the case that the key-value pair is a Boolean value, and only detect whether the string and number types are empty?

Mar.12,2021

for(let key in joke){
    if(joke[key] === '' && typeof joke[key] !== 'boolean'){
        alert('')
    }
}

use =
joke [key] ='
if the check value is null or undefined , you can list these conditions
joke [key] =''| joke [key] = null | | joke [key] = undefined

< hr class= "answer".

= implicit type conversion has occurred. If you change it to = , it must be ' to enter.

only detects whether the string and numeric types are empty

does not understand this sentence, do you want the number 0 to also determine a null value?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b33d42-34275.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b33d42-34275.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?