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
0
29
Reduzco, reuso y reciclo
LimaJS - 21/02/2019
Lupo Montero
February 21, 2019
Tweet
Share
More Decks by Lupo Montero
See All by Lupo Montero
Trigonometría Bella
lupomontero
0
27
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
84
Manejo de memoria en Rust: Ownership
lupomontero
0
34
Hola Rust! Aprendiendo con rustlings
lupomontero
1
310
WebThing: construyamos una lámpara 💡
lupomontero
1
67
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el navegador
lupomontero
0
27
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
43
Primeros pasos con Rust y WebAssembly
lupomontero
0
510
Paralelizando promesas
lupomontero
0
340
Other Decks in Programming
See All in Programming
re:Invent 2025 のイケてるサービスを紹介する
maroon1st
0
160
これならできる!個人開発のすゝめ
tinykitten
PRO
0
140
生成AI時代を勝ち抜くエンジニア組織マネジメント
coconala_engineer
0
36k
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
490
マスタデータ問題、マイクロサービスでどう解くか
kts
0
160
SwiftUIで本格音ゲー実装してみた
hypebeans
0
550
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
290
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
240
perlをWebAssembly上で動かすと何が嬉しいの??? / Where does Perl-on-Wasm actually make sense?
mackee
0
250
gunshi
kazupon
1
130
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
230
tparseでgo testの出力を見やすくする
utgwkk
2
330
Featured
See All Featured
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
110
Digital Ethics as a Driver of Design Innovation
axbom
PRO
0
130
Building an army of robots
kneath
306
46k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
33
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
sira's awesome portfolio website redesign presentation
elsirapls
0
99
Done Done
chrislema
186
16k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Speed Design
sergeychernyshev
33
1.5k
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!)