SlideShare a Scribd company logo
JAVASCRIPT
Week 9, Day 1
Introduction to Scripting
• Scripting Languages are mainly used to build the programming environment in
HTML document .It Makes Web pages dynamic and interactive.
• There are 2 types of scripting languages
• Client side scripting languages
• Are scripts that execute on client side or the browser. Browser Includes
Scripting Interpreter
• Eg: VBScript, JavaScript, Jscript and ECMA Script
• Server side scripting languages
• Are scripts that execute on server side
• Eg: PHP,JSP, ASP .NET
Features of JavaScript
 C-based language developed by Netscape
 Mainly used for client side scripting because it is supported by all
the browsers.
 Platform Independence
 JavaScript is NOT supported by old browsers (IE 1.0). You can
enable or disable JS in new browsers
How to start programming in JavaScript
• All JavaScript Code must be in between the below tags
<script>
// JavaScript Code goes here
</script>
How to start programming in JavaScript
• JavaScript can be embedded to any HTML code in two ways
–Immediate scripting
–Deferred Scripting
Immediate Mode Scripting
• SCRIPT tag can be placed in HEAD or BODY tag
• Placing JavaScript in the HEAD tag ensures readability.
• Scripts gets executed as the page loads.
<body>
<h4> Immediate Demo</h4>
<script language="JavaScript">
document.write("<h5> Using JavaScript</h5>");
</script>
</body>
<script language="JavaScript">
/*calling function when user clicks on the button */
function msg(){
alert("Hi");
}
</script>
<form name="f1">
<input type="button" value=" ok " onClick="msg()">
</form>
Deferred Mode Scripting
–Script is executed based on some user action
JavaScript – lexical structure
• JavaScript is object based and action-oriented.
• JavaScript is case sensitive.
• A semicolon ends a JavaScript statement
Commenting
C
// comment single line
/* comment
multiple lines */
JavaScript
//comment single line
/* Comment
multiple Lines*/
Declaring a variable
C
//Declaring a variable
Int a=10;
Char c=‘a’;
Float f=1.12;
JavaScript
//No need of prior Declarations
Var a=10; //local
b=15; //global
Variables in Detail
• Must start with a letter or an underscore and can have digits.
• The Data type is automatically decided by the usage.
• Scope is by default global. If a variable is prefixed by the keyword ‚var‛
within a function then it is a local variable.
• The formal parameters are local to the function.
function demo()
{
var inum1 = 10; // Local to the function
inum2 = 20; // Global to the document.
}
demo(); // Invoking function
inum1 = inum1+1; // Error because inum1 is local variable
inum2 = inum2+1; // no Error
JavaScript – Implicit data types
• JavaScript recognizes the following implicit data types
– Number
– String
– Logical
– Object
– The special value null
• Type conversion
– JavaScript automatically converts between data types
str = ‚100‛, num1 = 10, num2 = 20
num3 = num1+ num2
strsum = str + num2
strsum = num2 + str
30
10020
20100
Output
C
Int a=10,b=25;
Printf(‚%d %d‛,a,b);
JavaScript
Var a=10; var b=25;
Document.write(a,b);
Control Structures
C
Conditional Control Structures
• If
• If else
• Switch
Loops
• For
• While
• Do while
JavaScript
‚Exactly the same as on left side‛
Functions
C
Int findSum(int a,int b)
{
Int c;
c=a+b;
Return c
}
findSum(10,15);
JavaScript
function findSum(a,b)
{
c=a+b;
Return c;
}
findSum(10,15);
Operators
C
Arithmetic Operators
+, ++, -, --, *, /, %
Relational Operators
==, !=, ===, !==, >, >=, < , <=
Logical Operators
&&, ||, !
Assignment Operators
=, +=, -=, *=, /=, %=
Strict equal (===)
Strict not equal (!==)
Returns true if the operands are not
equal and/or not of the same type.
JavaScript
‚Exactly the same as on left side‛
Dialog boxes (Window Object methods)
• Alert dialog box - alert(message)
– Takes in a string argument and displays an alert box.
• Prompt dialog box - prompt(message,[inputDefault])
– Displays a message and a data entry field
• Confirm dialog box - confirm(message )
– Serves as a technique for confirming user actions
Questions?
‚A good question deserve a good grade…‛
End of Day
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

More Related Content

What's hot (15)

PPTX
Js syntax
Sireesh K
 
PPTX
JavaScript Basics
Bhanuka Uyanage
 
PDF
Flow-based programming with Elixir
Anton Mishchuk
 
