I'm starting to develop web apps but I come from the iOS world. I was wondering if there was an equivalent of Swift's guard statement in JavaScript? I love early return pattern.
For those who may not know, guard statement is an "early return if statement", here is a very basic example:
myCondition = trueOrFalse()
guard myCondition
else {print("myCondition is false")
return}
print("myCondition is true")
Aucun commentaire:
Enregistrer un commentaire