JavaScript தொடங்குவோம் — தமிழ்

</>Coding Tamilan.← JavaScript course

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

JavaScript தொடங்குவோம்

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

Detailed notesRunnable JavaScriptPractice + answer

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

01 / Understand

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

You can begin in a browser console or the editor below. Run a small script first, then move it into a project file. Browser page scripts can use a deferred external script so the HTML is parsed before the script runs.

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

02 / Explore

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

JavaScript எப்படி Run பண்றது?

JavaScript எங்கயும் run ஆகும் — browser-ல, Node.js-ல server-ல, desktop apps-லயும் கூட. Start பண்ண எந்த installation-உம் தேவையில்ல.

1. Browser Console

JavaScript try பண்ண fastest way — browser-ல built-in console.

  1. எந்த browser-உம் open பண்ணு (Chrome, Firefox, Edge)
  2. F12 press பண்ணு (அல்லது right-click → Inspect)
  3. Console tab-ல click பண்ணு
  4. JavaScript type பண்ணி Enter press பண்ணு

DevTools Console

JavaScript reference fragmentCODE
> console.log("Hello, World!");
Hello, World!
< undefined

> 2 + 2
< 4

> [1,2,3].map(x => x * 2)
< [2, 4, 6]

2. HTML-ல JavaScript

எந்த HTML page-லயும் <script> tag மூலம் JavaScript add பண்ணலாம்.

JavaScript reference fragmentCODE
<!DOCTYPE html>
<html>
<head>
  <title>My Page</title>
</head>
<body>
  <h1 id="title">Hello</h1>

  <!-- Script-ஐ </body>-க்கு முன்னாடி வை -->
  <script src="script.js"></script>
</body>
</html>
JavaScript reference fragmentCODE
// script.js
document.getElementById("title").textContent = "Hello from JavaScript!";

3. Node.js (Server-side)

Node.js-ஐ use பண்ணா JavaScript-ஐ browser இல்லாம — உன்னோட computer-லயோ server-லயோ run பண்ணலாம்.

  1. nodejs.org-ல இருந்து Node.js download பண்ணு
  2. hello.jsன்னு file create பண்ணு
  3. Terminal-ல run பண்ணு: node hello.js

Terminal

JavaScript reference fragmentCODE
$ node hello.js
Hello from Node.js!
Node version: v21.0.0
Environmentஎப்படி run பண்றதுUse case
Browser ConsoleF12 → Console tabQuick experiments
HTML + Script tag.html-ஐ browser-ல open பண்ணுWeb pages
Node.jsnode filename.jsServer, scripts, CLIs
Online editorscodepen.io, jsfiddle.netSharing & demos
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
console.log("My first JavaScript session");
console.log(12 + 8);
எதிர்பார்க்கும் முடிவைப் பாருங்கள்
My first JavaScript session
20
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

Print your name on one line and 7 multiplied by 6 on the next.

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

Use console.log("Your name"); followed by console.log(7 * 6);. The second line is 42.

தவிர்க்க வேண்டிய தவறு: Do not include the Console prompt symbol > when copying a command. Browser DOM APIs are not available in every JavaScript runtime.

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

  • 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.