Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungWe Built a CLI to Find Out If You’re Overpaying for Claude(24.09.2026 um 04:35 Uhr)
Sichere ProgrammierungMy own sandbox was killing my agent's shell, and the exit code hid it(24.09.2026 um 04:38 Uhr)
Sichere ProgrammierungHow three OSLabs engineers built a CLI to catch you overpaying Claude(24.09.2026 um 04:45 Uhr)
Sichere ProgrammierungBreaking CI Guards on Purpose to Prove They Can Fail(24.09.2026 um 05:00 Uhr)
IT Security NachrichtenLangfristige Updatefähigkeit als Pflicht(24.09.2026 um 05:03 Uhr)
Sichere ProgrammierungWe Built a CLI to Find Out If You’re Overpaying for Claude(24.09.2026 um 04:35 Uhr)
Sichere ProgrammierungMy own sandbox was killing my agent's shell, and the exit code hid it(24.09.2026 um 04:38 Uhr)
Sichere ProgrammierungHow three OSLabs engineers built a CLI to catch you overpaying Claude(24.09.2026 um 04:45 Uhr)
Sichere ProgrammierungBreaking CI Guards on Purpose to Prove They Can Fail(24.09.2026 um 05:00 Uhr)
IT Security NachrichtenLangfristige Updatefähigkeit als Pflicht(24.09.2026 um 05:03 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

JavaScript Variables: let vs const vs var

JavaScript Simplified: A Beginner's Guide to Mastering Interactive Web Development Post 4 of 30: Understanding Variables in JavaScript In this post, we’ll explore what variables are, how to declare them, and how they work in J…

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




JavaScript Simplified: A Beginner's Guide to Mastering Interactive Web Development






Post 4 of 30: Understanding Variables in JavaScript



In this post, we’ll explore what variables are, how to declare them, and how they work in JavaScript.









What is a Variable?



A variable is a way to store a value in JavaScript so we can use it later. Think of a variable like a labeled box where you can keep things and retrieve them when needed.



For example, instead of writing "John" multiple times in your code, you can store it in a variable and use it anywhere.









Declaring Variables in JavaScript



JavaScript provides three ways to declare variables:





  • var (older method, not recommended)


  • let (modern and recommended for changeable values)


  • const (for values that should not change)








let name = "John";
console.log(name);






Output:




John






Here, we:




  • Created a variable called name

  • Assigned it the value "John"

  • Used console.log() to print the value of name






2. Using const (For Constant Values)






const PI = 3.1416;
console.log(PI);






Output:




3.1416








  • const is used for values that should not change.

  • Once assigned, you cannot reassign a new value to PI.






3. Using var (Older Method – Avoid Using)






var age = 25;
console.log(age);






Output:




25








  • var was commonly used before let and const, but it has scoping issues, so use let or const instead.









Changing Variable Values



With let, you can change a variable’s value, but with const, you cannot.






Example with let:






let city = "New York";
console.log(city); // Output: New York

city = "Los Angeles"; // Changing the value
console.log(city); // Output: Los Angeles









Example with const (This will cause an error)






const country = "USA";
console.log(country);

country = "Canada"; // ❌ This will cause an error
console.log(country);






Error: Uncaught TypeError: Assignment to constant variable.









Variable Naming Rules



When naming variables, follow these rules:


✔️ Can contain letters, numbers, $, and _


✔️ Must start with a letter, $, or _ (not a number)


✔️ Case-sensitive (name and Name are different)


✔️ Cannot be a reserved keyword (like let, console, function, etc.)





Examples of Valid Variable Names:





let firstName = "Alice";
let _score = 90;
let $price = 20;
let userAge = 25;







Examples of Invalid Variable Names:





let 1name = "Bob";  // ❌ Cannot start with a number
let let = 50; // ❌ "let" is a reserved keyword
let user-age = 30; // ❌ Hyphens are not allowed









Practical Exercise: Storing and Changing Values



Try this in your script.js file:




let favoriteFood = "Pizza";
console.log("My favorite food is:", favoriteFood);

favoriteFood = "Burger";
console.log("Now, my favorite food is:", favoriteFood);






Expected Output:




My favorite food is: Pizza
Now, my favorite food is: Burger












Next Steps



Now that we understand how variables work, the next step is to explore data types in JavaScript—including numbers, strings, booleans, and more!



Stay tuned for the next post! 🚀









Pro Tip:



🔹 Use let when you expect the value to change.


🔹 Use const when the value should stay the same.


🔹 Avoid var unless you specifically need it.



Follow me on LinkedIn - Ridoy Hasan

Visit my website - Ridoyweb

*Visit my agency website *- webention digital

SOC Incident Playbook: Vulnerability Remediation & Verification
title: Detect Exploitation - JavaScript Variables: let vs const vs var
id: 218462dc-1432-46c1-8a7f-ac9dfe3420cc
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 = "JavaScript Variables: let vs c" ascii wide
    condition:
        any of them
}
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich JavaScript Variables: let vs const vs va.... 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 JavaScript Variables: let vs const vs var

Thematisch verwandte Begriffe: JavaScript, Variables, const · 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 ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-96676 | A vulnerability was identified in Fast FAC1900R 20190827_2.0.2. The impa…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
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
🔖 Gespeicherte Artikel
📂 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...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick