Home » Tech Tutorials » Web Development » JavaScript » Introduction to JavaScript

Introduction to JavaScript

JavaScript పరిచయం

JavaScript అనేది web pages కు interactivity మరియు dynamic behavior జోడించడానికి ఉపయోగించే programming language. HTML page యొక్క structure ను తయారు చేస్తుంది, CSS design ను నిర్వహిస్తుంది, JavaScript page ఎలా స్పందించాలో నిర్ణయిస్తుంది.

JavaScript తో ఏమి చేయవచ్చు?

  • Button click చేసినప్పుడు action చేయవచ్చు.
  • Form data ను validate చేయవచ్చు.
  • Web page content ను dynamic గా మార్చవచ్చు.
  • Animations మరియు interactive features తయారు చేయవచ్చు.
  • Browser applications మరియు server-side applications నిర్మించవచ్చు.

JavaScript ఎలా పనిచేస్తుంది?

Browser JavaScript code ను చదివి execute చేస్తుంది. Code ను test చేయడానికి ఈ lesson లో console.log() ఉపయోగిస్తున్నాము. Universal Code Editor యొక్క JavaScript mode లో code run చేసినప్పుడు output console లో కనిపిస్తుంది. Browser environment, Node.js environment మరియు website editor environment లో కొన్ని features వేరుగా ఉండవచ్చు.

మొదటి JavaScript concepts

const ద్వారా ఒక value ను variable లో store చేయవచ్చు. Text value ను string అంటారు. console.log() ద్వారా value లేదా message ను console లో చూపించవచ్చు. రెండు strings ను + operator తో కలిపి ఒక message తయారు చేయవచ్చు.

JavaScript statements సాధారణంగా semicolon తో ముగుస్తాయి. Modern JavaScript లో value మార్చనప్పుడు const ను, value మార్చాల్సి వచ్చినప్పుడు let ను ఉపయోగించడం మంచి practice.

Simple Explanation

JavaScript ను ఒక web page యొక్క brain లాగా ఊహించుకోవచ్చు. HTML శరీరాన్ని, CSS రూపాన్ని ఇస్తే, JavaScript user action కు response ఇవ్వడం వంటి పనులను చేస్తుంది.

ఉదాహరణకు, user button పై click చేసినప్పుడు message చూపించడం, ఒక number ను calculate చేయడం లేదా page లోని text ను మార్చడం JavaScript ద్వారా చేయవచ్చు. ఈ lesson లో variables, strings మరియు console.log() అనే basic concepts ను పరిచయం చేసుకుంటాము.

Real-Life Example

ఒక vending machine ను ఊహించుకోండి. HTML machine యొక్క buttons మరియు display ను తయారు చేస్తుంది. CSS వాటి రంగులు మరియు design ను ఇస్తుంది. User ఒక button నొక్కినప్పుడు సరైన snack ఇవ్వడం, balance check చేయడం వంటి logic ను JavaScript నిర్వహిస్తుంది.

Code Examples

మొదటి JavaScript message

const learnerName = "Ravi";
const course = "JavaScript";
console.log("Hello, " + learnerName);
console.log("Learning " + course);

ఈ example లో const తో learnerName మరియు course అనే variables సృష్టించాము. తరువాత console.log() ద్వారా messages ను console లో చూపించాము. + operator strings ను కలపడానికి ఉపయోగించబడింది.

Hello, Ravi
Learning JavaScript

Variables తో simple calculation

const firstNumber = 10;
const secondNumber = 5;
const total = firstNumber + secondNumber;
console.log(total);

ఈ example లో రెండు number values ను variables లో store చేశాము. వాటిని + operator తో కలిపి total variable లో ఉంచాము. చివరగా total value ను console లో చూపించాము.

15

Line-by-Line Explanation

const learnerName = “Ravi”;

ఈ line లో const keyword ఉపయోగించి learnerName అనే variable సృష్టించాము. దాని value గా Ravi అనే string ను ఇచ్చాము.

const course = “JavaScript”;

ఈ line లో course అనే variable లో JavaScript అనే text value ను store చేశాము. Text ను quotes లో రాస్తాము.

console.log(“Hello, ” + learnerName);

