; == “I’m not sure how our community got so religious and fact-disoriented, but it has got to stop” “I am sorry that, instead of educating you, the leaders in this language community have given you lies and fear.” “That is insanely stupid code. Fix it now. Learn to use semicolons”
“Please don’t do this” Every tech forum. Ever. “The subset I carved out is vastly superior to the language as a whole” Douglas Crockford - The Good Parts
A: “Part of me wonders if it has more to do with a lack of experience (perceived or actual) with javascript coders. I can see how someone just hacking away at some sample code could make an innocent mistake with ++ and --, but I don't see why an experienced professional would avoid them.”
“The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype”—JS Lint “hasOwnProperty [is] essential when iterating over the properties of any object ”—JS Garden
Don’t buy the code for the dumbest ideology, it negates our responsibility to educate ourseleves, and our team. It holds us back and holds the language back.
Removed all traffic lights and signs from the town's centre Two years after the system was introduced, average travel times lowered significantly and yearly accidents were reduced from 8 to 1. Drachten, Netherlands 2000-2001
“Accidents, as well as congestion, are reduced when motorists show greater individual responsibility, rather than mentally switching off to behave like automata”
function natcompare(a,b) { var ca, cb; while (true) { ca = a.charAt(ia++); cb = b.charAt(ib++); //(some zero checking goes here) if (ca == 0 && cb == 0) { //The strings compare the same. return 0; } if (ca < cb) {return -1;} if (ca > cb) {return +1;} } }
function natcompare(a,b) { var ca, cb; while (true) { ca = a.charAt(ia++); cb = b.charAt(ib++); //(some zero checking goes here) if (ca === 0 && cb === 0) { //The strings compare the same. return 0; } if (ca < cb) {return -1;} if (ca > cb) {return +1;} } }
function natcompare(a,b) { var ca, cb; while (true) { ca = a.charAt(ia++); cb = b.charAt(ib++); //(some zero checking goes here) if (ca === 0 && cb === 0) { //YOU ARE DOOMED!. return 0; } if (ca < cb) {return -1;} if (ca > cb) {return +1;} } }
My Humble Style Guide 1. Use Brackets In Conditionals 2. Line Break after Function Signature 3. Space after // 4. ALWAYS use === 5. NEVER parseInt without a radix arg 6. You SUCK if you use new Attn. Slide Viewers: this is a parody!! Text
We can rise above the fearmongers, the ideologues and the absolutists... 1) Master the fundamentals: this, prototypes, coercion and scoping 2) Experiment, Play, Have Fun and Keep an Open Mind.
code credits natural order comparator Copyright (C) 2005 by SCK-CEN (Belgian Nucleair Research Centre) Copyright (C) 2003 by Pierre-Luc Paour Copyright (C) 2000 by Martin Pool