![]() #JAVASCRIPT BASIC DATA TYPES CODE#The usage of let is similar to var, but the declared variable is only valid within the let code block once const is declared, the value of the constant cannot be changed. The let command is added to declare variables in es6, and the const command declares a read-only constant The so-called loose type can be used to store any type of data. This is ECMAScriptIt is the origin of the loose type. Use the var keyword to define variables in ECMAScript, because jsIt is a weak type, so it is impossible to determine what value the variable will store, and it is not known what type the variable will be, and the type of the variable can change at any time. For the value of a reference type, you can add attributes and methods to it, or change and delete its attributes and methods. Copying the value of a reference type from one variable to another variable is actually a pointer, so the two variables ultimately point to the same object.ģ. The variable containing the value of the reference type actually contains not the object itself, but a pointer to the object. The value of the reference type is an object, which is stored in the heap memory. When operating the object, it is actually operating the reference of the object instead of the actual object Ģ. js does not allow direct access to the location in the memory, that is, it cannot directly access the memory space of the operating object. Reference type values are objects that can be composed of multiple values. Reference type data: object (also array, function)ġ. It is not possible to add attributes to basic types of values. these types are basic data types but are very powerful because data structures in JavaScript are built using. But in basic terms, selecting the right data type for the right application is important. ![]() (Copying a basic type value from one variable to another variable will create a copy of this value) ģ. Data types are also a relevant topic for data structures, which is for more advanced programmers. The value of the basic type occupies a fixed size of space in the memory and is stored in the stack memory. The five basic types are all accessed by value (the actual value stored in the variable can be manipulated) Ģ. ![]() The basic data type value refers to a simple data segment. There are five basic data types (also called simple data types) in JavaScript: undefined, null, bolean, number, and string there is also a complex data type: object.ġ. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |