SlideShare a Scribd company logo
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

More Related Content

What's hot (18)

PDF
09 ruby if else
Walker Maidana
 
PPTX
Lesson 4 constant
MLG College of Learning, Inc
 
PPT
Babitha5.php
banubabitha
 
PDF
PHP Basic & Variables
M.Zalmai Rahmani
 
PDF
Learn php with PSK
Prabhjot Singh Kainth
 
PDF
Writing Readable Code
eddiehaber
 
PDF
PHP-Part4
Ahmed Saihood
 
PDF
Simple perl scripts
University High School - Fresno
 
PDF
PHP Loops and PHP Forms
M.Zalmai Rahmani
 
PPTX
ChatCrypt
Maninda Edirisooriya
 
PDF
KLab 2019 Meetup - TypeScript come (forse) non lo hai mai visto
Gianluca Carucci
 
PDF
PHP-Part3
Ahmed Saihood
 
PDF
Striving towards better PHP code
Steve Maraspin
 
PPTX
Constants
Techsters Web
 
PPT
Dynamic Web Pages Ch 1 V1.0
Cathie101
 
PDF
phptutorial
tutorialsruby
 
09 ruby if else
Walker Maidana
 
Lesson 4 constant
MLG College of Learning, Inc
 
Babitha5.php
banubabitha
 
PHP Basic & Variables
M.Zalmai Rahmani
 
Learn php with PSK
Prabhjot Singh Kainth
 
Writing Readable Code
eddiehaber
 
PHP-Part4
Ahmed Saihood
 
Simple perl scripts
University High School - Fresno
 
PHP Loops and PHP Forms
M.Zalmai Rahmani
 
KLab 2019 Meetup - TypeScript come (forse) non lo hai mai visto
Gianluca Carucci
 
PHP-Part3
Ahmed Saihood
 
Striving towards better PHP code
Steve Maraspin
 
Constants
Techsters Web
 
Dynamic Web Pages Ch 1 V1.0
Cathie101
 
phptutorial
tutorialsruby
 

Viewers also liked (10)

KEY
Events
Josh Guo
 
PPT
javascript examples
Egerton University
 
PPT
Java Script - Module I
Mustafa Qamar-ud-Din
 
PPT
Javascript Intro 01
vikram singh
 
PPTX
Unit 1-introduction to scripts
sana mateen
 
PPT
Scripting languages
teach4uin
 
PPTX
Scripting languages
Diane Phillips Krebs
 
PPTX
Web servers
Kuldeep Kulkarni
 
PPT
Web Servers (ppt)
webhostingguy
 
PPT
Lect 1. introduction to programming languages
Varun Garg
 
Events
Josh Guo
 
javascript examples
Egerton University
 
Java Script - Module I
Mustafa Qamar-ud-Din
 
Javascript Intro 01
vikram singh
 
Unit 1-introduction to scripts
sana mateen
 
Scripting languages
teach4uin
 
Scripting languages
Diane Phillips Krebs
 
Web servers
Kuldeep Kulkarni
 
Web Servers (ppt)
webhostingguy
 
Lect 1. introduction to programming languages
Varun Garg
 
Ad

Similar to Javascript Tlabs (20)

PPTX
Web programming
Leo Mark Villar
 
PPTX
Java script
Shyam Khant
 
PDF
internet Chapter 4-JavascripPrepare a ppt of video compression techniques bas...
wabii3179com
 
PPTX
04-JS.pptx
RazanMazen4
 
PPTX
04-JS.pptx
RazanMazen4
 
PPTX
04-JS.pptx
RazanMazen4
 
PDF
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
pkaviya
 
PPTX
Chapter 3 INTRODUCTION TO JAVASCRIPT S.pptx
KelemAlebachew
 
PPTX
Java script
bosybosy
 
PPTX
Final Java-script.pptx
AlkanthiSomesh
 
PPTX
Java script
Jay Patel
 
PPTX
JavaScript_III.pptx
rashmiisrani1
 
PDF
javascriptPresentation.pdf
wildcat9335
 
PPTX
javascript client side scripting la.pptx
lekhacce
 
PPTX
Lecture 5 javascript
Mujtaba Haider
 
DOC
2javascript web programming with JAVA script
umardanjumamaiwada
 
PPTX
gdscWorkShopJavascriptintroductions.pptx
sandeshshahapur
 
PDF
Ch3- Java Script.pdf
HASENSEID
 
PPTX
Unit5_Web_Updvvgxsvjbffcvvgbjifszated.pptx
1si23bt001
 
PPTX
Java script
Gourishankar R Pujar
 
Web programming
Leo Mark Villar
 
Java script
Shyam Khant
 
internet Chapter 4-JavascripPrepare a ppt of video compression techniques bas...
wabii3179com
 
04-JS.pptx
RazanMazen4
 
04-JS.pptx
RazanMazen4
 
04-JS.pptx
RazanMazen4
 
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
pkaviya
 
Chapter 3 INTRODUCTION TO JAVASCRIPT S.pptx
KelemAlebachew
 
Java script
bosybosy
 
Final Java-script.pptx
AlkanthiSomesh
 
Java script
Jay Patel
 
JavaScript_III.pptx
rashmiisrani1
 
javascriptPresentation.pdf
wildcat9335
 
javascript client side scripting la.pptx
lekhacce
 
Lecture 5 javascript
Mujtaba Haider
 
2javascript web programming with JAVA script
umardanjumamaiwada
 
gdscWorkShopJavascriptintroductions.pptx
sandeshshahapur
 
Ch3- Java Script.pdf
HASENSEID
 
Unit5_Web_Updvvgxsvjbffcvvgbjifszated.pptx
1si23bt001
 
Ad

Recently uploaded (20)

PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
July Patch Tuesday
Ivanti
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
July Patch Tuesday
Ivanti
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Python basic programing language for automation
DanialHabibi2
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 

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;