JavaScript · Lesson 01 / 32 · தமிழ்
JavaScript அறிமுகம்
கருத்தைப் புரிந்துகொள்ளுங்கள். Code-ஐ மாற்றி இயக்குங்கள். ஒரு சிறிய பயிற்சியால் கற்றதை உறுதி செய்யுங்கள்.
மூலப் பாட விளக்கங்கள் தமிழில் உள்ளன. கூடுதல் concept, practice மற்றும் answer notes ஆங்கிலத்தில் உள்ளன.
முக்கியக் கருத்து
JavaScript connects values, calculations, and actions. Start with a named value and a console message.
Learning goal: Explain what the example does, predict its result, and change it to solve the practice task.
விரிவான விளக்கங்கள்
JavaScript என்னன்னு தெரியுமா?
JavaScript என்பது Web-ன் programming language. இது lightweight-ஆ இருக்கும், browser-லயே directly run ஆகும், functions-ஐ first-class citizens-ஆ treat பண்ணும்.
JavaScript எதுக்கெல்லாம் use ஆகுதுன்னா:
- Web pages-ஐ interactive மற்றும் dynamic-ஆ மாத்துறது
- Web applications build பண்றது — front-end-லயும் Node.js-ல back-end-லயும்
- Mobile apps — React Native, Ionic
- Desktop applications — Electron
- Game development
- Server-side programming
JavaScript ஏன் கத்துக்கணும்?
- Browser page interactions உருவாக்கப் பயன்படும் முக்கிய scripting language இது
- உலகத்துல மிகவும் popular-ஆன languages-ல ஒண்ணு
- Job market-ல demand மிகவும் அதிகமா இருக்கு
- Versatile — frontend, backend, mobile, desktop எல்லாத்துலயும் use ஆகும்
- npm-ல 1M+ packages இருக்கு — huge ecosystem
- Active community, ஒவ்வொரு வருஷமும் புதுசா evolve ஆகுது
JavaScript எப்படி வேலை செய்யுது?
JavaScript browser-ன் JavaScript engine-ல (Chrome-ல V8, Firefox-ல SpiderMonkey) directly run ஆகும். Compile பண்ண தேவையில்ல — code எழுதினதும் browser run பண்ணிடும்.
| Engine | Browser / Platform | Notes |
|---|---|---|
| V8 | Chrome, Edge, Node.js | மிக fast engine, Node.js-ஐ power பண்றது |
| SpiderMonkey | Firefox | முதல் JavaScript engine |
| JavaScriptCore | Safari | Nitro என்றும் சொல்வாங்க |
| Chakra | Legacy Edge | Modern Edge-ல V8-ஆல replace ஆச்சு |
உன்னோட முதல் JavaScript Program
// Browser console-ல output பாக்க
console.log("Hello, World!");
// Popup காட்ட
alert("Welcome to JavaScript!");
// Page-ல எழுத
document.write("<h1>Hello from JS!</h1>");Tip: Browser-ல F12 press பண்ணி Console tab-ல போ — அங்க JavaScript directly try பண்ணலாம்.
JavaScript எங்க எழுதணும்?
JavaScript-ஐ HTML-ல மூணு விதமா add பண்ணலாம்:
<!-- 1. Inline -->
<button onclick="alert('Clicked!')">Click Me</button>
<!-- 2. Internal -->
<script>
console.log("Internal script");
</script>
<!-- 3. External (best practice) -->
<script src="script.js"></script>Best Practice: External scripts use பண்றது நல்லது. <script> tag-ஐ </body>-க்கு முன்னாடி வை — page fast load ஆகும்.
முழுமையான உதாரணம்
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.
const learner = "Coding Tamilan";
const lessons = 3;
console.log("Hello, " + learner + "!");
console.log("This week: " + lessons + " lessons");எதிர்பார்க்கும் முடிவைப் பாருங்கள்
Hello, Coding Tamilan! This week: 3 lessons
மாற்றி இயக்கிப் பாருங்கள்
Load the example, change a value, predict the output, and run it again. Use the console output to check your reasoning.
Editor load ஆனதும் code-ஐ ஏற்றி Run அழுத்துங்கள்.
OneCompiler என்ற இலவச வெளிப்புற சேவை code-ஐ இயக்குகிறது. Run செய்யும் code அங்கு அனுப்பப்படும். தனிப்பட்ட தகவல்கள் அல்லது secret keys உள்ளிட வேண்டாம்.
சிறிய பயிற்சி
Practice challenge
Change lessons to 5 and predict the second line.
விடை மற்றும் விளக்கம்
This week: 5 lessons. The text stays the same; the number changes.
தவிர்க்க வேண்டிய தவறு: Java and JavaScript are separate languages. console.log writes to the console, not the webpage.
அடுத்த பாடத்திற்குத் தயாரா?
- Explain the example in your own words.
- Complete the challenge before revealing its answer.
- Describe the common mistake and how to avoid it.