DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

TimNguyen21
TimNguyen21

Posted on

Understanding Javascript Data Types

When starting out on learning how to use javascript, one must understand how javascript interpret these data types that is passed through javascript. Without knowing the difference between data types, it can create errors within the javascript functionality. When creating javascript functionalities, one of the creator's main goals should have little to no bugs within their codes. If there are bugs within the code, it can be difficult to resolve the bug problems if there are large amount of code lines within one's work.

Understanding the difference between data types that are used in javascript will be helpful when creating functions. There are six primitive data types in javascript and they are:

  • null
  • undefined
  • Boolean
  • Number
  • String
  • Symbol

When we are able to know the difference between these data types in javascript, we can reduce the problems of data types error in our code. For example, we would like to compare a number value with the use of Number and String data type. If we are strictly using numbers to be used for comparison, using a String value can give an output that is not intended. This can cause the functionality to provide the wrong output which can lead to possible errors to the overall code itself.

Top comments (0)

Here is a post you might want to check out:

Regex for lazy developers

regex for lazy devs

Sorry for the callout ๐Ÿ˜†