Getting Intellisense from JavaScript File

Let’s say you have main.js and you want intellisense from objects defined in BankAccount.js. You would have to do the following in main.js:

/// <reference path="BankAccount.js" />
 
function run() {
 
  var ba = new BankAccount();
 
}

and BankAccount.js is just:

function BankAccount() {
 
  var total = 0;
 
  this.GetTotal = function () {
    return total;
  }
 
  this.Deposit = function (n) {
    this.total = n;
  }
 
}

This is provided that both .js files are in the same directory – but they don’t have to be – use relative path?

Learn more about it here: http://msdn.microsoft.com/en-us/library/bb385682.aspx