Hey everyone!
Today in our JavaScript class, I learned some really important basic concepts that are super helpful for beginners like me. I’m sharing them here as a quick reference and recap for anyone starting their JavaScript journey.
JavaScript Data Types – Total 8
JavaScript has 8 different types of data:
- String – Text (Example: "Hello")
- Number – Numbers (Example: 10, 3.14)
- BigInt – Very large numbers (Example: 12345678901234567890n)
- Boolean – true or false
- Undefined – A variable declared but not assigned any value
- Null – Intentional empty value
- Symbol – Unique identifiers
- Object – Collection of key-value pairs
What is an Object?
An object is like a container that stores state and behavior.
In simple words, it’s a collection of properties (attributes) and methods (actions).
What are Attributes?
Attributes are the values or information stored inside an object.
For example, in the above person object, name and age are attributes.
** Variables in JavaScript – var, let, const**
In JavaScript, we use these to store data:
- var – Function scoped, can be redeclared and reassigned
- let – Block scoped, can be reassigned (not redeclared)
- const – Block scoped, cannot be reassigned
Internal vs External JavaScript
You can use JavaScript in two ways:
- Internal – Inside tags in the HTML file</li> <li> External – In a separate .js file and link it using <script src="file.js">
Printing Output – console.log()
We use console.log() to print results or debug our code.
Programming Language Types
There are two main types:
- Statically Typed – Data types are fixed (like Java)
- Dynamically Typed – Data types can change during runtime (like JavaScript)
Compiled vs Interpreted Languages
- Compiled – Entire code is converted before running (e.g., C, C++)
- Interpreted – Code is read and run line-by-line (e.g., JavaScript, Python)
Conclusion
It was a productive session today!
Learning about data types, variables, and how JavaScript works internally really helped me understand the basics better. These are the building blocks of JavaScript, and I’m excited to keep learning more!
Top comments (5)
Really helpful, thanks!
You can format inline code by keeping them between backticks.
I liked the succinct point about the difference between
undefined
&null
.Noted, thanks!
Very nice!
Thank you!