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
Reduzco, reuso y reciclo
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Lupo Montero
February 21, 2019
Programming
43
0
Share
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
39
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
100
Manejo de memoria en Rust: Ownership
lupomontero
0
45
Hola Rust! Aprendiendo con rustlings
lupomontero
1
320
WebThing: construyamos una lámpara 💡
lupomontero
1
85
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el navegador
lupomontero
0
31
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
53
Primeros pasos con Rust y WebAssembly
lupomontero
0
540
Paralelizando promesas
lupomontero
0
360
Other Decks in Programming
See All in Programming
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
160
「なんか〇〇ライブラリで脆弱性あるみたいなんだけど。。。」から始める脆弱性対応 / First Steps in Vulnerability Response
mackey0225
2
130
cloudnative conference 2026 flyle
azihsoyn
1
190
RailsTokyo 2026#4: AI様があれば、 Hotwireの弱点は消えるか?
naofumi
3
360
ふにゃっとしない名前の付け方 〜哲学で茹で上げる、コシのあるソフトウェア設計〜
shimomura
0
120
20260514_its_the_context_window_stupid.pdf
heita
0
1k
My daily life on Ruby
a_matsuda
3
400
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
0
180
サプライチェーン攻撃対策「層を重ねて落ちない壁」を10日間で組み上げた話 #TechLeadConf2026
kashewnuts
1
290
Terraform言語の静的解析 / static analysis of Terraform language
wata727
1
150
いつか誰かが、と思っていた フロントエンド刷新5年間の実践知
kiichisugihara
1
280
[RubyKaigi 2026] Require Hooks
palkan
1
320
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Automating Front-end Workflow
addyosmani
1370
200k
Visualization
eitanlees
151
17k
Typedesign – Prime Four
hannesfritz
42
3k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
290
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
230
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
How to make the Groovebox
asonas
2
2.2k
How to build a perfect <img>
jonoalderson
1
5.5k
Evolving SEO for Evolving Search Engines
ryanjones
0
190
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
290
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
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!)