Programming Basics
Essential programming concepts and fundamentals
Variables
javascriptVariable declaration and scoping
// let - block scoped, can be reassigned
let count = 0;
count = 1;
// const - block scoped, cannot be reassigned
const PI = 3.14159;
// var - function scoped (avoid using)
var name = 'John';Data Types
javascriptCommon data types in programming
// Numbers
const integer = 42;
const float = 3.14;
// Strings
const text = 'Hello';
// Booleans
const isActive = true;
// Arrays
const numbers = [1, 2, 3];
// Objects
const user = {
name: 'John',
age: 30
};Control Flow
javascriptBasic control flow statements
// If statement
if (condition) {
// code
} else if (otherCondition) {
// code
} else {
// code
}
// For loop
for (let i = 0; i < 5; i++) {
console.log(i);
}
// While loop
while (condition) {
// code
}