Help with this JS function

I have this JS function in a layout page I’m using on a asp.net MVC website:

$(document).ready(function () {
  //Display the welcome ad
  if (@Globals.configSettings.DisplayWelcomeAd != false) {
    displayWelcomeAd('@Utility.IsBot');
  }
  SocialShareKit.init();
});

And what is happening is that @Globals.configSettings.DisplayWelcomeAd is false. It’s going and checking, and returning false, yet it still runs the code block every time. Do you have any idea why it would be doing this??

According to your current code the SocialShareKit.init(); will run everytime because of where you have it after the if statement.

Or are you saying the WelcomeAd is displaying everytime too?

Does changing to strict equality checking do anything different? (from != to !==). If you console.log @Globals.configSettings.DisplayWelcomeAd what do you get?