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
Even Rubber Duck knows JS better than you!
Search
Nikita Galkin
September 08, 2018
Programming
130
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Even Rubber Duck knows JS better than you!
Nikita Galkin
September 08, 2018
More Decks by Nikita Galkin
See All by Nikita Galkin
React applications Failures
galkin
0
320
Node.js Development in 2022
galkin
0
870
Cloud Native Approach for Node.js Developers
galkin
0
110
Deep Dive Into NestJS at FWDays
galkin
0
540
Node.js Recipes: Road to Production.
galkin
0
220
Auth for React.js App
galkin
1
180
Web Developer Toolbox at 2020
galkin
1
250
Node.js Development in 2020: trends and techniques
galkin
0
590
Backend For Frontend: The Missing Manual at Devoxx Ukraine
galkin
1
180
Other Decks in Programming
See All in Programming
MySQLとPostgreSQLって何が違うの?
akagami
PRO
0
160
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1.7k
ソフトウェアラスタライザ
fadis
1
780
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
490
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
0
200
이 함수, 실패하면 어떻게 되나요? null부터 Rich Errors까지, Kotlin 에러 처리 15년
haeti2
0
120
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
2
290
バグを直したら useEffect が消えた
colorful12
3
830
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
4
2.7k
Foundry Localでエージェント開発
seosoft
0
120
Seeing Through Serverless: Observability for AWS Lambda with ADOT and CloudWatch Application Signals
seike460
PRO
1
120
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
260
Featured
See All Featured
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
400
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
230
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
650
The Curious Case for Waylosing
cassininazir
1
490
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.3k
YesSQL, Process and Tooling at Scale
rocio
174
15k
WENDY [Excerpt]
tessaabrams
12
39k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
260
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.2k
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