Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
The Book Nerd's Guide to JavaScript
Search
Angus Croll
November 17, 2014
Technology
14
4.1k
The Book Nerd's Guide to JavaScript
Given at DotJS, Paris on 17th November 2014
Angus Croll
November 17, 2014
Tweet
Share
More Decks by Angus Croll
See All by Angus Croll
Stop being Perfect
anguscroll
11
1.4k
ES6 Uncensored
anguscroll
72
12k
Learning to Fly — Twitter Flight and Mixins
anguscroll
23
4.5k
JavaScript is Literature is JavaScript
anguscroll
21
3.3k
The Politics of JavaScript
anguscroll
122
23k
Parlez-Vous JavaScript
anguscroll
33
6.3k
Break all the Rulez
anguscroll
42
15k
How we Learned to Stop Worrying and Love JavaScript
anguscroll
90
21k
Other Decks in Technology
See All in Technology
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
730
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
160
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
1k
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
500
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
なぜCodeceptJSを選んだか
goataka
0
150
Kubeshark で Kubernetes の Traffic を眺めてみよう/Let's Look at k8s Traffic with Kubeshark
kota2and3kan
3
370
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
120
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
160
CustomCopを使ってMongoidのコーディングルールを整えてみた
jinoketani
0
220
Jetpack Composeで始めるServer Cache State
ogaclejapan
2
160
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
8
3.2k
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Unsuck your backbone
ammeep
669
57k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Rails Girls Zürich Keynote
gr2m
94
13k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Adopting Sorbet at Scale
ufuk
73
9.1k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
Facilitating Awesome Meetings
lara
50
6.1k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Mobile First: as difficult as doing things right
swwweet
222
9k
Transcript
A Book Nerd’s Guide to JavaScript @angustweets
None
Practical, Useful, Mind Numbingly Boring Nonsensical Work of Genius
What can Literature teach us about Programming?
Great literature is the creation of open minds As programmers
our focus can be very narrow
We’re encouraged to follow only one style…
Actual excerpts from: Google Style Guide AirBnb Style Guide JavaScript
Garden
None
None
We’re left with only one way to get from A
to B :(
None
None
Literature is about embracing the entire language
When programmers embrace the entire language we get choices…
None
None
"There are indeed many ways to do the same thing
in JS. That's one of the beauties of the language" - Peter van der Zee (@kuvos)
None
None
(at least until the JavaScript Police get here)
None
None
Perhaps most importantly…
…Open Minds keep JavaScript fun.
This one just follows The Good Parts These two learn
by experiment
As programmers we’re not encouraged to experiment
Yet experiment is what keeps JavaScript alive
“You need a lot of bad code to write good
code” - Substack (dotJS 2014)
‣ if(!!x) ‣ fn && fn() ‣ immediately invoked functions
‣ module pattern ‣ promises
None
I decided to take experiment to the next level…
None
Wait What?
Twenty Five Authors solving Five JavaScript Problems
Hemingway developed the Iceberg Theory
Here is Hemingway’s Iceberg Theory applied to JavaScript…
(weird shit) (Deceptively Familiar Syntax) (weird shit) JavaScript
(weird shit) JAVA!! (Deceptively Familiar Syntax) (weird shit) JavaScript
(weird shit) JAVA!! But Easier!! (Deceptively Familiar Syntax) (weird shit)
JavaScript
(weird shit) JAVA!! But Easier!! (Deceptively Familiar Syntax) (weird shit)
WTF? JavaScript
Generate Prime Numbers
None
// A succession of creatures mount the stairs;! // each
creature's stride exceeds that of its predecessor! var monstersAscendingAStaircase = function(numberOfSteps) {! var stairs = []; stepsUntrodden = [];! var largestGait = Math.sqrt(numberOfSteps);! for (var i = 2; i <= largestGait; i++) {! if (!stairs[i]) {! for (var j = i * i; j <= numberOfSteps; j += i) {! stairs[j] = 'stomp';! }! }! }! ! // Long-limbed monsters won't tread on prime numbered stairs.! for (var i = 2; i <= numberOfSteps; i++) {! if(!stairs[i]) {! stepsUntrodden.push(i);! }! }! ! // Here, then, is our answer.! return stepsUntrodden;! };!
1 2 3 4 5 6 7 8 9 10
11 12 13 14 2 3 Borges vs. Prime Numbers
None
function downTheRabbitHole(growThisBig) {! var theFullDeck = Array(growThisBig);! var theHatter =
Function('return this/4').call(2*2);! var theMarchHare = Boolean("The frumious Bandersnatch!");! ! var theVerdict = "the white rabbit".split(/the march hare/).slice(theHatter);! ! //into the pool of tears...! eval(theFullDeck.join("if (!theFullDeck[++theHatter]) {\! theMarchHare = 1;\! theVerdict.push(theHatter);\! " + theFullDeck.join("theFullDeck[++theMarchHare * theHatter]=true;") + "}")! );! ! return theVerdict;! }!
function downTheRabbitHole(growThisBig) {! var theFullDeck = Array(growThisBig);! var theHatter =
Function('return this/4').call(2*2);! var theMarchHare = Boolean("The frumious Bandersnatch!");! ! var theVerdict = "the white rabbit".split(/the march hare/).slice(theHatter);! ! //into the pool of tears...! eval(theFullDeck.join("if (!theFullDeck[++theHatter]) {\! theMarchHare = 1;\! theVerdict.push(theHatter);\! " + theFullDeck.join("theFullDeck[++theMarchHare * theHatter]=true;") + "}")! );! ! return theVerdict;! }!
function downTheRabbitHole(growThisBig) {! var theFullDeck = Array(growThisBig);! var theHatter =
Function('return this/4').call(2*2);! var theMarchHare = Boolean("The frumious Bandersnatch!");! ! var theVerdict = "the white rabbit".split(/the march hare/).slice(theHatter);! ! //into the pool of tears...! eval(theFullDeck.join("if (!theFullDeck[++theHatter]) {\! theMarchHare = 1;\! theVerdict.push(theHatter);\! " + theFullDeck.join("theFullDeck[++theMarchHare * theHatter]=true;") + "}")! );! ! return theVerdict;! }!
! new Array(5).join('A' + new Array(5).join('a'));! ! >! !
new Array(5).join("A" + new Array(5).join('a'));! ! > "AaaaaAaaaaAaaaaAaaaa"!
function downTheRabbitHole(growThisBig) {! var theFullDeck = Array(growThisBig);! var theHatter =
Function('return this/4').call(2*2);! var theMarchHare = Boolean("The frumious Bandersnatch!");! ! var theVerdict = "the white rabbit".split(/the march hare/).slice(theHatter);! ! //into the pool of tears...! eval(theFullDeck.join("if (!theFullDeck[++theHatter]) {\! theMarchHare = 1;\! theVerdict.push(theHatter);\! " + theFullDeck.join("theFullDeck[++theMarchHare * theHatter]=true;") + "}")! );! ! return theVerdict;! }!
eval(“if(!theFullDeck[++theHatter]){theMarchHare=1;theVerdict.push(theHatter);theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;}if(!theFullDeck[+ +theHatter]){theMarchHare=1;theVerdict.push(theHatter);theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;}if(!theFullDeck[+ +theHatter]){theMarchHare=1;theVerdict.push(theHatter);theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;theFullDeck[+
+theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;}if(!theFullDeck[+ +theHatter]){theMarchHare=1;theVerdict.push(theHatter);theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;}if(!theFullDeck[+ +theHatter]){theMarchHare=1;theVerdict.push(theHatter);theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;}if(!theFullDeck[+ +theHatter]){theMarchHare=1;theVerdict.push(theHatter);theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;theFullDeck[+ +theMarchHare*theHatter]=true;theFullDeck[++theMarchHare*theHatter]=true;}”);!
eval(“if (!theFullDeck[++theHatter]) {! theMarchHare = 1;! theVerdict.push(theHatter);! theFullDeck[++theMarchHare * theHatter]
= true;! theFullDeck[++theMarchHare * theHatter] = true;! theFullDeck[++theMarchHare * theHatter] = true;! theFullDeck[++theMarchHare * theHatter] = true;! theFullDeck[++theMarchHare * theHatter] = true;! theFullDeck[++theMarchHare * theHatter] = true;! }! if (!theFullDeck[++theHatter]) {! theMarchHare = 1;! theVerdict.push(theHatter);! theFullDeck[++theMarchHare * theHatter] = true;! theFullDeck[++theMarchHare * theHatter] = true;! theFullDeck[++theMarchHare * theHatter] = true;! theFullDeck[++theMarchHare * theHatter] = true;! theFullDeck[++theMarchHare * theHatter] = true;! theFullDeck[++theMarchHare * theHatter] = true;! }! if (!theFullDeck[++theHatter]) {! theMarchHare = 1;!
Alice in Prime Numberland
Alice in Prime Numberland
Alice in Prime Numberland
Alice in Prime Numberland
Alice in Prime Numberland
Alice in Prime Numberland
Alice in Prime Numberland
Alice in Prime Numberland
Alice in Prime Numberland
Alice in Prime Numberland
Alice in Prime Numberland
So what did we learn?
Playing is Learning
Self-taught programmers are often the best programmers because they get
to make mistakes
Experiment, Play, Have Fun and Keep an Open Mind.
Fin, merci! @angustweets anguscroll.com/hemingway
Books: http://pixgood.com/classic-book-spines.html/ Montparnasse Tower: http://allparisguides.com Eiffel Tower: Yellow Monster: http://content.mycutegraphics.com/
Green Monster: http://wondersofdisney2.yolasite.com/ White Rabbit: http://www.clker.com/ Mad Hatter, March Hare: http://wondersofdisney2.yolasite.com/ Cow, tree, office buildings: clipartpanda.com/ Grass: imgarcade.com/ Lion cubs: https://www.flickr.com/photos/mbiddulph/6947067048/ Cheetah cubs: http://www.bhmpics.com/view-cheetah_cubs_playing-1920x1080.html/ ! Image credits