mercredi 12 octobre 2016

JavaScript: if var? where var is no bool

I am not understanding some piece of code of the videojs player:

if currentSrc?
    $(".video-js").replaceWith(
      "<div class='unsupported'><a href='#{currentSrc}'>Download</a></div>")

As I understand it, currentSrc has to be a bool to be checked for true or false in the if statement, but later integrated in the link it is a string. Does if var? check the var just for existence? Wouldn't that be an incorrect way to check it in JS?

Aucun commentaire:

Enregistrer un commentaire