PPTX
Java scriptforjavadev part1
Makarand Bhatambarekar
 
PDF
Intro to elixir metaprogramming
Anton Mishchuk
 
PDF
Js in quick books
QuickBooks Online
 
PPTX
JS Event Loop
Saai Vignesh P
 
PDF
Flowex - Railway Flow-Based Programming with Elixir GenStage.
Anton Mishchuk
 
PPTX
Workshop Intro: FrontEnd General Overview
Visual Engineering
 
ODP
Small eigen collider
Andrew Grimm
 
PPTX
JavaScript | Introduction
Velimir Bulatovic
 
PPT
Introduction to javaScript
Neil Ghosh
 
PDF
Web application
aquarius070287
 
PDF
Thinking in Components
Anton Ivanov
 
PPTX
Elm: Make Yourself A Happy Front-end Web Developer
Asep Bagja
 
Js syntax
Sireesh K
 
JavaScript Basics
Bhanuka Uyanage
 
Flow-based programming with Elixir
Anton Mishchuk
 
Java scriptforjavadev part1
Makarand Bhatambarekar
 
Intro to elixir metaprogramming
Anton Mishchuk
 
Js in quick books
QuickBooks Online
 
JS Event Loop
Saai Vignesh P
 
Flowex - Railway Flow-Based Programming with Elixir GenStage.
Anton Mishchuk
 
Workshop Intro: FrontEnd General Overview
Visual Engineering
 
Small eigen collider
Andrew Grimm
 
JavaScript | Introduction
Velimir Bulatovic
 
Introduction to javaScript
Neil Ghosh
 
Web application
aquarius070287
 
Thinking in Components
Anton Ivanov
 
Elm: Make Yourself A Happy Front-end Web Developer
Asep Bagja
 

Similar to Javascript (20)

PPTX
1. java script language fundamentals
Rajiv Gupta
 
PDF
Client sidescripting javascript
Selvin Josy Bai Somu
 
PPTX
Chapter 3 INTRODUCTION TO JAVASCRIPT S.pptx
KelemAlebachew
 
PPTX
MYSQL DATABASE INTRODUCTION TO JAVASCRIPT.pptx
ArjayBalberan1
 
PPTX
Unit 3-Javascript.pptx
AmanJha533833
 
PPTX
HNDIT1022 Week 08, 09 10 Theory web .pptx
IsuriUmayangana
 
PPTX
JavaScript New Tutorial Class XI and XII.pptx
rish15r890
 
PPTX
Lecture 5 javascript
Mujtaba Haider
 
PDF
javascriptPresentation.pdf
wildcat9335
 
PPTX
Java script.pptx v
22x026
 
PDF
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
pkaviya
 
PPTX
JavaScript with Syntax & Implementation
Soumen Santra
 
PPTX
Java Script basics and DOM
Sukrit Gupta
 
PPT
JavaScripttttttttttttttttttttttttttttttttttttttt.ppt
ankitasaha010207
 
PPT
Javascript
Manav Prasad
 
PPTX
JavaScript_III.pptx
rashmiisrani1
 
PDF
Unit 4(it workshop)
Dr.Lokesh Gagnani
 
PPTX
js.pptx
SuhaibKhan62
 
PPTX
Unit III.pptx IT3401 web essentials presentatio
lakshitakumar291
 
PPTX
wp-UNIT_III.pptx
GANDHAMKUMAR2
 
1. java script language fundamentals
Rajiv Gupta
 
Client sidescripting javascript
Selvin Josy Bai Somu
 
Chapter 3 INTRODUCTION TO JAVASCRIPT S.pptx
KelemAlebachew
 
MYSQL DATABASE INTRODUCTION TO JAVASCRIPT.pptx
ArjayBalberan1
 
Unit 3-Javascript.pptx
AmanJha533833
 
HNDIT1022 Week 08, 09 10 Theory web .pptx
IsuriUmayangana
 
JavaScript New Tutorial Class XI and XII.pptx
rish15r890
 
Lecture 5 javascript
Mujtaba Haider
 
javascriptPresentation.pdf
wildcat9335
 
Java script.pptx v
22x026
 
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
pkaviya
 
JavaScript with Syntax & Implementation
Soumen Santra
 
Java Script basics and DOM
Sukrit Gupta
 
JavaScripttttttttttttttttttttttttttttttttttttttt.ppt
ankitasaha010207
 
Javascript
Manav Prasad
 
JavaScript_III.pptx
rashmiisrani1
 
Unit 4(it workshop)
Dr.Lokesh Gagnani
 
js.pptx
SuhaibKhan62
 
