1 2 | var dbl = function(x) { x + x; }; var prod = function(x, y) { x * y; }; |
1 2 3 4 5 | var dbl = function(x) { x + x; }; var prod = function(x, y) { x * y; }; dbl(42); // 84 dbl(42 - 40); // 4 prod(42, 50); // 2100 |
1 2 3 4 | var a = 24.5; var b = "foo"; a + a + b; // 49foo a + b + a; // 24.5foo24.5 |
1 | alert(21 + 21 + "hello"); // ALERT! 42hello |
1 2 | function dbl(x) { x + x; }; function prod(x, y) { x * y; }; |