

The enum data type is a collection of unique values that you can compare and use as these. In older languages, for example, in C, booleans were stored as 0 and 1. In most modern programming languages, you can assign and use the value exactly like that. As the character data type, the string can also store digits, but in the form of text.Ī simple example of a string is: “hello world”, but it could also be “hello world 5!” Boolean (bool)īooleans represent a single statement, true or false. Strings are sequences of characters and they store text. It has the size of 1 byte and thus uses 8 bits. The character is a super basic data type that stores precisely one letter, a digit, or other symbols. Thus the borders are from -1.7976931348623158E+308 to 1.7976931348623158E+308.įrom these borders, we can say that you should use both floating-point data types in the following scenarios: Character (char) Double (double)ĭouble works exactly as float, just as a 64-bit version. If this guide is helpful to you and you like what I do, please support me with a coffee!Ĭontrary to integers, the floating-point borders aren’t whole numbers. They are commonly referred to as follows:
#Basic data types in javascript year 32 bit
In addition to the basic 32 Bit Integer, there are multiple variations with more or fewer bits. It stores whole numbers, for example, 1, 90, or 1999, with a maximum and minimum value determined by the number of bits! Basic Data Types Integer (int)Ī commonly used numeric data type is the Integer. Type-safe languages for example are C# or Java.
#Basic data types in javascript year how to
In type-safe languages on the other you need to know the basic data types, because you how to use them to create variables. But, how should the program know what to do with the value? For example, you have a function that works with numbers, but you pass it a string. One error that you encounter in type-unsafe languages is that you can pass any type as the value of your function. In these languages, you need to understand the existence of the different data types, write better-optimized code, and reduce some errors that can occur in these types of languages.

Data Types are one of the fundamental concepts of programming that you need to know! Some programming languages do the job of using the correct data type for you, i.e., Python or JavaScript.
