How to understand the double equal sign in js return

return has a double equal sign. How to understand this?

 function init(){
    var url = window.location.pathname.split( "/" );
    if(url.length > 0) url = url[url.length - 1];
    $("-sharpaside .active").removeClass("active");
    $("-sharpaside a").filter( function() {
      return url == $(this).attr("href");
    }).parents("li").addClass( "active" );
  }
return url == $(this).attr("href"); //

my own understanding is that if the two sides are equal, return true? Is that right? no.

Apr.03,2021

if(url == $(this).attr('href'))
{
    return true;
}
else
{
    return false;
}

the return value of the equality expression true/false


calculates the value of the expression first, and then return calculates the value.
if so, does not make an error, return returns a Boolean value

Menu