SlideShare ist ein Scribd-Unternehmen logo
1 von 21
JavaScript
JAVASCRIPT IS THE CLIENT SCRIPTING
LANGUAGE OF THE WEB.
Introduction

Why
Where
How
What for?
 Simple Addition
 Fun With Text
 Combining Text and Numbers
 Calculation
 Data handling
 Events
 Effects
About
 JavaScript is the world's most popular programming









language.
It is the language for HTML, for the web, for
servers, PCs, laptops, tablets, phones, and more.
A scripting language is a lightweight programming
language.
JavaScript is programming code that can be inserted into
HTML pages.
JavaScript code can be executed by all modern web
browsers.
JavaScript is easy to learn.
Steps to act

1. Inline

2. External
How To
 JavaScripts in HTML must be inserted between
 <script> and </script> tags.
 <script> and </script> tells,
 where the JavaScript starts and ends
 Lines between them
 contain the JavaScript code
What's in it?
 JavaScript is Case Sensitive


Watch your capitalization closely when you write JavaScript
statements

 White Space


JavaScript ignores extra spaces. You can add white space to your
script to make it more readable.


var person="Hege";
var person = "Hege";

 Break up a Code Line


You can break up a code line within a text string with a backslash.
The example below will be displayed properly:
document.write("Hello 
World!");
 document.write 
("Hello World!");

Comments
 JavaScript Comments
 Comments will not be executed by JavaScript.
 Comments can be added to explain the JavaScript, or to make
the code more readable.
 Single line comments start with //.


// Write to a heading:
document.getElementById("myH1").innerHTML="Welcome to
my Homepage";
// Write to a paragraph:
document.getElementById("myP").innerHTML="This is my first
paragraph.";
 JavaScript Multi-Line Comments
 Multi line comments start with /* and end with */.


/*
The code below will write
to a heading and to a paragraph,
and will represent the start of
my homepage:
*/
document.getElementById("myH1").innerHTML="Welcome to
my Homepage";
document.getElementById("myP").innerHTML="This is my first
paragraph.";
 Using Comments to Prevent Execution
 //document.getElementById("myH1").innerHTML="Welcome
to my Homepage";
document.getElementById("myP").innerHTML="This is my
first paragraph.";
 Using Comments at the End of a Line
 var x=5; // declare x and assign 5 to it
var y=x+2; // declare y and assign x+2 to it
Variables




Your Name
Let's Make a Sentence
Numbers in Variables

 JavaScript variables are "containers" for storing

information


var x=5;
var y=6;
var z=x+y;
 As with algebra,
 JavaScript variables can be used to hold values (x=5) or
expressions (z=x+y).
 Variable can have short names (like x and y) or more

descriptive names


(age, sum, totalvolume).

 Variable names must begin with a letter
 Variable names can also begin with
 $ and _ (but we will not use it)
 Variable names are case sensitive
 (y and Y are different variables)
Data Types
 JavaScript variables can also hold other types of

data, like text values


(person="John Doe").

 In JavaScript a text like "John Doe" is called a string.
 There are many types of JavaScript variables, but for

now, just think of numbers and strings.
 When you assign a text value to a variable, put :


double or single quotes around the value.

 When you assign a numeric value to a variable:
 do not put quotes around the value.
 If you put quotes around a numeric value:
 it will be treated as text.


var pi=3.14;
var person="John Doe";
var answer='Yes I am!';

 Dynamic Types
 var x;
// Now x is undefined
var x = 5;
// Now x is a Number
var x = "John"; // Now x is a String
 Strings
 var answer="It's alright";
var answer="He is called 'Johnny'";
var answer='He is called "Johnny"';
 Numbers
 JavaScript has only one type of numbers. Numbers can be
written with, or without decimals
var x1=34.00; // Written with decimals
var x2=34;
// Written without decimals
 var y=123e5;
// 12300000
var z=123e-5; // 0.00123


 Booleans
 Booleans can only have two values: true or false


var x=true;
var y=false;
Declaring (Creating) Variables
var keyword
 You declare JavaScript variables with the var


var carname;

 After the declaration, the variable is empty
 Assign a value to the variable
 carname="Volvo";
 You can also assign a value to the variable when you

declare it


var carname="Volvo";
Many Variables
 Declare many variables in one statement
 var lastname="Doe", age=30, job="carpenter";
 Declaration can also span multiple lines
 var lastname="Doe",
age=30,
job="carpenter";
Value = undefined
 Variables
 Variable declared without a value will have the value

undefined. are often declared without a value
 The variable carname will have the
value undefined after the execution of the following
statement:


var carname;

 Re-Declaring JavaScript Variables
 var carname="Volvo";
var carname;
Operators

 Arithmetic Operators
 Assignment Operator
Arithmetic Operators
Assignment Operators

Weitere ähnliche Inhalte

Was ist angesagt? (19)

09 ruby if else
09 ruby if else09 ruby if else
09 ruby if else
 
Lesson 4 constant
Lesson 4  constantLesson 4  constant
Lesson 4 constant
 
PL/SQL Part 2
PL/SQL Part 2PL/SQL Part 2
PL/SQL Part 2
 
Babitha5.php
Babitha5.phpBabitha5.php
Babitha5.php
 
Php
PhpPhp
Php
 
PHP Basic & Variables
PHP Basic & VariablesPHP Basic & Variables
PHP Basic & Variables
 
Learn php with PSK
Learn php with PSKLearn php with PSK
Learn php with PSK
 
Writing Readable Code
Writing Readable CodeWriting Readable Code
Writing Readable Code
 
PHP-Part4
PHP-Part4PHP-Part4
PHP-Part4
 
Simple perl scripts
Simple perl scriptsSimple perl scripts
Simple perl scripts
 
PHP Loops and PHP Forms
PHP  Loops and PHP FormsPHP  Loops and PHP Forms
PHP Loops and PHP Forms
 
ChatCrypt
ChatCryptChatCrypt
ChatCrypt
 
KLab 2019 Meetup - TypeScript come (forse) non lo hai mai visto
KLab 2019 Meetup - TypeScript come (forse) non lo hai mai vistoKLab 2019 Meetup - TypeScript come (forse) non lo hai mai visto
KLab 2019 Meetup - TypeScript come (forse) non lo hai mai visto
 
PHP-Part3
PHP-Part3PHP-Part3
PHP-Part3
 
Striving towards better PHP code
Striving towards better PHP codeStriving towards better PHP code
Striving towards better PHP code
 
Constants
ConstantsConstants
Constants
 
Dynamic Web Pages Ch 1 V1.0
Dynamic Web Pages Ch 1 V1.0Dynamic Web Pages Ch 1 V1.0
Dynamic Web Pages Ch 1 V1.0
 
Php
PhpPhp
Php
 
phptutorial
phptutorialphptutorial
phptutorial
 

Andere mochten auch

Andere mochten auch (10)

Events
EventsEvents
Events
 
javascript examples
javascript examplesjavascript examples
javascript examples
 
Java Script - Module I
Java Script - Module IJava Script - Module I
Java Script - Module I
 
Javascript Intro 01
Javascript Intro 01Javascript Intro 01
Javascript Intro 01
 
Unit 1-introduction to scripts
Unit 1-introduction to scriptsUnit 1-introduction to scripts
Unit 1-introduction to scripts
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
 
Web servers
Web serversWeb servers
Web servers
 
Web Servers (ppt)
Web Servers (ppt)Web Servers (ppt)
Web Servers (ppt)
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
 

Ähnlich wie Javascript Tlabs

Ähnlich wie Javascript Tlabs (20)

Web programming
Web programmingWeb programming
Web programming
 
Java script
Java scriptJava script
Java script
 
JavaScript Lecture notes.pptx
JavaScript Lecture notes.pptxJavaScript Lecture notes.pptx
JavaScript Lecture notes.pptx
 
Java script
Java scriptJava script
Java script
 
Unit 2.4
Unit 2.4Unit 2.4
Unit 2.4
 
Javascript
JavascriptJavascript
Javascript
 
Web designing unit 4
Web designing unit 4Web designing unit 4
Web designing unit 4
 
Basic JavaScript Tutorial
Basic JavaScript TutorialBasic JavaScript Tutorial
Basic JavaScript Tutorial
 
Javascript
JavascriptJavascript
Javascript
 
Unit 2.4
Unit 2.4Unit 2.4
Unit 2.4
 
Java script
Java scriptJava script
Java script
 
1. java script language fundamentals
1. java script language fundamentals1. java script language fundamentals
1. java script language fundamentals
 
Javascript survival for CSBN Sophomores
Javascript survival for CSBN SophomoresJavascript survival for CSBN Sophomores
Javascript survival for CSBN Sophomores
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Javascript Basics by Bonny
Javascript Basics by BonnyJavascript Basics by Bonny
Javascript Basics by Bonny
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Basics of Javascript
Basics of Javascript Basics of Javascript
Basics of Javascript
 
Introduction to Java Scripting
Introduction to Java ScriptingIntroduction to Java Scripting
Introduction to Java Scripting
 
Java script final presentation
Java script final presentationJava script final presentation
Java script final presentation
 
FYBSC IT Web Programming Unit IV PHP and MySQL
FYBSC IT Web Programming Unit IV  PHP and MySQLFYBSC IT Web Programming Unit IV  PHP and MySQL
FYBSC IT Web Programming Unit IV PHP and MySQL
 

Kürzlich hochgeladen

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 

Kürzlich hochgeladen (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 

Javascript Tlabs

  • 1. JavaScript JAVASCRIPT IS THE CLIENT SCRIPTING LANGUAGE OF THE WEB.
  • 3. What for?  Simple Addition  Fun With Text  Combining Text and Numbers  Calculation  Data handling  Events  Effects
  • 4. About  JavaScript is the world's most popular programming      language. It is the language for HTML, for the web, for servers, PCs, laptops, tablets, phones, and more. A scripting language is a lightweight programming language. JavaScript is programming code that can be inserted into HTML pages. JavaScript code can be executed by all modern web browsers. JavaScript is easy to learn.
  • 5. Steps to act 1. Inline 2. External
  • 6. How To  JavaScripts in HTML must be inserted between  <script> and </script> tags.  <script> and </script> tells,  where the JavaScript starts and ends  Lines between them  contain the JavaScript code
  • 7. What's in it?  JavaScript is Case Sensitive  Watch your capitalization closely when you write JavaScript statements  White Space  JavaScript ignores extra spaces. You can add white space to your script to make it more readable.  var person="Hege"; var person = "Hege";  Break up a Code Line  You can break up a code line within a text string with a backslash. The example below will be displayed properly: document.write("Hello World!");  document.write ("Hello World!"); 
  • 8. Comments  JavaScript Comments  Comments will not be executed by JavaScript.  Comments can be added to explain the JavaScript, or to make the code more readable.  Single line comments start with //.  // Write to a heading: document.getElementById("myH1").innerHTML="Welcome to my Homepage"; // Write to a paragraph: document.getElementById("myP").innerHTML="This is my first paragraph.";
  • 9.  JavaScript Multi-Line Comments  Multi line comments start with /* and end with */.  /* The code below will write to a heading and to a paragraph, and will represent the start of my homepage: */ document.getElementById("myH1").innerHTML="Welcome to my Homepage"; document.getElementById("myP").innerHTML="This is my first paragraph.";
  • 10.  Using Comments to Prevent Execution  //document.getElementById("myH1").innerHTML="Welcome to my Homepage"; document.getElementById("myP").innerHTML="This is my first paragraph.";  Using Comments at the End of a Line  var x=5; // declare x and assign 5 to it var y=x+2; // declare y and assign x+2 to it
  • 11. Variables    Your Name Let's Make a Sentence Numbers in Variables  JavaScript variables are "containers" for storing information  var x=5; var y=6; var z=x+y;
  • 12.  As with algebra,  JavaScript variables can be used to hold values (x=5) or expressions (z=x+y).  Variable can have short names (like x and y) or more descriptive names  (age, sum, totalvolume).  Variable names must begin with a letter  Variable names can also begin with  $ and _ (but we will not use it)  Variable names are case sensitive  (y and Y are different variables)
  • 13. Data Types  JavaScript variables can also hold other types of data, like text values  (person="John Doe").  In JavaScript a text like "John Doe" is called a string.  There are many types of JavaScript variables, but for now, just think of numbers and strings.  When you assign a text value to a variable, put :  double or single quotes around the value.  When you assign a numeric value to a variable:  do not put quotes around the value.
  • 14.  If you put quotes around a numeric value:  it will be treated as text.  var pi=3.14; var person="John Doe"; var answer='Yes I am!';  Dynamic Types  var x; // Now x is undefined var x = 5; // Now x is a Number var x = "John"; // Now x is a String  Strings  var answer="It's alright"; var answer="He is called 'Johnny'"; var answer='He is called "Johnny"';
  • 15.  Numbers  JavaScript has only one type of numbers. Numbers can be written with, or without decimals var x1=34.00; // Written with decimals var x2=34; // Written without decimals  var y=123e5; // 12300000 var z=123e-5; // 0.00123   Booleans  Booleans can only have two values: true or false  var x=true; var y=false;
  • 16. Declaring (Creating) Variables var keyword  You declare JavaScript variables with the var  var carname;  After the declaration, the variable is empty  Assign a value to the variable  carname="Volvo";  You can also assign a value to the variable when you declare it  var carname="Volvo";
  • 17. Many Variables  Declare many variables in one statement  var lastname="Doe", age=30, job="carpenter";  Declaration can also span multiple lines  var lastname="Doe", age=30, job="carpenter";
  • 18. Value = undefined  Variables  Variable declared without a value will have the value undefined. are often declared without a value  The variable carname will have the value undefined after the execution of the following statement:  var carname;  Re-Declaring JavaScript Variables  var carname="Volvo"; var carname;