惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Exploit Database - CXSecurity.com
V
Vulnerabilities – Threatpost
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
Webroot Blog
Webroot Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
I
Intezer
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
News | PayPal Newsroom
S
Security Affairs
T
Tor Project blog
P
Proofpoint News Feed
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Security @ Cisco Blogs
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
Help Net Security
Help Net Security
U
Unit 42
云风的 BLOG
云风的 BLOG
The Hacker News
The Hacker News
Cisco Talos Blog
Cisco Talos Blog
量子位
F
Full Disclosure
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
有赞技术团队
有赞技术团队
T
Troy Hunt's Blog
P
Privacy & Cybersecurity Law Blog
Forbes - Security
Forbes - Security
人人都是产品经理
人人都是产品经理
L
Lohrmann on Cybersecurity
Apple Machine Learning Research
Apple Machine Learning Research
Microsoft Security Blog
Microsoft Security Blog
博客园 - Franky
腾讯CDC
AI
AI
Last Week in AI
Last Week in AI
Latest news
Latest news
Google Online Security Blog
Google Online Security Blog
N
Netflix TechBlog - Medium
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
Martin Fowler
Martin Fowler
Blog — PlanetScale
Blog — PlanetScale
V2EX - 技术
V2EX - 技术
酷 壳 – CoolShell
酷 壳 – CoolShell

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
RxJS Is Just Arrays Over Time
Amrishkhan Sheik Abdullah · 2026-06-05 · via DEV Community

RxJS has a reputation problem.

Mention RxJS in a JavaScript discussion and you'll usually get one of two reactions.

The first:

I love RxJS.

Enter fullscreen mode Exit fullscreen mode

The second:

I have no idea what's going on.

Enter fullscreen mode Exit fullscreen mode

There is rarely an in-between.

And honestly, I understand why.

Most RxJS tutorials immediately throw developers into a sea of operators:

map
filter
switchMap
mergeMap
concatMap
combineLatest
forkJoin
zip
scan

Enter fullscreen mode Exit fullscreen mode

It feels like learning an entirely new programming language.

But what if I told you that most RxJS operators are concepts you already know?

What if the problem isn't RxJS?

What if the problem is how RxJS is taught?

Because once I understood one simple idea, RxJS suddenly became much easier:

RxJS is just Arrays over Time.

Not exactly.

But close enough that it dramatically simplifies how you think about Observables.


Start With Something Familiar

Consider an Array.

const numbers = [1, 2, 3, 4]

Enter fullscreen mode Exit fullscreen mode

We can transform it.

const doubled = numbers.map(
  x => x * 2
)

console.log(doubled)

Enter fullscreen mode Exit fullscreen mode

Output:

[2, 4, 6, 8]

Enter fullscreen mode Exit fullscreen mode

We can filter it.

const even = numbers.filter(
  x => x % 2 === 0
)

Enter fullscreen mode Exit fullscreen mode

Output:

[2, 4]

Enter fullscreen mode Exit fullscreen mode

We can reduce it.

const total = numbers.reduce(
  (sum, x) => sum + x,
  0
)

Enter fullscreen mode Exit fullscreen mode

Output:

10

Enter fullscreen mode Exit fullscreen mode

Nothing surprising.

Every JavaScript developer understands this.


Now Imagine The Values Arrive Over Time

Instead of:

[1,2,3,4]

Enter fullscreen mode Exit fullscreen mode

imagine:

1
(wait)
2
(wait)
3
(wait)
4

Enter fullscreen mode Exit fullscreen mode

The values are the same.

The only difference is:

Space
↓

Time

Enter fullscreen mode Exit fullscreen mode

That is the key insight.


Enter Observables

An Observable might emit:

1
2
3
4

Enter fullscreen mode Exit fullscreen mode

over time.

Example:

import {
  interval
} from "rxjs"

interval(1000)

Enter fullscreen mode Exit fullscreen mode

Output:

0
1
2
3
4
...

Enter fullscreen mode Exit fullscreen mode

One value every second.

Instead of holding values simultaneously like an Array, an Observable delivers values gradually.


map() Works Exactly The Same

Array:

[1, 2, 3]
  .map(x => x * 2)

Enter fullscreen mode Exit fullscreen mode

Observable:

interval(1000)
  .pipe(
    map(x => x * 2)
  )

Enter fullscreen mode Exit fullscreen mode

Output:

0
2
4
6
8
...

Enter fullscreen mode Exit fullscreen mode

The transformation is identical.

Only the timing differs.


filter() Works Exactly The Same

Array:

numbers.filter(
  x => x % 2 === 0
)

Enter fullscreen mode Exit fullscreen mode

Observable:

interval(1000)
  .pipe(
    filter(
      x => x % 2 === 0
    )
  )

Enter fullscreen mode Exit fullscreen mode

Output:

0
2
4
6
8
...

Enter fullscreen mode Exit fullscreen mode

Again:

Same operation.

Different delivery mechanism.


scan() Is Reduce For Infinite Data

This is where many RxJS developers finally have their "aha" moment.

Arrays use:

reduce()

Enter fullscreen mode Exit fullscreen mode

Example:

[1, 2, 3, 4]
  .reduce(
    (sum, x) => sum + x,
    0
  )

Enter fullscreen mode Exit fullscreen mode

Output:

10

Enter fullscreen mode Exit fullscreen mode

But Observables can be infinite.

They never finish.

So:

reduce()

Enter fullscreen mode Exit fullscreen mode

often doesn't make sense.

Instead RxJS gives us:

scan()

Enter fullscreen mode Exit fullscreen mode

Example:

interval(1000)
  .pipe(
    scan(
      (sum, x) => sum + x,
      0
    )
  )

