Javascript: Why if(false)? Javascript: Why if(false)? asp.net asp.net

Javascript: Why if(false)?


That's a trick to get Visual Studio to include the javascript Intellisense for jQuery without actually emitting the script to callers.

Here is an example from Scott Gu explaining it.


Intellisense in Visual Studio works for jQuery if you add that to every .aspx, .ascx file.
But instead of including it in every file it is included only in the masterpage.Visual Studio parses the markup files and finds a reference to jQuery and then uses the provided intellisense on it.

You'll also need to add a vsdocs.js file into the project.
You can read more about it here.


if(false) is a quick and dirty way to comment out a bunch of code