Learning LabBasic Components

πŸ”§ Training β€” Basic Components

📚 70 questions⏱ 15-20 min🏆 Instant feedback

πŸ”§ Basic Components JavaScript

JavaScript

🎯 What You Will Learn in This Training

This interactive training will help you master JavaScript Components No :

  • βœ… Ali covering all
  • βœ… var, let, const
  • βœ… data types using
  • βœ… using No
  • βœ… (Scope) variables
  • βœ… definition using functions (Functions)
  • βœ… expression (Expressions)
  • βœ… Ability to retake the training to improve your level and reinforce concepts
  • βœ… string writing code better

πŸ—οΈ Basic Components JavaScript?

Basic Components JavaScript . , JavaScript Basic Components language execution .

  • βœ… variables (Variables): data
  • βœ… data types (Data Types): type
  • βœ… No (Operators):
  • βœ… functions (Functions): Restart using
  • βœ… (Scope): variables
  • βœ… expression (Expressions): Ali

πŸ“¦ variables (Variables) - data

variables data memory. type data variables using No No :

// definition variables
var name = "Ahmed"; // method ( )
let age = 25; // variables variable ( )
const PI = 3.14; // variables constant

// let const
age = 26; // βœ… ( change value let)
// PI = 3.15; // ❌ False! No change value const

string :const , let only change value.

🧩 data types (Data Types)

JavaScript data :

  • (Primitive Types):
    • String - string
    • Number -
    • Boolean - (true/false)
    • undefined -
    • null - value
    • Symbol -
  • (Reference Types):
    • Object - object
    • Array -
    • Function - functions
    • Date -
// data types
let text = "Hello "; // String
let number = 42; // Number
let isActive = true; // Boolean
let person = { // Object
name: "Ahmed",
age: 25
};
let colors = [" ", " ", " "]; // Array

βž— No (Operators) -

No variables. :

  • No calculation: +, -, *, /, %
  • No comparison: ==, ===, !=, !==, >, <, >=, <=
  • No: && ( ), || ( ), ! ( )
  • No: =, +=, -=, *=, /=
  • No condition: ? : (operator condition No )
// No
let x = 10 + 5; // 15 ( )
let y = 20 * 2; // 40 ( )
let isEqual = (5 == "5"); // true ( )
let isStrictEqual = (5 === "5"); // false ( )
let result = (10 >5) && (3< 7"); // true ( )
x += 5; // x = 20 (addition )
let message = (age >= 18) ? " " : " "; // operator condition

βš™οΈ functions (Functions) - code Restart No

functions code definition, code organization Restart using.

// definition functions
// 1. function definition
functiongreet(name) {
return"Hello " + name;
}

// 2. expression function (Function Expression)
const add = function(a, b) {
return a + b;
};

// 3. functions (Arrow Functions) - ES6+
const multiply = (a, b) => a * b;

// 4. functions (Anonymous Functions)
setTimeout(function() {
console.log(" execution 2 ");
}, 2000);

// call functions
console.log(greet("Ahmed")); // "Hello Ahmed"
console.log(add(5, 3)); // 8
console.log(multiply(4, 6)); // 24

🌐 (Scope) - variables

variable code. command errors.

  • (Global Scope): variables
  • (Function Scope): variables only function ( var)
  • (Block Scope): variables only { } ( let const)
let globalVar = " "; //

functiontestScope() {
var functionVar = " "; //
console.log(globalVar); // βœ…
console.log(functionVar); // βœ…

if (true) {
let blockVar = " "; //
console.log(blockVar); // βœ…
}
// console.log(blockVar); // ❌ False! No
}

testScope();
// console.log(functionVar); // ❌ False! No function

🎯 Choose Training Mode