If X = Y then Y else Q in an ajax query

If X = Y then Y else Q in an ajax query

Hi all! 
I'm completely new to all of this but am trying to add some logic into an ajax query from a JSON file to write this to HTML.

I'm reading two variable from a nested JSON file, "departure time" and "expected departure time". I want to write the "expected departure time" into the HTML if the two times differ. But if they are equal instead of the time I want to write "On Time".
For this I need to have some logic inside my query. But I don't know how to do this. 

Below is the code where I have the logic described as:
" if (boardHTML = boardHTML2) then bordHTML3 = "ON TIME" else boardHTML3 = boardHTML"

I know that this is incorrect, but how can I add such a logic to the query? Any advice?

  1. $. ajax({
    dataType: "json",
    url: url
    }). done( function( data) {
    console. log( data);
    $( '#ExpectedTime'). html( '<h3></h3>');
    for ( var place of data. departures. all) {
    var boardHTML = '<div class="DBoard">' +
    place. expected_departure_time +
    '</div>';

    var boardHTML2 = '<div class="DBoard">' +
    place. aimed_departure_time +
    '</div>';

    if ( boardHTML = boardHTML2) then bordHTML3 = "ON TIME" else boardHTML3 = boardHTML;
    $( '#ExpectedTime'). append( boardHTML3);
    }
Thanks in advance for any help given!