Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Reduzco, reuso y reciclo
Search
Lupo Montero
February 21, 2019
Programming
48
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Reduzco, reuso y reciclo
LimaJS - 21/02/2019
Lupo Montero
February 21, 2019
More Decks by Lupo Montero
See All by Lupo Montero
Trigonometría Bella
lupomontero
0
50
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
110
Manejo de memoria en Rust: Ownership
lupomontero
0
51
Hola Rust! Aprendiendo con rustlings
lupomontero
1
350
WebThing: construyamos una lámpara 💡
lupomontero
1
110
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el navegador
lupomontero
0
43
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
67
Primeros pasos con Rust y WebAssembly
lupomontero
0
560
Paralelizando promesas
lupomontero
0
370
Other Decks in Programming
See All in Programming
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
9.3k
Heart of Swift Concurrency
koher
0
1.1k
カツオ、ご期待ください
suneo3476
0
130
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
200
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
330
App Intentsのビルドプロセスを支える技術
kntkymt
0
490
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
170
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
570
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
230
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
810
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
740
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
320
Featured
See All Featured
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
The Curious Case for Waylosing
cassininazir
1
550
Site-Speed That Sticks
csswizardry
13
1.5k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
270
Un-Boring Meetings
codingconduct
0
440
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.9k
Exploring anti-patterns in Rails
aemeredith
4
520
GraphQLとの向き合い方2022年版
quramy
50
15k
Tell your own story through comics
letsgokoyo
1
1.1k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Transcript
@lupomontero LimaJS - 21/02/2019
@Laboratoriala @LimaJSorg @NodeSchool @lupomontero @mozillaperu
Qué es reduce? Blah blah blah… • Transformar un arreglo
en un “valor” • Transformar un arreglo en otro “tipo” • Responder preguntas sobre la colección (por ejemplo estadísticas) • Resumir una colección • ...
[any] Array.prototype.reduce(fn, initialValue) The reduce() method executes a reducer function
(that you provide) on each member of the array resulting in a single output value. Fuente: MDN
.reduce .filter .map .forEach
None
[1,2,3,4,5].reduce((prev, item) => prev + item, 0)
Un ejemplo de reduce
Implementación imperativa • Bucle / iteración • Mutación / reasignación
Reglas del juego... • No sentencias / sólo expresiones •
No mutación / no re-asignación • ...
… antes de empezar con la implementación ... • Operador
ternario • Operador de propagación (spread operator) • !! (bang bang! doble negación)
Implementación declarativa • Recursión • Inmutabilidad • Expresiones
Ejemplos de aplicaciones de reduce • map • filter •
join • forEach • ...
map
filter
join
forEach
includes
indexOf
lastIndexOf
reverse
reduceRight
Fin (Gracias!)