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
45
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Reduzco, reuso y reciclo
LimaJS - 21/02/2019
Lupo Montero
February 21, 2019
More Decks by Lupo Montero
See All by Lupo Montero
Trigonometría Bella
lupomontero
0
45
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
100
Manejo de memoria en Rust: Ownership
lupomontero
0
48
Hola Rust! Aprendiendo con rustlings
lupomontero
1
330
WebThing: construyamos una lámpara 💡
lupomontero
1
93
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el navegador
lupomontero
0
34
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
59
Primeros pasos con Rust y WebAssembly
lupomontero
0
550
Paralelizando promesas
lupomontero
0
360
Other Decks in Programming
See All in Programming
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
190
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
300
Datadog LLM Observabilityで実現する 安全なLLM Usage 管理
3150
0
110
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
130
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
200
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
130
1B+ /day規模のログを管理する技術
broadleaf
0
110
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
810
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
220
Inside Stream API
skrb
1
780
Performance Engineering for Everyone
elenatanasoiu
0
230
スマートグラスで並列バイブコーディング
hyshu
0
260
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
210
We Are The Robots
honzajavorek
0
260
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
400
Designing for Performance
lara
611
70k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
170
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
870
How to Talk to Developers About Accessibility
jct
2
250
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
170
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!)