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
28
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
76
Manejo de memoria en Rust: Ownership
lupomontero
0
32
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
39
Primeros pasos con Rust y WebAssembly
lupomontero
0
500
Paralelizando promesas
lupomontero
0
340
Other Decks in Programming
See All in Programming
NixOS + Kubernetesで構築する自宅サーバーのすべて
ichi_h3
0
770
Six and a half ridiculous things to do with Quarkus
hollycummins
0
170
Leading Effective Engineering Teams in the AI Era
addyosmani
4
390
詳しくない分野でのVibe Codingで困ったことと学び/vibe-coding-in-unfamiliar-area
shibayu36
3
4.9k
CSC509 Lecture 06
javiergs
PRO
0
260
Android16 Migration Stories ~Building a Pattern for Android OS upgrades~
reoandroider
0
110
Go Conference 2025: Goで体感するMultipath TCP ― Go 1.24 時代の MPTCP Listener を理解する
takehaya
9
1.7k
CSC305 Lecture 05
javiergs
PRO
0
210
あなたとKaigi on Rails / Kaigi on Rails + You
shimoju
0
140
kiroとCodexで最高のSpec駆動開発を!!数時間で web3ネイティブなミニゲームを作ってみたよ!
mashharuki
0
180
技術的負債の正体を知って向き合う / Facing Technical Debt
irof
0
170
Flutterで分数(Fraction)を表示する方法
koukimiura
0
130
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1371
200k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
8
910
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Designing for Performance
lara
610
69k
Speed Design
sergeychernyshev
32
1.2k
jQuery: Nuts, Bolts and Bling
dougneiner
65
7.9k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
33
2.3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
115
20k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.7k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
980
The Invisible Side of Design
smashingmag
302
51k
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!)