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
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
41
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
100
Manejo de memoria en Rust: Ownership
lupomontero
0
46
Hola Rust! Aprendiendo con rustlings
lupomontero
1
330
WebThing: construyamos una lámpara 💡
lupomontero
1
85
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el navegador
lupomontero
0
32
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
56
Primeros pasos con Rust y WebAssembly
lupomontero
0
540
Paralelizando promesas
lupomontero
0
360
Other Decks in Programming
See All in Programming
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
140
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
17
5.8k
oxlintはeslint/typescript-eslintを置き換えられるのか
shomafujita
2
310
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
300
Swiftのレキシカルスコープ管理
kntkymt
0
210
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
480
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
210
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
2.2k
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
270
Stage 3 Decorators でできること / できないこと / TSKaigi 2026
susisu
1
1.5k
TypeSpec で繋ぐ複数プロダクトの型安全
maroon8021
1
370
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
1.4k
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
55
12k
A Tale of Four Properties
chriscoyier
163
24k
Why Our Code Smells
bkeepers
PRO
340
58k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Context Engineering - Making Every Token Count
addyosmani
9
940
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.3k
How to Ace a Technical Interview
jacobian
281
24k
Rails Girls Zürich Keynote
gr2m
96
14k
Designing for Performance
lara
611
70k
Designing Experiences People Love
moore
143
24k
Bash Introduction
62gerente
615
210k
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!)