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.4k
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
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
110
AGIについてChatGPTに聞いてみた
blueb
0
130
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
[FOSS4G 2024 Japan LT] LLMを使ってGISデータ解析を自動化したい!
nssv
1
210
信頼性に挑む中で拡張できる・得られる1人のスキルセットとは?
ken5scal
2
530
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
150
Amplify Gen2 Deep Dive / バックエンドの型をいかにしてフロントエンドへ伝えるか #TSKaigi #TSKaigiKansai #AWSAmplifyJP
tacck
PRO
0
370
地理情報データをデータベースに格納しよう~ GPUを活用した爆速データベース PG-Stromの紹介 ~
sakaik
1
150
ドメイン名の終活について - JPAAWG 7th -
mikit
33
20k
[FOSS4G 2019 Niigata] AIによる効率的危険斜面抽出システムの開発について
nssv
0
310
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
28
12k
Featured
See All Featured
Faster Mobile Websites
deanohume
305
30k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Become a Pro
speakerdeck
PRO
25
5k
Agile that works and the tools we love
rasmusluckow
327
21k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Designing Experiences People Love
moore
138
23k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Teambox: Starting and Learning
jrom
133
8.8k
A designer walks into a library…
pauljervisheath
203
24k
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