mercredi 29 janvier 2020

validate multiple variables without writing multiple if else statements

Lets say we have 3 variables and I want to check them empty or not without using multiple if else blocks.

let firstName = "adem"
let lastName = "corona"
let email = "adamcorons@gmai.com"

If(firstName ===  " " && lastName !==  " " && email !==  " "){
Console.log("first name empty")
} else if .......

What is the best way of solving this? Thanks a lot

Aucun commentaire:

Enregistrer un commentaire