»Ë»Ñ Æ÷·³

JavaScript Data Types

 

20240708103541_UsQiXHS25h.jpeg

 

 

20240708103542_e5pLdZRRZK.jpeg

 

 

20240708103542_xvjIMhfqVq.jpeg

 

 

20240708103544_bTZ6sKOGTL.jpeg

 

 

20240708103545_QzDnNdyjCP.jpeg

 

(1) ±×¸² 1: In Javascript, every value is either an object or a primitive value.


(2) ±×¸² 2: There are 7 primitive data types: 

1️⃣Number 2️⃣String 3️⃣Boolean 4️⃣Undefined 5️⃣Null 6️⃣Symbol 7️⃣BigInt


(3) Numbers are always floating point numbers, meaning that they always have decimals even if we don¡¯t see or define them. For example, the value, 23, is exactly like having 23.0. And both 23 and 23.0 are Number data type. Unlike other programming languages, both integers and floats are simply of the type Number in Javascript.


(4) Undefined is the value taken by a variable that is not yet defined. And the variable that¡¯s not yet defined is simply just a variable that we declared but without assigning a value, like the ¡°children¡± variable. So basically, Undefined means empty value.


(5) Null is pretty similar to Undefined. Null also means empty value, but it is used in different circumstances. 


(6) Symbol was introduced in ES2015 (ES6), and Symbol is not really useful. It simply defines a value that is unique and cannot be changed.


(7) Starting in ES2020, there is also BigInt which is for integers that are too large to be represented by the number type. It is another type for Numbers. 


(8) Dynamic typing: In Javascript, it¡¯s the value that has a type, not the variable. Variables simply store values that have a type. 


(9) Dynamic typing: we can assign a new value with a different data type to the same variable without a problem. This can be useful, but it can also be the source of some difficult-to-find bugs and errors in codes. 


(10) ±×¸² 3~4: typeof is an operator like +, - ¡¦ typeof shows the type of a value. The result of using typeof operator on a value will be a string that denotes the type of the value. 


(11) ±×¸² 5: ¡°typeof null¡± returns object. It is a Javascript bug or (an error). However, the bug is never corrected for legacy reasons. Null is not an object AT ALL. It should return null, just as type of undefined returns undefined.

 

0
ÃßõÇϱ⠴ٸ¥ÀÇ°ß 0
|
°øÀ¯¹öÆ°
÷ºÎÆÄÀÏ
  • IMG_8505.jpeg
  • IMG_8506.jpeg
  • IMG_8507.jpeg
  • IMG_8508.jpeg
  • IMG_8509.jpeg
  • ¾Ë¸² ¿å¼³, »óó ÁÙ ¼ö ÀÖ´Â ¾ÇÇÃÀº »ï°¡ÁÖ¼¼¿ä.
©¹æ »çÁø  
¡â ÀÌÀü±Û¡ä ´ÙÀ½±Û