Difference between revisions of "WebFund 2014W Lecture 10"

From Soma-notes
Jump to navigation Jump to search
(Created page with " ===puzzle.js=== <source line lang="javascript"> y = "Yo"; var f = function(a) { var x = "hello "; var s = {}; s.g = function(b) { return x + b + ", " + a; ...")
 
Line 1: Line 1:
To play with puzzle.js, run "node" at the command line and then say
q = require("./puzzle.js");
assuming that puzzle.js is in the directory where you started node.





Revision as of 14:51, 7 February 2014

To play with puzzle.js, run "node" at the command line and then say

q = require("./puzzle.js");

assuming that puzzle.js is in the directory where you started node.


puzzle.js

y = "Yo";
 
var f = function(a) {
    var x = "hello ";
    var s = {};
 
    s.g = function(b) {
	return x + b + ", " + a;
    }
 
    s.h = function(c) {
	return a = c;
    }
 
    s.j = function(x) {
	return eval(x);
    }
 
    return s;
}
 
var p = f("do I know you?");
 
exports.p = p;