Variables, Scope, and Memory
This chapter provides information on working with primitive and reference values in variables, understanding execution context, and understanding garbage collection. The nature of variables in JavaScript, as defined in ECMA‐262, is quite unique compared to that of other languages. ECMAScript variabl...
Gespeichert in:
1. Verfasser: | |
---|---|
Format: | Buchkapitel |
Sprache: | eng |
Schlagworte: | |
Online-Zugang: | Volltext |
Tags: |
Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
|
Zusammenfassung: | This chapter provides information on working with primitive and reference values in variables, understanding execution context, and understanding garbage collection. The nature of variables in JavaScript, as defined in ECMA‐262, is quite unique compared to that of other languages. ECMAScript variables may contain two different types of data: primitive values and reference values. Primitive values are simple atomic pieces of data, while reference values are objects that may be made up of multiple values. Primitive values have one of the five primitive data types: Undefined, Null, Boolean, Number, and String. Some characteristics include fixed size, copying values from one variable to another creates a second copy, reference values are stored in memory on the heap, and variable containing a reference value actually contains just a pointer to the object, not the object itself. JavaScript is a garbage‐collected programming environment where the developer need not be concerned with memory allocation or reclamation. |
---|---|
DOI: | 10.1002/9781118722176.ch4 |