mardi 19 janvier 2016

Ternary Operator in jQuery statement

I'm new to Javascript, CSS, HTML, and jQuery, and came across this line of code that uses the condition ? if true : if false statement, and I'm trying to understand it. What would it's equivalent if() {} else {} statement look like? This is the line of code:

$('.app-container').css('background', this.background ? `url(${this.background.get('Href')})` : `url(${DefaultImage.Background}`);

Thanks for any explanation :)

Aucun commentaire:

Enregistrer un commentaire