JavaScript Operators — தமிழ்

</>Coding Tamilan.← JavaScript course

JavaScript · Lesson 07 / 32 · தமிழ்

JavaScript Operators

கருத்தைப் புரிந்துகொள்ளுங்கள். Code-ஐ மாற்றி இயக்குங்கள். ஒரு சிறிய பயிற்சியால் கற்றதை உறுதி செய்யுங்கள்.

Detailed notesRunnable JavaScriptPractice + answer

மூலப் பாட விளக்கங்கள் தமிழில் உள்ளன. கூடுதல் concept, practice மற்றும் answer notes ஆங்கிலத்தில் உள்ளன.

01 / Understand

முக்கியக் கருத்து

Arithmetic combines numbers; comparison produces booleans; logical operators combine conditions. Parentheses make the intended order clear.

Learning goal: Explain what the example does, predict its result, and change it to solve the practice task.

02 / Explore

விரிவான விளக்கங்கள்

JavaScript Operators

Operators என்பது variables மற்றும் values-ல operations perform பண்ண use ஆகுற symbols. JavaScript-ல பல types of operators இருக்கு.

Arithmetic Operators

Operatorபெயர்ExampleResult
+Addition5 + 38
–Subtraction5 – 32
*Multiplication5 * 315
/Division10 / 42.5
%Modulus (Remainder)10 % 31
**Exponentiation2 ** 8256
++Incrementx++x + 1
—Decrementx–x – 1
JavaScript reference fragmentCODE
let a = 10, b = 3;
console.log(a + b);   // 13
console.log(a - b);   // 7
console.log(a * b);   // 30
console.log(a / b);   // 3.3333...
console.log(a % b);   // 1
console.log(a ** b);  // 1000 (10^3)

Comparison Operators

JavaScript-ல இரண்டு equality operators இருக்கு: == (loose) மற்றும் === (strict). எப்பவும் === use பண்ணு.

JavaScript reference fragmentCODE
// Loose equality (==) — type coercion பண்ணும்
console.log(5 == "5");   // true  ← string coerced to number
console.log(0 == false); // true  ← false coerced to 0

// Strict equality (===) — type coercion இல்ல
console.log(5 === "5");  // false ← different types
console.log(5 === 5);    // true

console.log(10 > 5);     // true
console.log(10 !== 5);   // true

Rule: Modern JavaScript-ல எப்பவும் === மற்றும் !== use பண்ணு. Loose equality == confusing edge cases கொண்டுவரும்.

Logical Operators

JavaScript reference fragmentCODE
// && (AND) — இரண்டும் true-ஆ இருக்கணும்
console.log(true && true);   // true
console.log(true && false);  // false

// || (OR) — ஒண்ணு true-ஆ இருந்தாலும் போதும்
console.log(false || true);  // true

// ! (NOT) — value-ஐ invert பண்ணும்
console.log(!true);  // false

// ?? (Nullish Coalescing — ES2020)
const name = null ?? "Guest"; // null/undefined-க்கு மட்டும் trigger
const port = 0 ?? 3000;       // 0 (0 is NOT null/undefined)
03 / Read & predict

முழுமையான உதாரணம்

Run this complete index.js program in the JavaScript console editor below. The earlier reference fragments may need a browser page or other surrounding setup.

index.js · complete exampleCODE
const price = 120;
const quantity = 3;
const total = price * quantity;
console.log(total);
console.log(total >= 300 && quantity > 1);
எதிர்பார்க்கும் முடிவைப் பாருங்கள்
360
true
04 / Experiment

மாற்றி இயக்கிப் பாருங்கள்

Load the example, change a value, predict the output, and run it again. Use the console output to check your reasoning.

Open editor ↗

Editor load ஆனதும் code-ஐ ஏற்றி Run அழுத்துங்கள்.

OneCompiler என்ற இலவச வெளிப்புற சேவை code-ஐ இயக்குகிறது. Run செய்யும் code அங்கு அனுப்பப்படும். தனிப்பட்ட தகவல்கள் அல்லது secret keys உள்ளிட வேண்டாம்.

05 / Your turn

சிறிய பயிற்சி

Practice challenge

Change quantity to 2. Predict both lines.

விடை மற்றும் விளக்கம்

The total is 240 and the condition is false because 240 is below 300.

தவிர்க்க வேண்டிய தவறு: The + operator also concatenates strings. "2" + 3 is "23", while 2 + 3 is 5.

அடுத்த பாடத்திற்குத் தயாரா?

  • Explain the example in your own words.
  • Complete the challenge before revealing its answer.
  • Describe the common mistake and how to avoid it.
Coding Tamilan · Learn by doing.