Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Web Security TippsNew manual calculation setting in Google Sheets(21.09.2026 um 20:54 Uhr)
Videos & KonferenzenTechquickie: The Steam Frame Shouldn't Work - Here's Why It Does(21.09.2026 um 21:17 Uhr)
Sichere ProgrammierungHow to Build a Production-Ready iOS App With AI-Generated Code(21.09.2026 um 21:00 Uhr)
Sichere ProgrammierungAfriex Integrations: Sandbox, Idempotency, and Webhook Simulation(21.09.2026 um 21:50 Uhr)
Sichere ProgrammierungBridging Local and Cloud Databases for Centralized Data Management(21.09.2026 um 21:51 Uhr)
Web Security TippsNew manual calculation setting in Google Sheets(21.09.2026 um 20:54 Uhr)
Videos & KonferenzenTechquickie: The Steam Frame Shouldn't Work - Here's Why It Does(21.09.2026 um 21:17 Uhr)
Sichere ProgrammierungHow to Build a Production-Ready iOS App With AI-Generated Code(21.09.2026 um 21:00 Uhr)
Sichere ProgrammierungAfriex Integrations: Sandbox, Idempotency, and Webhook Simulation(21.09.2026 um 21:50 Uhr)
Sichere ProgrammierungBridging Local and Cloud Databases for Centralized Data Management(21.09.2026 um 21:51 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

JavaScript Data Types Explained: Primitive vs Non-Primitive Data Types

JavaScript Data Types: Primitive and Non-Primitive Data Types Data types are an important concept in JavaScript because they define the kind of value a variable can store. Understanding data types helps developers write reliable and…

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




JavaScript Data Types: Primitive and Non-Primitive Data Types



Data types are an important concept in JavaScript because they define the kind of value a variable can store. Understanding data types helps developers write reliable and efficient code.






What is a Data Type?



A data type defines what kind of value a variable can hold.






Example






let name = "John";      // String
let age = 25; // Number
let isActive = true; // Boolean






In the above example, each variable stores a different type of value.






Types of Data Types in JavaScript



JavaScript data types are broadly classified into two categories:




  1. Primitive Data Types

  2. Non-Primitive Data Types









Primitive Data Types



Primitive data types store a single and simple value.






Characteristics




  • Store a single value.

  • Immutable (cannot be changed directly).

  • Compared by value.

  • Stored directly in memory.






Types of Primitive Data Types






1. String



Used to store textual data.




let name = "John";









2. Number



Used to store numeric values.




let age = 25;
let price = 99.99;









3. Boolean



Represents either true or false.




let isLoggedIn = true;









4. Undefined



A variable that has been declared but not assigned a value.




let city;

console.log(city); // undefined









5. Null



Represents the intentional absence of a value.




let user = null;









6. Symbol



Used to create unique identifiers.




let id = Symbol("id");









7. BigInt



Used to store very large integers beyond the safe Number limit.




let largeNumber = 123456789012345678901234567890n;












Non-Primitive Data Types



Non-primitive data types store multiple values or complex data structures.






Characteristics




  • Can store collections of data.

  • Mutable (their contents can be modified).

  • Compared by reference.

  • Stored as references in memory.






Types of Non-Primitive Data Types






1. Array



Used to store multiple values in a single variable.




let colors = ["red", "green", "blue"];









2. Object



Used to store data as key-value pairs.




let person = {
name: "John",
age: 25
};









3. Function



Functions are reusable blocks of code.




function greet() {
console.log("Hello");
}









4. Date



Used to work with dates and times.




let today = new Date();









5. Regular Expression (RegExp)



Used for pattern matching and text validation.




let pattern = /hello/i;












Primitive vs Non-Primitive Data Types






































Feature Primitive Data Types Non-Primitive Data Types
Value Type Single and Simple Value Multiple or Complex Values
Mutability Immutable Mutable
Comparison By Value By Reference
Memory Storage Direct Value Reference to Object
Examples String, Number, Boolean Array, Object, Function





Example of Primitive Comparison






let a = 10;
let b = 10;

console.log(a === b); // true






The values are compared directly.






Example of Non-Primitive Comparison






let obj1 = { name: "John" };
let obj2 = { name: "John" };

console.log(obj1 === obj2); // false






Although both objects contain the same data, they occupy different memory locations.









Conclusion



JavaScript data types are divided into Primitive and Non-Primitive categories. Primitive data types store simple values and are immutable, while Non-Primitive data types store complex data structures and are mutable. Understanding the differences between these data types is essential for writing efficient and bug-free JavaScript applications.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten JavaScript Data Types Explained: Primitive vs Non-Primitive Data Types

Thematisch verwandte Begriffe: JavaScript, Data, Types, Explained · 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-94497 | jshERP through 3.6 fails to validate object ownership in by-id info, upd…
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 ⏱️ 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