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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
30
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
88
Manejo de memoria en Rust: Ownership
lupomontero
0
35
Hola Rust! Aprendiendo con rustlings
lupomontero
1
310
WebThing: construyamos una lámpara 💡
lupomontero
1
71
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el navegador
lupomontero
0
29
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
48
Primeros pasos con Rust y WebAssembly
lupomontero
0
520
Paralelizando promesas
lupomontero
0
340
Other Decks in Programming
See All in Programming
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
210
CSC307 Lecture 07
javiergs
PRO
0
540
MUSUBIXとは
nahisaho
0
120
登壇資料を作る時に意識していること #登壇資料_findy
konifar
1
420
AIエージェントの設計で注意するべきポイント6選
har1101
7
3.4k
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
4
1.1k
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
190
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
240
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
960
高速開発のためのコード整理術
sutetotanuki
1
380
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
590
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
57
14k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
ラッコキーワード サービス紹介資料
rakko
1
2.2M
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
720
エンジニアに許された特別な時間の終わり
watany
106
230k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
Embracing the Ebb and Flow
colly
88
5k
Skip the Path - Find Your Career Trail
mkilby
0
52
Odyssey Design
rkendrick25
PRO
1
490
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
62
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
We Are The Robots
honzajavorek
0
160
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!)