Skip to content
Browse files

few typos corrected

  • Loading branch information...
1 parent 414b5f9 commit 8629df2401f3642fdada5e4a16223fb01c01b654 @Grom-S Grom-S committed Feb 11, 2012
View
28 function-patterns/currying.html
@@ -13,7 +13,7 @@
/***
function application
***/
-// define a function
+ // define a function
var sayHi = function (who) {
return "Hello" + (who ? ", " + who : "") + "!";
};
@@ -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;
}
@@ -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
@@ -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);
@@ -136,8 +128,6 @@
};
}
- ;
-
return funcWithArgsFrozen([]);
}
View
4 general-patterns/built-in-prototypes.html
@@ -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...
};
}
View
5 jquery-patterns/window-scroll-event.html
@@ -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);
View
2 object-creation-patterns/sandbox.html
@@ -73,7 +73,7 @@
// box.constructor.prototype.m = "mmm";
box.attachEvent = function () {
};
- box.dettachEvent = function () {
+ box.detachEvent = function () {
};
};
View
4 object-creation-patterns/static-members.html
@@ -14,7 +14,7 @@
// Public Static Members
- // counstructor
+ // constructor
var Gadget = function () {
};
@@ -110,7 +110,7 @@
return counter;
};
- // overwrite the contructor
+ // overwrite the constructor
return NewGadget;
}()); // execute immediately
View
2 object-creation-patterns/sugar-method.html
@@ -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") {

0 comments on commit 8629df2

Please sign in to comment.
Something went wrong with that request. Please try again.