Skip to content

Commit

Permalink
few typos corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
Grom-S committed Feb 11, 2012
1 parent 414b5f9 commit 8629df2
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 28 deletions.
28 changes: 9 additions & 19 deletions function-patterns/currying.html
Expand Up @@ -13,7 +13,7 @@
/***
function application
***/
// define a function
// define a function
var sayHi = function (who) {
return "Hello" + (who ? ", " + who : "") + "!";
};
Expand Down Expand Up @@ -42,10 +42,10 @@
partial application
***/

// for illustration purposes
// not valid JavaScript
// for illustration purposes
// not valid JavaScript

// we have this function
// we have this function
function add(x, y) {
return x + y;
}
Expand All @@ -54,29 +54,21 @@
add(5, 4);

// step 1 -- substitute one argument
function add(5
,
y
)
{
function add(5, y) {
return 5 + y;
}

// step 2 -- substitute the other argument
function add(5
,
4
)
{
function add(5, 4) {
return 5 + 4;
}

/***
currying
***/

// a curried add()
// accepts partial list of arguments
// a curried add()
// accepts partial list of arguments
function add(x, y) {
var oldx = x, oldy = y;
if (typeof oldy === "undefined") { // partial
Expand Down Expand Up @@ -124,7 +116,7 @@

function funcWithArgsFrozen(frozenargs) {
return function () {
// could do an optmisation here - if called with no arguments
// could do an optimisation here - if called with no arguments
// return exactly this function.
var args = Array.prototype.slice.call(arguments);
var newArgs = frozenargs.concat(args);
Expand All @@ -136,8 +128,6 @@
};
}

;

return funcWithArgsFrozen([]);
}

Expand Down
4 changes: 2 additions & 2 deletions general-patterns/built-in-prototypes.html
Expand Up @@ -19,8 +19,8 @@
* the code or already part of the JavaScript engine of one of the browsers you support.
* 3. You clearly document and communicate the change with the team.
*/
if (typeof Object.prototype.myMethod !== "function") {
Object.prototype.myMethod = function () {
if (typeof Object.prototype.myMethod !== "function") {
Object.prototype.myMethod = function () {
// implementation...
};
}
Expand Down
5 changes: 2 additions & 3 deletions jquery-patterns/window-scroll-event.html
Expand Up @@ -35,10 +35,9 @@

// preferred v2, timeout instead of interval - no unnecessary ticks
var scrollTimeout; // global for any pending scrollTimeout
var outerPane = $details.find(".details-pane-outer"),
var outerPane = $details.find(".details-pane-outer");

$
(window).scroll(function () {
$(window).scroll(function () {
if (scrollTimeout) {
// clear the timeout, if one is pending
clearTimeout(scrollTimeout);
Expand Down
2 changes: 1 addition & 1 deletion object-creation-patterns/sandbox.html
Expand Up @@ -73,7 +73,7 @@
// box.constructor.prototype.m = "mmm";
box.attachEvent = function () {
};
box.dettachEvent = function () {
box.detachEvent = function () {
};
};

Expand Down
4 changes: 2 additions & 2 deletions object-creation-patterns/static-members.html
Expand Up @@ -14,7 +14,7 @@

// Public Static Members

// counstructor
// constructor
var Gadget = function () {
};

Expand Down Expand Up @@ -110,7 +110,7 @@
return counter;
};

// overwrite the contructor
// overwrite the constructor
return NewGadget;

}()); // execute immediately
Expand Down
2 changes: 1 addition & 1 deletion object-creation-patterns/sugar-method.html
Expand Up @@ -7,7 +7,7 @@
<body>
<script>
/* Title: method() Method
Description: adding convenient funcationality to a language
Description: adding convenient functionality to a language
*/

if (typeof Function.prototype.method !== "function") {
Expand Down

0 comments on commit 8629df2

Please sign in to comment.