SlideShare una empresa de Scribd logo
1 de 20
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

Small eigen collider
Small eigen colliderSmall eigen collider
Small eigen collider
Andrew Grimm
 
Introduction to javaScript
Introduction to javaScriptIntroduction to javaScript
Introduction to javaScript
Neil Ghosh
 

La actualidad más candente (15)

Js syntax
Js syntaxJs syntax
Js syntax
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
Flow-based programming with Elixir
Flow-based programming with ElixirFlow-based programming with Elixir
Flow-based programming with Elixir
 
Java scriptforjavadev part1
Java scriptforjavadev part1Java scriptforjavadev part1
Java scriptforjavadev part1
 
Intro to elixir metaprogramming
Intro to elixir metaprogrammingIntro to elixir metaprogramming
Intro to elixir metaprogramming
 
Js in quick books
Js in quick booksJs in quick books
Js in quick books
 
JS Event Loop
JS Event LoopJS Event Loop
JS Event Loop
 
Flowex - Railway Flow-Based Programming with Elixir GenStage.
Flowex - Railway Flow-Based Programming with Elixir GenStage.Flowex - Railway Flow-Based Programming with Elixir GenStage.
Flowex - Railway Flow-Based Programming with Elixir GenStage.
 
Workshop Intro: FrontEnd General Overview
Workshop Intro: FrontEnd General OverviewWorkshop Intro: FrontEnd General Overview
Workshop Intro: FrontEnd General Overview
 
Small eigen collider
Small eigen colliderSmall eigen collider
Small eigen collider
 
JavaScript | Introduction
JavaScript | IntroductionJavaScript | Introduction
JavaScript | Introduction
 
Introduction to javaScript
Introduction to javaScriptIntroduction to javaScript
Introduction to javaScript
 
Web application
Web applicationWeb application
Web application
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in Components
 
Elm: Make Yourself A Happy Front-end Web Developer
Elm: Make Yourself A Happy Front-end Web DeveloperElm: Make Yourself A Happy Front-end Web Developer
Elm: Make Yourself A Happy Front-end Web Developer
 

Similar a Javascript

Java script.pptx v
Java script.pptx                                     vJava script.pptx                                     v
Java script.pptx v
22x026
 
Iwt note(module 2)
Iwt note(module 2)Iwt note(module 2)
Iwt note(module 2)
SANTOSH RATH
 

Similar a Javascript (20)

Java scipt
Java sciptJava scipt
Java scipt
 
Client sidescripting javascript
Client sidescripting javascriptClient sidescripting javascript
Client sidescripting javascript
 
Java script.pptx v
Java script.pptx                                     vJava script.pptx                                     v
Java script.pptx v
 
Iwt note(module 2)
Iwt note(module 2)Iwt note(module 2)
Iwt note(module 2)
 
ASP.NET Basics
ASP.NET Basics ASP.NET Basics
ASP.NET Basics
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
JavaScript_III.pptx
JavaScript_III.pptxJavaScript_III.pptx
JavaScript_III.pptx
 
JavaScripts & jQuery
JavaScripts & jQueryJavaScripts & jQuery
JavaScripts & jQuery
 
Unit 4(it workshop)
Unit 4(it workshop)Unit 4(it workshop)
Unit 4(it workshop)
 
Java script
Java scriptJava script
Java script
 
JavaScript New Tutorial Class XI and XII.pptx
JavaScript New Tutorial Class XI and XII.pptxJavaScript New Tutorial Class XI and XII.pptx
JavaScript New Tutorial Class XI and XII.pptx
 
8.-Javascript-report powerpoint presentation
8.-Javascript-report powerpoint presentation8.-Javascript-report powerpoint presentation
8.-Javascript-report powerpoint presentation
 
Javascript
JavascriptJavascript
Javascript
 
Basic Java script handouts for students
Basic Java script handouts for students Basic Java script handouts for students
Basic Java script handouts for students
 
Unit 4 Java script.pptx
Unit 4 Java script.pptxUnit 4 Java script.pptx
Unit 4 Java script.pptx
 
Java script
Java scriptJava script
Java script
 
Javascript tutorial
Javascript tutorialJavascript tutorial
Javascript tutorial
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
 
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
IT2255 Web Essentials - Unit III Client-Side Processing and ScriptingIT2255 Web Essentials - Unit III Client-Side Processing and Scripting
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
 
Javascript tutorial basic for starter
Javascript tutorial basic for starterJavascript tutorial basic for starter
Javascript tutorial basic for starter
 

Más de baabtra.com - No. 1 supplier of quality freshers

Más de baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Último

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 

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: info@baabtra.com