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
Lupo Montero
February 21, 2019
Programming
39
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
37
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
96
Manejo de memoria en Rust: Ownership
lupomontero
0
41
Hola Rust! Aprendiendo con rustlings
lupomontero
1
320
WebThing: construyamos una lámpara 💡
lupomontero
1
80
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el navegador
lupomontero
0
30
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
51
Primeros pasos con Rust y WebAssembly
lupomontero
0
530
Paralelizando promesas
lupomontero
0
350
Other Decks in Programming
See All in Programming
脱 雰囲気実装!AgentCoreを良い感じにWEBアプリケーションに組み込むために
takuyay0ne
3
420
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
250
The free-lunch guide to idea circularity
hollycummins
0
400
野球解説AI Agentを開発してみた - 2026/02/27 LayerX社内LT会資料
shinyorke
PRO
0
380
KagglerがMixSeekを触ってみた
morim
0
360
仕様漏れ実装漏れをなくすトレーサビリティAI基盤のご紹介
orgachem
PRO
8
4k
Strategy for Finding a Problem for OSS: With Real Examples
kibitan
0
130
存在論的プログラミング: 時間と存在を記述する
koriym
5
740
我々はなぜ「層」を分けるのか〜「関心の分離」と「抽象化」で手に入れる変更に強いシンプルな設計〜 #phperkaigi / PHPerKaigi 2026
shogogg
2
740
Kubernetesでセルフホストが簡単なNewSQLを求めて / Seeking a NewSQL Database That's Simple to Self-Host on Kubernetes
nnaka2992
0
190
Geminiをパートナーに神社DXシステムを個人開発した話(いなめぐDX 開発振り返り)
fujiba
0
130
Smarter Angular mit Transformers.js & Prompt API
christianliebel
PRO
1
110
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
Writing Fast Ruby
sferik
630
63k
Navigating Weather and Climate Data
rabernat
0
150
Side Projects
sachag
455
43k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
340
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
210
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
450
The Pragmatic Product Professional
lauravandoore
37
7.2k
Marketing to machines
jonoalderson
1
5.1k
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!)