Thursday 7/17/2008. 30 points.
http://www.cs.nyu.edu/courses/summer08/G22.3033-002/
(4+3+3 = 10 points) Consider the following JavaScript code:
var a = 1;
function outer(b) {
function inner() {
document.write("a=" + a + ", b=" + b + "</br>\n");
}
return inner;
}
var my_closure = outer(2);
my_closure();
a = 3;
my_closure();
my_closure?
my_closure?
(2+5+3 = 10 points) Consider a web email application that lets the user create an attachment. After the user selects the file to attach, the application uploads it to the server in the background. At the same time, the user can interact normally with the application. When the file is uploaded, the page changes so the user knows the file is at the server.
(4+3+3 = 10 points)