ఈ line Hello, అనే string ను learnerName value తో కలిపి console లో చూపిస్తుంది. ఇక్కడ + string concatenation కోసం ఉపయోగించబడింది.

console.log(“Learning ” + course);

ఈ line Learning అనే text ను course variable value తో కలిపి console లో చూపిస్తుంది.

Try It

Try this JavaScript code:

Example

const learnerName = "Your Name";
const favoriteTopic = "JavaScript";

console.log("Hello, " + learnerName);
console.log("My favorite topic is " + favoriteTopic);

Try It Yourself »

Practice

Practice:

Task: learnerName మరియు favoriteTopic variables ను ఉపయోగించి, ఈ format లో ఒక message ను console లో చూపించండి: Hello, Anu. My favorite topic is JavaScript.

Hint:

Hint: + operator తో strings మరియు variables ను కలపండి. Message ను ఒక కొత్త variable లో store చేసి తరువాత console.log() ఉపయోగించవచ్చు.

Common Mistakes

String value ను quotes లేకుండా రాయడం, ఉదాహరణకు const name = Ravi;.

Text values ను quotes లో రాయాలి: const name = “Ravi”;.

console.log ను parentheses లేకుండా ఉపయోగించడం.

Value ను console లో చూపించడానికి console.log(value); అనే సరైన syntax ఉపయోగించాలి.

Variable name ను create చేసినప్పుడు ఒక పేరు, తరువాత ఉపయోగించినప్పుడు వేరే పేరు రాయడం.

Variable name spelling మరియు capitalization ఒకేలా ఉండాలి. JavaScript case-sensitive language.

const variable value ను తరువాత మార్చడానికి ప్రయత్నించడం.

Value మారాల్సి ఉంటే let ఉపయోగించండి. మార్చకూడని value కోసం const ఉపయోగించండి.

Interview Questions

JavaScript అంటే ఏమిటి?

Answer:

JavaScript అనేది web pages కు interactivity మరియు dynamic behavior జోడించడానికి ఉపయోగించే programming language. ఇది browser లో run అవుతుంది మరియు server-side development లో కూడా ఉపయోగించవచ్చు.

JavaScript లో console.log() ఎందుకు ఉపయోగిస్తారు?

Answer:

console.log() ద్వారా values, messages లేదా calculation results ను console లో చూపించవచ్చు. ఇది output చూడటానికి మరియు debugging చేయటానికి ఉపయోగపడుతుంది.

const మరియు let మధ్య తేడా ఏమిటి?

Answer:

const variable ను మళ్లీ assign చేయకూడదనుకున్నప్పుడు ఉపయోగిస్తారు. let variable value తరువాత మారే అవకాశం ఉన్నప్పుడు ఉపయోగిస్తారు.

JavaScript లో string అంటే ఏమిటి?

Answer:

Text data ను string అంటారు. String ను single quotes, double quotes లేదా template literals లో రాయవచ్చు. ఈ lesson లో double quotes ఉపయోగించాము.

Exam Questions

JavaScript యొక్క ప్రధాన ఉపయోగం ఏమిటి?

Answer:

Web pages కు interactivity మరియు dynamic behavior జోడించడం JavaScript యొక్క ప్రధాన ఉపయోగం.

ఈ code యొక్క output ఏమిటి? const x = 4; const y = 6; console.log(x + y);

Answer:

Output 10 అవుతుంది.

Text values ను JavaScript లో ఎలా రాస్తారు?

Answer:

Text values ను quotes లో రాస్తారు. ఉదాహరణ: const city = “Hyderabad”;.

Quick Revision

  • JavaScript web pages కు interactivity మరియు dynamic behavior జోడిస్తుంది.

  • const మరియు let variables సృష్టించడానికి ఉపయోగిస్తారు.

  • Text values ను strings అంటారు మరియు వాటిని quotes లో రాస్తారు.

  • console.log() ద్వారా output ను console లో చూడవచ్చు.

  • + operator numbers ను add చేయడానికి మరియు strings ను కలపడానికి ఉపయోగించవచ్చు.

  • Variable names case-sensitive గా ఉంటాయి.

Test Your Knowledge

Take a short quiz based on this lesson.

10 Questions • Results
Scroll to Top