Introduction to JavaScript!
JavaScript is a programming language that gives interaction to a webapp used on both the server-side and client-side to create engaging website elements, fully featured web applications, CLI applications and even web servers.
JavaScript is used for interactivity and logic
Variables: placeholder for values
How to declare variables in JavaScript.
- var: The
varkeyword is used to declare a variable that can be reassigned. - let: The
letkeyword is used to declare a block-scoped variable that can be reassigned. - const: The
constkeyword is used to declare a block-scoped constant that cannot be reassigned
Declare a variable and
Initialize a variable, you can declare a variable without initializing it that moment..
JavaScript Data types
- String: is represented with a single or double quote( ' ' or " ")
- Numbers: Floats or integers
- Arrays: Related data types and is represented with a square bracket ( [ ] ) we use it to store relative data
- Object: They are used to create or give meanings to an entity.
Heap and stack are made up of Random access memory;
-
Heap: This is a structured data that can grow dynamically overtime and can be slower due to manual memory management and potential fragmentation.
-
Stack: Typically has a limited size, generally faster due to automatic memory management.
JavaScript is extremely versatile.