Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
•
YouTube Security VideosNeil Patel: The 3-Search Test For Your Business #shorts(24.09.2026 um 20:04 Uhr)
•
YouTube Security VideosLinus Tech Tips: The One Apple Product I Fanboy Over(24.09.2026 um 20:18 Uhr)
•
YouTube Security VideosMicrosoft Mechanics: One Prompt Builds Your Copilot Agent(24.09.2026 um 20:15 Uhr)
••
Sichere ProgrammierungAI-powered fuzzing with the GitHub Security Lab Taskflow Agent(24.09.2026 um 20:26 Uhr)
•••
Sichere ProgrammierungBuilt an Agentic Fraud Investigator using(24.09.2026 um 20:15 Uhr)
•
Sichere ProgrammierungBuilding a fraud investigator that argues with itself(24.09.2026 um 20:15 Uhr)
••
YouTube Security VideosNeil Patel: The 3-Search Test For Your Business #shorts(24.09.2026 um 20:04 Uhr)
•
YouTube Security VideosLinus Tech Tips: The One Apple Product I Fanboy Over(24.09.2026 um 20:18 Uhr)
•
YouTube Security VideosMicrosoft Mechanics: One Prompt Builds Your Copilot Agent(24.09.2026 um 20:15 Uhr)
••
Sichere ProgrammierungAI-powered fuzzing with the GitHub Security Lab Taskflow Agent(24.09.2026 um 20:26 Uhr)
•••
Sichere ProgrammierungBuilt an Agentic Fraud Investigator using(24.09.2026 um 20:15 Uhr)
•
Sichere ProgrammierungBuilding a fraud investigator that argues with itself(24.09.2026 um 20:15 Uhr)
•
Intelligence View
⚡ tsecurity.de Intelligence

👉 Gathering Magic: How .reduce() is JavaScript Alchemy

Is this really a dev blog if I don't post about .reduce()?! When I moved into ES6 iterator methods, I was excited. Sure vanilla JS was fun and all, but I was seriously ready to understand faster more concise ways to do things - and then…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Is this really a dev blog if I don't post about .reduce()?!



When I moved into ES6 iterator methods, I was excited. Sure vanilla JS was fun and all, but I was seriously ready to understand faster more concise ways to do things - and then came .reduce()!






😱 Reduce Scares People — Just Look at It






let numArray = [1, 2, 3, 4, 5];
numArray.reduce((acc, cur) => acc + cur, 0);






Is this some strange incantation? Am I turning lead into gold? Well, sort of! Reduce is like JavaScript alchemy, and I love it.






🧺 What .reduce() is Doing




  • With every iteration (loop over the array), you can pick something up and put it in your magic basket.

  • The accumulator (often shortened to acc) is your basket — and you get to decide what kind of basket you want to carry!

  • The initial value you give to .reduce() is the starting basket:


    • 🧮 A number (sum up values)

    • ✏️ A string (concatenating stuff)

    • 🗂️ An object (building new structures)

    • 📦 An array (flattening, regrouping, etc.)






  • Every time you return from the function, you hand the basket back to .reduce() for the next loop.


    • When .reduce() finishes walking through the array, it hands you back the final, filled basket.











🔢 A Basic Example: Summing Numbers



We'll use .reduce() to return the total of all the numbers in an array:




const arrayOfNums = [1, 2, 3, 4, 5];
const sumOfNumbers = (array) => {
return array.reduce((acc, cur, i) => {
console.log(`iteration ${i + 1}`)
console.log(`accumulator: ${acc}, currentValue: ${cur}`)
console.log(`${acc} + ${cur}`)
acc += cur;
console.log(`total: ${acc}\n`);
return acc;
}, 0);
}
// sumOfNumbers(arrayOfNums) returns 15









👀 Logging What Happens



Those console.log() statements are everything when it comes to really seeing what's happening when the method runs.




iteration 1
accumulator: 0, currentValue: 1
0 + 1
total: 1

iteration 2
accumulator: 1, currentValue: 2
1 + 2
total: 3

iteration 3
accumulator: 3, currentValue: 3
3 + 3
total: 6

iteration 4
accumulator: 6, currentValue: 4
6 + 4
total: 10

iteration 5
accumulator: 10, currentValue: 5
10 + 5
total: 15









🧠 Breaking Down the Callback: acc, cur, and More



When you use .reduce(), you're passing in a callback function that runs once for every item in the array.

That callback can take up to four parameters. Let's demystify them:




  • acc (the accumulator) – This is your basket. It starts as whatever you pass in as the initialValue, and it gets carried through each iteration.


  • cur (the current value) – This is the current item from the array that you're looking at during the iteration.


  • index (optional) – The position of the current item in the array - sometimes just shortened to i. Super useful when you want to know where you are.

    (And don’t forget: arrays are zero-indexed — meaning the first element has an index of 0, the second has 1, and so on.)


  • array (optional) – The original array being reduced.

    (Apparently handy, but to be honest... I've never really needed it.)




You don’t have to include all four — just the ones you actually need.





📝 A Slightly Spicier Example: Building a Sentence



Take an array of words. We'll use .reduce() to build a sentence and utilize index for more than logging.




const arrayOfWords = ["My", "name", "is", "Beza"];
const buildSentence = (arr) => {
return arr.reduce((acc, cur, i) => {
if (i === arr.length - 1) {
acc += cur + ".";
} else {
acc += cur + " ";
}
return acc;
}, "")
}
// buildASentence(arrayOfWords) returns "My name is Beza."









🔍 What's Different This Time?



Notice how we added some conditions:




  • If we're at the last word (i === arr.length - 1), we add a period


  • Else we add a space after the word







🛠 Not Just Gathering — Deciding



.reduce() isn’t just gathering stuff — it’s also deciding how to gather based on where we are in the array!

It can build, shape, and transform as it walks through the data — and you, the developer, are the magician casting the spell.

Once it clicks, the possibilities for its use feel endless.






🪄 Start Small and Keep Practicing



If .reduce() still feels confusing, don't worry - it's completely normal at first.

Don't give up. Circle back to the basic numbers example and add your own console.log() statements.



The more you watch the basket being filled piece by piece, the more natural .reduce() will start to feel. And when it clicks, you'll feel the magic!

SOC Incident Playbook: Vulnerability Remediation & Verification
title: Detect Exploitation - 👉 Gathering Magic: How .reduce() is JavaScript Alchemy
id: 0d6a69ca-8e8d-4130-a267-cfc5b23e1ae9
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "👉 Gathering Magic: How .reduce" ascii wide
    condition:
        any of them
}
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich 👉 Gathering Magic: How .reduce() is Java.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten 👉 Gathering Magic: How .reduce() is JavaScript Alchemy

Thematisch verwandte Begriffe: Gathering, Magic, reduce, JavaScript · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-57175 | Python Social Auth is a social authentication/registration mechanism. Pr…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel • Rechts: nächster Artikel • unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...
↗ Original-Quelle