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
35
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
34
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
91
Manejo de memoria en Rust: Ownership
lupomontero
0
38
Hola Rust! Aprendiendo con rustlings
lupomontero
1
320
WebThing: construyamos una lámpara 💡
lupomontero
1
75
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el navegador
lupomontero
0
29
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
50
Primeros pasos con Rust y WebAssembly
lupomontero
0
520
Paralelizando promesas
lupomontero
0
350
Other Decks in Programming
See All in Programming
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
460
The Ralph Wiggum Loop: First Principles of Autonomous Development
sembayui
0
3.7k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
210
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
230
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
520
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
900
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
120
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
240
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
110
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
260
Geminiの機能を調べ尽くしてみた
naruyoshimi
0
190
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
630
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
6k
Building Adaptive Systems
keathley
44
2.9k
From π to Pie charts
rasagy
0
140
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
240
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
110
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
130
What's in a price? How to price your products and services
michaelherold
247
13k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
660
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Why Our Code Smells
bkeepers
PRO
340
58k
Marketing to machines
jonoalderson
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!)