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
25
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
20
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
52
Manejo de memoria en Rust: Ownership
lupomontero
0
20
Hola Rust! Aprendiendo con rustlings
lupomontero
1
280
WebThing: construyamos una lámpara 💡
lupomontero
1
59
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el navegador
lupomontero
0
22
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
25
Primeros pasos con Rust y WebAssembly
lupomontero
0
450
Paralelizando promesas
lupomontero
0
320
Other Decks in Programming
See All in Programming
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
170
Honoとフロントエンドの 型安全性について
yodaka
5
330
『GO』アプリ バックエンドサーバのコスト削減
mot_techtalk
0
140
Kubernetes History Inspector(KHI)を触ってみた
bells17
0
220
SwiftUI Viewの責務分離
elmetal
PRO
1
220
DevinとCursorから学ぶAIエージェントメモリーの設計とMoatの考え方
itarutomy
1
670
Domain-Driven Transformation
hschwentner
2
1.9k
ソフトウェアエンジニアの成長
masuda220
PRO
10
920
負債になりにくいCSSをデザイナとつくるには?
fsubal
9
2.4k
Introduction to kotlinx.rpc
arawn
0
670
最近のVS Codeで気になるニュース 2025/01
74th
1
260
AWS Organizations で実現する、 マルチ AWS アカウントのルートユーザー管理からの脱却
atpons
0
130
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
27
1.9k
Speed Design
sergeychernyshev
26
790
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
99
18k
Designing on Purpose - Digital PM Summit 2013
jponch
117
7.1k
Documentation Writing (for coders)
carmenintech
67
4.6k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Typedesign – Prime Four
hannesfritz
40
2.5k
YesSQL, Process and Tooling at Scale
rocio
171
14k
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!)