What is data?
By now you have heard the term
data thrown around. What is it? Like really, and how do we use it as software developers?
We would use data, like names, addresses, bank account numbers to write financial software for example. When it comes to coding that data comes in two forms, in databases or in variables. We will leave databases alone for the moment and just focus on the later.
We have previously explored variables like in our Pythagorean Theorem example. There were variables like
c. Each of these variables held a value, and that value was our data. Yes, data is that simple. In a basic, practical concept, data is just values of variables.
There are two high level categories of data:
primitive category we have
symbol. For the rest of these articles, we will be ignoring the last two data types that I referenced as they are used in very specific and advanced use cases. (I myself have not yet used them in a professional project)
complex category we have
In most programming languages, when you declare a variable, you also need to declare what data type that variable will hold; be it a number, a word or phrase, etc. Throughout the program that variable will always need to remain that data type. However, in JS, we do not need to declare the data type of a variable, and when we want to change the value of a variable, we can change it to any other data type that we like.
let name = 'Joshua' console.log(name) // would log out Joshua name = 30 console.log(name) // would print out 30 with no error.
This feature of the language come with great power over how your code operates. Yet, remember Uncle Ben "comes great responsibility". Chaning data types with no discipline can lead to confusing code that is hard for a teammate (or your future self) to follow. I will spend my efforts, to the best of my ability, ignoring this feature of the language throughout these articles.