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
27
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
24
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
68
Manejo de memoria en Rust: Ownership
lupomontero
0
28
Hola Rust! Aprendiendo con rustlings
lupomontero
1
300
WebThing: construyamos una lámpara 💡
lupomontero
1
65
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el navegador
lupomontero
0
25
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
37
Primeros pasos con Rust y WebAssembly
lupomontero
0
480
Paralelizando promesas
lupomontero
0
330
Other Decks in Programming
See All in Programming
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
1
110
無関心の谷
kanayannet
0
180
アンドパッドの Go 勉強会「 gopher 会」とその内容の紹介
andpad
0
250
LINEヤフー データグループ紹介
lycorp_recruit_jp
0
760
C++20 射影変換
faithandbrave
0
500
A2A プロトコルを試してみる
azukiazusa1
2
790
データの民主化を支える、透明性のあるデータ利活用への挑戦 2025-06-25 Database Engineering Meetup#7
y_ken
0
280
Cursor AI Agentと伴走する アプリケーションの高速リプレイス
daisuketakeda
1
120
実践ArchUnit ~実例による検証パターンの紹介~
ogiwarat
2
280
Using AI Tools Around Software Development
inouehi
0
1.2k
都市をデータで見るってこういうこと PLATEAU属性情報入門
nokonoko1203
1
540
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
1
470
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
107
19k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
46
9.6k
Producing Creativity
orderedlist
PRO
346
40k
The Cult of Friendly URLs
andyhume
79
6.4k
Docker and Python
trallard
44
3.4k
We Have a Design System, Now What?
morganepeng
52
7.6k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Git: the NoSQL Database
bkeepers
PRO
430
65k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Building an army of robots
kneath
306
45k
Fireside Chat
paigeccino
37
3.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!)