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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
520
AIプロダクト時代のQAエンジニアに求められること
imtnd
2
660
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
460
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
150
株式会社 Sun terras カンパニーデック
sunterras
0
2k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
370
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
280
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.1k
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
900
RubyとGoでゼロから作る証券システム: 高信頼性が求められるシステムのコードの外側にある設計と運用のリアル
free_world21
0
200
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
350
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
230
Featured
See All Featured
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
130
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
51k
Un-Boring Meetings
codingconduct
0
220
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
120
Technical Leadership for Architectural Decision Making
baasie
3
270
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
94
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.4k
Visualization
eitanlees
150
17k
Prompt Engineering for Job Search
mfonobong
0
180
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.1k
Between Models and Reality
mayunak
2
220
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!)