Unit III.pptx IT3401 web essentials presentatio
lakshitakumar291
 
wp-UNIT_III.pptx
GANDHAMKUMAR2
 
Ad

More from baabtra.com - No. 1 supplier of quality freshers (20)

PPTX
Agile methodology and scrum development
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
PDF
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 3 stored procedures
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Agile methodology and scrum development
baabtra.com - No. 1 supplier of quality freshers
 
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Ad

Recently uploaded (20)

PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
PPTX
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
The Future of Artificial Intelligence (AI)
Mukul
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 

Javascript

  • 2. Introduction to Scripting • Scripting Languages are mainly used to build the programming environment in HTML document .It Makes Web pages dynamic and interactive. • There are 2 types of scripting languages • Client side scripting languages • Are scripts that execute on client side or the browser. Browser Includes Scripting Interpreter • Eg: VBScript, JavaScript, Jscript and ECMA Script • Server side scripting languages • Are scripts that execute on server side • Eg: PHP,JSP, ASP .NET
  • 3. Features of JavaScript  C-based language developed by Netscape  Mainly used for client side scripting because it is supported by all the browsers.  Platform Independence  JavaScript is NOT supported by old browsers (IE 1.0). You can enable or disable JS in new browsers
  • 4. How to start programming in JavaScript • All JavaScript Code must be in between the below tags <script> // JavaScript Code goes here </script>
  • 5. How to start programming in JavaScript • JavaScript can be embedded to any HTML code in two ways –Immediate scripting –Deferred Scripting
  • 6. Immediate Mode Scripting • SCRIPT tag can be placed in HEAD or BODY tag • Placing JavaScript in the HEAD tag ensures readability. • Scripts gets executed as the page loads. <body> <h4> Immediate Demo</h4> <script language="JavaScript"> document.write("<h5> Using JavaScript</h5>"); </script> </body>
  • 7. <script language="JavaScript"> /*calling function when user clicks on the button */ function msg(){ alert("Hi"); } </script> <form name="f1"> <input type="button" value=" ok " onClick="msg()"> </form> Deferred Mode Scripting –Script is executed based on some user action
  • 8. JavaScript – lexical structure • JavaScript is object based and action-oriented. • JavaScript is case sensitive. • A semicolon ends a JavaScript statement
  • 9. Commenting C // comment single line /* comment multiple lines */ JavaScript //comment single line /* Comment multiple Lines*/
  • 10. Declaring a variable C //Declaring a variable Int a=10; Char c=‘a’; Float f=1.12; JavaScript //No need of prior Declarations Var a=10; //local b=15; //global
  • 11. Variables in Detail • Must start with a letter or an underscore and can have digits. • The Data type is automatically decided by the usage. • Scope is by default global. If a variable is prefixed by the keyword ‚var‛ within a function then it is a local variable. • The formal parameters are local to the function. function demo() { var inum1 = 10; // Local to the function inum2 = 20; // Global to the document. } demo(); // Invoking function inum1 = inum1+1; // Error because inum1 is local variable inum2 = inum2+1; // no Error
  • 12. JavaScript – Implicit data types • JavaScript recognizes the following implicit data types – Number – String – Logical – Object – The special value null • Type conversion – JavaScript automatically converts between data types str = ‚100‛, num1 = 10, num2 = 20 num3 = num1+ num2 strsum = str + num2 strsum = num2 + str 30 10020 20100
  • 14. Control Structures C Conditional Control Structures • If • If else • Switch Loops • For • While • Do while JavaScript ‚Exactly the same as on left side‛
  • 15. Functions C Int findSum(int a,int b) { Int c; c=a+b; Return c } findSum(10,15); JavaScript function findSum(a,b) { c=a+b; Return c; } findSum(10,15);
  • 16. Operators C Arithmetic Operators +, ++, -, --, *, /, % Relational Operators ==, !=, ===, !==, >, >=, < , <= Logical Operators &&, ||, ! Assignment Operators =, +=, -=, *=, /=, %= Strict equal (===) Strict not equal (!==) Returns true if the operands are not equal and/or not of the same type. JavaScript ‚Exactly the same as on left side‛
  • 17. Dialog boxes (Window Object methods) • Alert dialog box - alert(message) – Takes in a string argument and displays an alert box. • Prompt dialog box - prompt(message,[inputDefault]) – Displays a message and a data entry field • Confirm dialog box - confirm(message ) – Serves as a technique for confirming user actions
  • 18. Questions? ‚A good question deserve a good grade…‛
  • 20. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: [email protected]