This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MyApp | |
{ | |
public static class Functions | |
{ | |
private static int runningTotal = 0; | |
private static void adjustTotal(int x, int y) | |
{ | |
runningTotal += (x + y); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// helpers.js | |
(function() { | |
var runningTotal = 0; | |
function adjustTotal(x, y) { | |
runningTotal += (x + y); | |
} | |
WinJS.Namespace.define("MyApp.Functions", { | |
add: function (x,y) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add.js | |
(function() { | |
WinJS.Namespace.define("MyApp.Functions", { | |
add: function (x,y) { | |
return x + y; | |
} | |
}); | |
})(); | |
// subtract.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// helpers.js | |
(function() { | |
WinJS.Namespace.define("MyApp.Functions", { | |
add: function (x,y) { | |
return x + y; | |
} | |
}); | |
})(); | |
// page.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// helpers.js | |
(function() { | |
function add(x,y) { | |
return x + y; | |
} | |
})(); | |
// page.js | |
(function() { | |
console.log(add(1,1)); // throws add is not defined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// helpers.js | |
(function() { | |
function add(x,y) { | |
return x + y; | |
} | |
})(); | |
// page.js | |
console.log(add(1,1)); // throws add is not defined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// helpers.js | |
function add(x,y) { | |
return x + y; | |
} | |
// page.js | |
console.log(add(1,1)); // prints 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var x = 1; | |
})(); | |
console.log(x); // throws "x" is not defined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (true) { | |
var x = 1; | |
} | |
console.log(x); // Prints 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
// some code | |
})(); |