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
Fast Forward Javascript
Search
Sho Kusano
October 16, 2012
Programming
1
620
Fast Forward Javascript
立ち止まってる暇なんてない。 CoffeeScript の紹介です。
Sho Kusano
October 16, 2012
Tweet
Share
More Decks by Sho Kusano
See All by Sho Kusano
ISUCON 反省会
rosylilly
1
270
ISUCON 夏祭り 2023 ハンズオン資料
rosylilly
1
6.3k
今日から始めるリアルタイム配信の裏側
rosylilly
10
7.6k
ISUCON12 事前講習
rosylilly
6
14k
BURST #0
rosylilly
1
230
ISUCON 11 Prior
rosylilly
10
18k
ISUCON 夏期講習 2020
rosylilly
7
10k
真剣.js / shinken-js
rosylilly
1
3.9k
Sustainable Operation
rosylilly
2
3.5k
Other Decks in Programming
See All in Programming
「影響が少ない」を自分の目でみてみる
o0h
PRO
2
1k
5年間継続して開発した自作OSSの記録
bebeji_nappa
0
180
Signal-Based Data FetchingWith the New httpResource
manfredsteyer
PRO
0
170
DataStoreをテストする
mkeeda
0
280
AWS で実現する安全な AI エージェントの作り方 〜 Bedrock Engineer の実装例を添えて 〜 / how-to-build-secure-ai-agents
gawa
8
730
メモリウォールを超えて:キャッシュメモリ技術の進歩
kawayu
0
1.9k
Bedrock×MCPで社内ブログ執筆文化を育てたい!
har1101
6
920
Harnessing the power of AI in IntelliJ IDEA
antonarhipov
1
100
Vibe Codingをせずに Clineを使っている
watany
17
6.1k
Making TCPSocket.new "Happy"!
coe401_
1
140
PHPで書いたAPIをGoに書き換えてみた 〜パフォーマンス改善の可能性を探る実験レポート〜
koguuum
0
140
PHP で学ぶ OAuth 入門
azuki
1
150
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
99
5.5k
Reflections from 52 weeks, 52 projects
jeffersonlam
349
20k
Gamification - CAS2011
davidbonilla
81
5.2k
Visualization
eitanlees
146
16k
Why Our Code Smells
bkeepers
PRO
336
57k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Code Review Best Practice
trishagee
67
18k
Git: the NoSQL Database
bkeepers
PRO
430
65k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Raft: Consensus for Rubyists
vanstee
137
6.9k
Thoughts on Productivity
jonyablonski
69
4.6k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.1k
Transcript
Forward Fast Javascript Sho Kusano / rosylilly
Profile Sho Kusano rosylilly Facebook: sho.kusano Twitter: rosylilly Mail: rosylilly@aduca.org
Profile Works Dwango/Qteras Model (স) 10/28(Fri) Numero Tokyo
―― Too Many Works ࣄࣺͯΔ΄Ͳ͋Δ
Q. Javascript͕؆୯ͩͱࢥ͏ํ ஏ͔͕ͣ͠ΒͣڍखΛ͓ئ͍͠·͢
A. ʹͱ͍ͬͯ͠ Ͱ͖ΔݶΓॻ͖ͨ͘ͳ͍
ָ͕ग़དྷΕͦΕ͕Ұ൪
ָͯ͠ ͓͕ۚ ཉ͍͠
CoffeeScript is a little language that compiles into JavaScript. http://coffeescript.org/
Fast Forward Javascript ߴʹ લਐΉͨΊͷ CoffeeScript
Javascript ʹ᠘͕ଟ͍ this scope, Prototypical Object, Object forEach
ʰલਐ͢Δ͜ͱʱʹूதग़དྷͳ͍
Let’s try CoffeeScript!
Example Cases
Example Case: This binding var object = { name: 'obj',
func: function(){ console.log(this.name); } } object.func(); // → obj var f = object.func; f(); // → undefined var other = {name: 'other', func: f}; other.func(); // → other
Example Case: This Binding class Example name: 'obj' func: ()=>
console.log @name object = new Example object.func() # → obj f = object.func f() # → obj other = { name: 'other' func: f } other.func() # → obj
Example Case: Prototypical Object var Abstruct = function() { this.prop
= 'property'; } Abstruct.prototype.func = function(){}; var Class = function() { } Class.prototype = {}; for(var method in Abstruct.prototype) { Class.prototype[method] = Abstruct.prototype[method]; }
Example Case: Prototypical Object class Abstruct prop: 'property' func: ()->
class Class extends Abstruct
Example Case: Object forEach var object = { a: 1,
b: 2, c: 3 } for(var key in object) { if(object.hasOwnProperty(key)) console.log(object[key]); }
Example Case: Object forEach object = { a: 1 b:
2, c: 3 } for key, val of object console.log val
Many Features! Destructuring Assignment, Function binding, Embedded JavaScript, Switch/When/Else, Try/Catch/Finally,
Chained Comparisons, String Interpolation, Block Strings, and Block Comments, Block Regular Expressions, Cake, and Cakefiles, "text/coffeescript" Script Tags
Don’t worry!!
֮͑Δͷ͕େมͦ͏... Javascript Ͱۤ͠Ή࣌ؒͱ CoffeeScript Λ֮͑Δ࣌ؒ ͲͪΒ͕͍͔ ↓
͏Ұݸݴޠ֮͑Δͷͪΐͬͱ…… ͋͘·Ͱ JS ͷγϯλοΫεγϡΨʔͱ ଊ͑ͯΑ͍ (JSX, HeXe ͳͲͱൺͯ) ↓
ಋೖ͕େมͦ͏…… Rails3 ͕ WebFront ͳΒࠓ͔Β͑·͢ɻ ͦͷଞɺ Coffee ͔Β JS ʹมͰ͖Δ͠
ϒϥβ্Ͱ Coffee ಈ͔͢Έ͋Δ ↓
ϝϯόʔͷઆಘ͕…… ͕ࣗࣾͰΤϰΝϯδΣϦετʹͳΔνϟϯεʂ ↓
Thank you for listening. rosylilly Fin Fast Forward Javascript