lundi 8 avril 2019

"if" shorthand with double ampersand

I have seen these lines code.

this.tween && this.tween.kill(),
this.tween = TweenMax.to(object, 1, {
  ...
})

Is that a shorthand for

if(this.tween){
  this.tween.kill();
}
this.tween = TweenMax.to(object, 1, {
  ...
})

thanks ;)

Aucun commentaire:

Enregistrer un commentaire