Enter fullscreen mode Exit fullscreen mode

Output:

0
1
3
6
10
15
21
...

Enter fullscreen mode Exit fullscreen mode

This is:

Reduce
Over Time

Enter fullscreen mode Exit fullscreen mode

And once you see that, scan becomes incredibly intuitive.


flatMap Exists Here Too

In the previous article we discussed:

flatMap()

Enter fullscreen mode Exit fullscreen mode

Arrays:

users.flatMap(
  user => user.permissions
)

Enter fullscreen mode Exit fullscreen mode

RxJS:

searchText$
  .pipe(
    mergeMap(
      text =>
        api.search(text)
    )
  )

Enter fullscreen mode Exit fullscreen mode

Same problem.

Same solution.

The difference is:

Arrays
↓

Nested Collections

Enter fullscreen mode Exit fullscreen mode

versus

Observables
↓

Nested Streams

Enter fullscreen mode Exit fullscreen mode


switchMap, mergeMap and concatMap

These operators confuse almost everyone initially.

The reason is simple.

Arrays don't have time.

Observables do.

Suppose:

Search A
Search B
Search C

Enter fullscreen mode Exit fullscreen mode

happen rapidly.

Now:

Which API calls should survive?

Enter fullscreen mode Exit fullscreen mode

That is what these operators answer.


mergeMap

Run everything.

A
B
C

All continue.

Enter fullscreen mode Exit fullscreen mode


concatMap

Queue everything.

A
↓

B
↓

C

Enter fullscreen mode Exit fullscreen mode


switchMap

Cancel old work.

A ❌

B ❌

C ✅

Enter fullscreen mode Exit fullscreen mode

Perfect for search boxes.


Why RxJS Feels Hard

Because developers often memorize operators.

Instead of understanding patterns.

If you think:

map
filter
scan
flatMap

Enter fullscreen mode Exit fullscreen mode

then RxJS becomes much simpler.

Because you've already seen these concepts before.

In Arrays.


Real World Example: Search Autocomplete

User types:

a
ap
app
appl
apple

Enter fullscreen mode Exit fullscreen mode

Without RxJS:

You manually manage:

  • timers
  • cancellation
  • race conditions

With RxJS:

search$
  .pipe(
    debounceTime(300),
    distinctUntilChanged(),
    switchMap(
      query =>
        api.search(query)
    )
  )

Enter fullscreen mode Exit fullscreen mode

This is why RxJS exists.

It turns asynchronous complexity into composable transformations.


Real World Example: WebSocket Streams

Messages arrive continuously.

Message 1
Message 2
Message 3

Enter fullscreen mode Exit fullscreen mode

Treating them as a stream allows:

messages$
  .pipe(
    filter(
      msg => msg.priority
    ),
    map(
      msg => msg.payload
    )
  )

Enter fullscreen mode Exit fullscreen mode

Exactly like Arrays.

Except the values arrive over time.


Performance Considerations

Arrays:

array
  .map(...)
  .filter(...)

Enter fullscreen mode Exit fullscreen mode

may create intermediate arrays.

RxJS:

stream
  .pipe(
    map(...),
    filter(...)
  )

Enter fullscreen mode Exit fullscreen mode

usually processes values incrementally.

One item at a time.

This can significantly reduce memory pressure for large streams.


Pros Of Thinking This Way

1. RxJS Becomes Easier

Most operators stop feeling magical.


2. Reuse Existing Knowledge

Array knowledge transfers directly.


3. Better Mental Models

Patterns become obvious.


4. Easier Debugging

You stop treating operators as black boxes.


5. Strong Foundation For Reactive Programming

Everything else builds on these concepts.


Cons Of The Analogy

1. Arrays Are Finite

Observables may be infinite.


2. Time Changes Everything

Cancellation becomes important.


3. Concurrency Doesn't Exist In Arrays

RxJS operators must handle it.


4. Error Handling Differs

Streams behave differently from collections.


5. The Analogy Eventually Breaks

At advanced levels.

But it remains extremely useful.


The Real Lesson

The biggest mistake people make with RxJS is treating it as something completely new.

It isn't.

Most of its core ideas already exist in JavaScript.

You've seen:

map()
filter()
reduce()
flatMap()

Enter fullscreen mode Exit fullscreen mode

before.

RxJS simply applies those ideas to values that arrive over time.

And once you realize that:

Observable

≈

Array Over Time

Enter fullscreen mode Exit fullscreen mode

the entire library becomes much less intimidating.

Not because the complexity disappeared.

But because you finally have a mental model that makes sense.


What's Next?

In the next article we'll revisit one of the most misunderstood operators in RxJS:

scan() Is Reduce For Infinite Data

Because understanding scan() unlocks:

  • RxJS state management
  • Redux-like patterns
  • Event sourcing
  • Reactive architectures

and ultimately connects everything back to the humble reduce() function where this series began.


About The Author

Hi, I'm Amrish Khan.

I enjoy building developer tools, exploring software architecture, and writing about the deeper ideas behind everyday programming concepts.

I'm also building Aruvix — a growing ecosystem of local-first developer tools designed to process data directly in the browser without unnecessary uploads.

Here's a detailed blog on Aruvix:

https://dev.to/amrishkhan05/aruvix-the-ultimate-offline-first-developer-toolkit-e0i

You can follow my work and thoughts here:

Portfolio:
https://www.amrishkhan.dev

LinkedIn:
https://www.linkedin.com/in/amrishkhan

GitHub:
https://www.github.com/amrishkhan05

If you enjoyed this article, consider following for more deep dives into JavaScript, architecture, local-first software, and performance engineering.