Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Even Rubber Duck knows JS better than you!
Nikita Galkin
September 08, 2018
Programming
1
93
Even Rubber Duck knows JS better than you!
Nikita Galkin
September 08, 2018
Tweet
Share
More Decks by Nikita Galkin
See All by Nikita Galkin
React applications Failures
galkin
0
100
Node.js Development in 2022
galkin
0
460
Cloud Native Approach for Node.js Developers
galkin
0
42
Deep Dive Into NestJS at FWDays
galkin
0
270
Node.js Recipes: Road to Production.
galkin
0
150
Auth for React.js App
galkin
1
67
Web Developer Toolbox at 2020
galkin
1
150
Node.js Development in 2020: trends and techniques
galkin
0
450
Backend For Frontend: The Missing Manual at Devoxx Ukraine
galkin
1
97
Other Decks in Programming
See All in Programming
Most Valuable Bug(?) ~インシデント未遂から得た学び~
tatsumiakahori
0
150
Workshop on Jetpack compose
aldefy
0
140
T3 Stack and TypeScript ecosystem
quramy
3
790
エンジニア向け会社紹介資料/engineer-recruiting-pitch
xmile
PRO
0
110
PHP でガチの電卓を作る
memory1994
PRO
2
160
量子コンピュータ時代のプログラミングセミナー / 20230119_Amplify_seminar _shift_optimization
fixstars
0
200
tidy_rpart
bk_18
0
610
ECS Service Connectでマイクロサービスを繋いでみた
xblood
0
750
(新米)エンジニアリングマネージャーのしごと #RSGT2023
murabayashi
9
5.9k
Makuakeの認証基盤とRe-Architectureチーム
bmf_san
0
630
Form実装基本を学び直してみた
hyugatsukui
0
250
Cloudflare Workersと状態管理
chimame
3
500
Featured
See All Featured
Faster Mobile Websites
deanohume
295
29k
What the flash - Photography Introduction
edds
64
10k
The Mythical Team-Month
searls
210
40k
Code Review Best Practice
trishagee
50
11k
Support Driven Design
roundedbygravity
88
8.9k
Producing Creativity
orderedlist
PRO
335
38k
How GitHub (no longer) Works
holman
298
140k
Music & Morning Musume
bryan
37
4.6k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
109
16k
Art Directing for the Web. Five minutes with CSS Template Areas
malarkey
197
10k
What's new in Ruby 2.0
geeforr
336
30k
WebSockets: Embracing the real-time Web
robhawkes
58
6k
Transcript
Even Rubber Duck knows JavaScript better than you! by Nikita
Galkin Sep 8, 2018
Bug on line 7 Quack Quack
Your code is sucks Quack Quack
None
class Employee { constructor(role) { this.role = role; } get
mainResponsibility() { switch (this.role) { case 'Developer': return 'Write Code'; ...
Turn and Write Code
7 Hiring process 1. HR-interview 2. CV-screening 3. Technical interview
4. Interview with the client Dev Team
Upgraded Hiring process 1. HR-interview 2. CV-screening 3. Live coding
as fail fast check 4. Technical interview 5. Test task as second chance 6. Interview with the client 8
Live coding • 20 minutes only • Remote via skype
with screen-sharing • Without bla-bla bullshit • 4-6 trivial JS tasks at JSfiddle • Easy to see does the code work or not • Googling or Asking is okey 9
Expectations Reality VS
None
You lost context Quack
const obj = { fullname: 'Yellow Duck', getFullname: function() {
return this.fullname; } }; const nameGetter = obj.getFullname; // @todo fix this line document.getElementById('name').innerHTML = nameGetter();
const obj = { fullname: 'Yellow Duck', getFullname: function() {
return this.fullname; } }; const nameGetter = obj.getFullname; // @todo fix this line document.getElementById('name').innerHTML = obj.fullname;
const fullname = 'Yellow Duck'; const obj = { getFullname:
function() { return fullname; } }; const nameGetter = obj.getFullname; // @todo fix this line document.getElementById('name').innerHTML = nameGetter();
const obj = { fullname: 'Yellow Duck', getFullname: function() {
return this.fullname; } }; const nameGetter = obj.getFullname.bind(obj); document.getElementById('name').innerHTML = nameGetter();
17
Just return new promise Quack Quack
function wait(timeout) { // @todo implement } wait(1000) .then(() =>
{ document.getElementById('answer').innerHTML = 'Done!'; });
function wait(timeout) { return { then: function(callback) { callback(); }
} } wait(1000) .then(() => { document.getElementById('answer').innerHTML = 'Done!'; });
function wait(timeout) { setTimeout(function() {}, timeout); } wait(1000) .then(() =>
{ document.getElementById('answer').innerHTML = 'Done!'; });
function wait(timeout) { setTimeout(function() { return Promise(); }, timeout); }
wait(1000) .then(() => { document.getElementById('answer').innerHTML = 'Done!'; });
Release the Quacken!
function wait(timeout) { return new Promise(r => setTimeout(r, timeout)); }
wait(1000) .then(() => { document.getElementById('answer').innerHTML = 'Done!'; });
Use data structure Quack Quack
const unfiltered = [1, 2, 3, 5, 1, 5, 9,
1, 2, 8]; const filtered = removeDuplicates(unfiltered); // filtered should be equal [1, 2, 3, 5, 9, 8] document.getElementById('answer').innerHTML = filtered; function removeDuplicates(arr) { // @todo implement }
const unfiltered = [1, 2, 3, 5, 1, 5, 9,
1, 2, 8]; const filtered = removeDuplicates(unfiltered); // filtered should be equal [1, 2, 3, 5, 9, 8] document.getElementById('answer').innerHTML = filtered; function removeDuplicates(arr) { return arr.filter(...) }
Ducks win!
const unfiltered = [1, 2, 3, 5, 1, 5, 9,
1, 2, 8]; const filtered = removeDuplicates(unfiltered); // should be [1, 2, 3, 5, 9, 8] document.getElementById('answer').innerHTML = filtered; function removeDuplicates(arr) { const obj = {}; for (const el of arr) { obj[el] = true; } return Object.keys(obj); }
30 Googling is better, than learning JS
const unfiltered = [1, 2, 3, 5, 1, 5, 9,
1, 2, 8]; const filtered = removeDuplicates(unfiltered); // filtered should be equal [1, 2, 3, 5, 9, 8] document.getElementById('answer').innerHTML = filtered; function removeDuplicates(arr) { return Array.from(new Set(arr)); }
32 HAPPY CODING WITH JAVASCRIPT! You can find me at
twitter as @galk_in Slides are available at speakerdeck.com/galkin or at my site galk.in