SlideShare uma empresa Scribd logo
1 de 111
Introduction to Javascript

            Kevin Ball
        Co-Founder & CTO

         kball@fashioningchange.com
                   @kbal11
Introduction to Javascript
Introduction to Javascript
Introduction to Javascript

• What is Javascript?
Introduction to Javascript

• What is Javascript?
• Programming Basics
Introduction to Javascript

• What is Javascript?
• Programming Basics
• HTML & the Dom
Introduction to Javascript

• What is Javascript?
• Programming Basics
• HTML & the Dom
• What makes Javascript Different
What is Javascript?
What is Javascript?
What is Javascript?

• The Language of Client-Side Web Development
What is Javascript?

• The Language of Client-Side Web Development
• Available in every browser
What is Javascript?

• The Language of Client-Side Web Development
• Available in every browser
• A Powerful Dynamic Programming Language
Web Architecture
Web Architecture
   Client/Server Model
Web Architecture
   Client/Server Model
Web Architecture
   Client/Server Model
Web Architecture
   Client/Server Model
Web Architecture
   Client/Server Model
Web Architecture
   Client/Server Model
Web Architecture
   Client/Server Model
Web Architecture
   Client/Server Model
Web Architecture
   Client/Server Model
Available in Every Browser
Available in Every Browser

• No additional tools required
Available in Every Browser

• No additional tools required
• Start playing around right away!
Browser Demo
    hello.html
Programming Basics
      Just Jump In
Programming Basics
      Just Jump In
Programming Basics
      Numbers
Programming Basics
      Numbers
Programming Basics
       Numbers


›2+2
Programming Basics
        Numbers


›2+2
==> 4
Programming Basics
              Numbers


›2+2
==> 4
› 5.0 * 0.5
Programming Basics
              Numbers


›2+2
==> 4
› 5.0 * 0.5
==> 2.5
Programming Basics
       Strings
Programming Basics
       Strings
Programming Basics
                Strings

› “Hello” + “World”;
Programming Basics
                Strings

› “Hello” + “World”;
==> “HelloWorld”
Programming Basics
                Strings

› “Hello” + “World”;
==> “HelloWorld”
› 2+ “Hello”;
Programming Basics
                Strings

› “Hello” + “World”;
==> “HelloWorld”
› 2+ “Hello”;
==> “2Hello”
Programming Basics
                    Strings

› “Hello” + “World”;
==> “HelloWorld”
› 2+ “Hello”;
==> “2Hello”
› “Hello”.length;
Programming Basics
                    Strings

› “Hello” + “World”;
==> “HelloWorld”
› 2+ “Hello”;
==> “2Hello”
› “Hello”.length;
==> 5
Programming Basics
      Variables
Programming Basics
      Variables
Programming Basics
                 Variables

› var five = 5;
Programming Basics
                 Variables

› var five = 5;
 ==> 5
Programming Basics
                 Variables

› var five = 5;
 ==> 5
› five + 10;
Programming Basics
                 Variables

› var five = 5;
 ==> 5
› five + 10;
==> 15
Programming Basics
                 Variables

› var five = 5;
 ==> 5
› five + 10;
==> 15
› five;
Programming Basics
                 Variables

› var five = 5;
 ==> 5
› five + 10;
==> 15
› five;
==> 5
Programming Basics
      Variables
Programming Basics
                Variables

› var students = 5;
Programming Basics
                Variables

› var students = 5;
==> 5
Programming Basics
               Variables

› var students = 5;
==> 5
› students = students + 10;
Programming Basics
               Variables

› var students = 5;
==> 5
› students = students + 10;
==> 15
Programming Basics
               Variables

› var students = 5;
==> 5
› students = students + 10;
==> 15
› students;
Programming Basics
               Variables

› var students = 5;
==> 5
› students = students + 10;
==> 15
› students;
==> 15
Programming Basics
       If/Then
Programming Basics
       If/Then
Programming Basics
               If/Then

var students = 5;
Programming Basics
                 If/Then

var students = 5;
if (students > 10) {
  alert(“Big Class!”);
} else {
  alert (“Small Class!”);
}
Browser Demo
   if_then.html
Programming Basics
       Loops
Programming Basics
       Loops
Programming Basics
                Loops

var students = 5;
Programming Basics
                Loops

var students = 5;
while (students <10) {
  students = students + 1;
  document.write(“More!<br/>”);
}
document.write(students + “ students”)
Browser Demo
   while.html
Programming Basics
      Functions
Programming Basics
      Functions
Programming Basics
              Functions

var plusTen = function(num) {
  return num + 10;
}
Programming Basics
               Functions

var plusTen = function(num) {
  return num + 10;
}
› var students = 5;
Programming Basics
              Functions

var plusTen = function(num) {
  return num + 10;
}
› var students = 5;
› students = plusTen(students);
Programming Basics
              Functions

var plusTen = function(num) {
  return num + 10;
}
› var students = 5;
› students = plusTen(students);
==> 15
HTML and the DOM
HTML and the DOM
HTML and the DOM
<html>
 <body>
  <h1>Hello</h1>
  <div id=‘container’>
    <p id=‘inner’>I’m in the middle!</p>
  </div>
 </body>
</html>
HTML and the DOM
Browser Demo
    dom.html
HTML and the DOM
HTML and the DOM
HTML and the DOM
DOM Manipulation
DOM Manipulation
<html>
 <body>
  <h1>Hello</h1>
  <div id=‘container’>
    <p id=‘inner’>I’m in the middle!</p>
  </div>
 </body>
</html>
DOM Manipulation
<html>
 <body>
  <h1>Hello</h1>
  <div id=‘container’>
    <p id=‘inner’>I’m in the middle!</p>
  </div>
 </body>
  <script type=”text/javascript”>
   document.getElementById(“inner”).innerHTML = “Changed!”;
 </script>
</html>
Browser Demo
 dom_manipulation.html
DOM Manipulation


  Stay Tuned for the Next Talk
Javascript: What’s Different?
Javascript: What’s Different?

  • Prototypal Inheritance
  • Closures
  • Event-based Programming
Javascript: What’s Different?
           Inheritance
Javascript: What’s Different?
                    Inheritance

Traditional Inheritance
Javascript: What’s Different?
                    Inheritance

Traditional Inheritance

         Shape
Javascript: What’s Different?
                    Inheritance

Traditional Inheritance

         Shape
Javascript: What’s Different?
                    Inheritance

Traditional Inheritance

            Shape




   Square
Javascript: What’s Different?
                    Inheritance

Traditional Inheritance

            Shape




   Square
Javascript: What’s Different?
                         Inheritance

Traditional Inheritance

            Shape




   Square
                    Triangle
Javascript: What’s Different?
                         Inheritance

Traditional Inheritance          Prototypal Inheritance

            Shape




   Square
                    Triangle
Javascript: What’s Different?
                         Inheritance

Traditional Inheritance          Prototypal Inheritance

            Shape                       This
                                       Square




   Square
                    Triangle
Javascript: What’s Different?
                         Inheritance

Traditional Inheritance          Prototypal Inheritance

            Shape                       This
                                       Square




   Square
                    Triangle
Javascript: What’s Different?
                         Inheritance

Traditional Inheritance          Prototypal Inheritance

            Shape                       This
                                       Square



                                        Copy
   Square
                    Triangle           Square
Javascript: What’s Different?
                         Inheritance

Traditional Inheritance          Prototypal Inheritance

            Shape                       This
                                       Square




   Square
                    Triangle           Triangle
Javascript: What’s Different?
           Closures
Javascript: What’s Different?
           Closures
Javascript: What’s Different?
                  Closures

    var students = 5;
Javascript: What’s Different?
                  Closures

    var students = 5;
   var howManyStudents = function() {
     return students;
   }
   howManyStudents();
Javascript: What’s Different?
                  Closures

    var students = 5;
   var howManyStudents = function() {
     return students;
   }
   howManyStudents();
   ==> 5
Javascript: What’s Different?
       Event Based Programming
Javascript: What’s Different?
                 Event Based Programming
<html>
 <body>
  <h1 id=‘clickable’>Click Me</h1>
 </body>
  <script type=”text/javascript”>
   var clickFn = function() {alert(“Clicked!”);}
   document.getElementById(“clickable”).onclick = clickFn;
 </script>
</html>
Browser Demo
    click.html
Resources

• CodeAcademy (codeacademy.com)
• Douglass Crockford Videos (http://
  www.yuiblog.com/crockford/)
• Book: JavaScript, The Good Parts (Douglass
  Crockford)
Questions?
Thank You

    Kevin Ball
Co-Founder & CTO

 kball@fashioningchange.com
           @kbal11

Mais conteúdo relacionado

Destaque

Javascript Intro 01
Javascript Intro 01Javascript Intro 01
Javascript Intro 01
vikram singh
 
Intro to Javascript and jQuery
Intro to Javascript and jQueryIntro to Javascript and jQuery
Intro to Javascript and jQuery
Shawn Calvert
 

Destaque (15)

Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
Intro to javascript (4 week)
Intro to javascript (4 week)Intro to javascript (4 week)
Intro to javascript (4 week)
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Javascript intro for MAH
Javascript intro for MAHJavascript intro for MAH
Javascript intro for MAH
 
JavaScript Intro
JavaScript IntroJavaScript Intro
JavaScript Intro
 
Javascript Intro 01
Javascript Intro 01Javascript Intro 01
Javascript Intro 01
 
Intro to Javascript and jQuery
Intro to Javascript and jQueryIntro to Javascript and jQuery
Intro to Javascript and jQuery
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
Le Wagon - Javascript for Beginners
Le Wagon - Javascript for BeginnersLe Wagon - Javascript for Beginners
Le Wagon - Javascript for Beginners
 
Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
 

Semelhante a Intro to Javascript

JavaScript For People Who Don't Code
JavaScript For People Who Don't CodeJavaScript For People Who Don't Code
JavaScript For People Who Don't Code
Christopher Schmitt
 
Breaking the oracle tie
Breaking the oracle tieBreaking the oracle tie
Breaking the oracle tie
agiamas
 

Semelhante a Intro to Javascript (20)

slides-students-C03.pdf
slides-students-C03.pdfslides-students-C03.pdf
slides-students-C03.pdf
 
JavaScript For People Who Don't Code
JavaScript For People Who Don't CodeJavaScript For People Who Don't Code
JavaScript For People Who Don't Code
 
Leveling Up at JavaScript
Leveling Up at JavaScriptLeveling Up at JavaScript
Leveling Up at JavaScript
 
Gwt create2013 Frankfurt: How we built a million dollar business with GWT
Gwt create2013 Frankfurt: How we built a million dollar business with GWTGwt create2013 Frankfurt: How we built a million dollar business with GWT
Gwt create2013 Frankfurt: How we built a million dollar business with GWT
 
About Clack
About ClackAbout Clack
About Clack
 
Java script core
Java script coreJava script core
Java script core
 
Enterprise JavaScript ... what the heck?
Enterprise JavaScript ... what the heck?Enterprise JavaScript ... what the heck?
Enterprise JavaScript ... what the heck?
 
Quo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteQuo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynote
 
Breaking the oracle tie
Breaking the oracle tieBreaking the oracle tie
Breaking the oracle tie
 
Lecture7
Lecture7Lecture7
Lecture7
 
ELAG Workshop version 1
ELAG Workshop version 1ELAG Workshop version 1
ELAG Workshop version 1
 
Wintellect - Devscovery - Enterprise JavaScript Development 1 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 1 of 2Wintellect - Devscovery - Enterprise JavaScript Development 1 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 1 of 2
 
Groovy And Grails Introduction
Groovy And Grails IntroductionGroovy And Grails Introduction
Groovy And Grails Introduction
 
wt mod3.pdf
wt mod3.pdfwt mod3.pdf
wt mod3.pdf
 
Let’s learn how to use JavaScript responsibly and stay up-to-date.
Let’s learn how to use JavaScript responsibly and stay up-to-date. Let’s learn how to use JavaScript responsibly and stay up-to-date.
Let’s learn how to use JavaScript responsibly and stay up-to-date.
 
WT Module-3.pptx
WT Module-3.pptxWT Module-3.pptx
WT Module-3.pptx
 
Domain Specific Languages
Domain Specific LanguagesDomain Specific Languages
Domain Specific Languages
 
There Is No JavaScript
There Is No JavaScriptThere Is No JavaScript
There Is No JavaScript
 
Noam Kfir - There is no Java Script - code.talks 2015
Noam Kfir - There is no Java Script - code.talks 2015Noam Kfir - There is no Java Script - code.talks 2015
Noam Kfir - There is no Java Script - code.talks 2015
 
Software Engineering Thailand: Programming with Scala
Software Engineering Thailand: Programming with ScalaSoftware Engineering Thailand: Programming with Scala
Software Engineering Thailand: Programming with Scala
 

Mais de Kevin Ball

Mais de Kevin Ball (7)

Flexible UI Components for a Multi-Framework World
Flexible UI Components for a Multi-Framework WorldFlexible UI Components for a Multi-Framework World
Flexible UI Components for a Multi-Framework World
 
Modern javascript
Modern javascriptModern javascript
Modern javascript
 
Npm Shrinkwrap
Npm ShrinkwrapNpm Shrinkwrap
Npm Shrinkwrap
 
Understanding the Nesting Structure of the Ember.js View Layer
Understanding the Nesting Structure of the Ember.js View LayerUnderstanding the Nesting Structure of the Ember.js View Layer
Understanding the Nesting Structure of the Ember.js View Layer
 
Underscore.js
Underscore.jsUnderscore.js
Underscore.js
 
Omniauth: Future Proof Your Authentication
Omniauth: Future Proof Your AuthenticationOmniauth: Future Proof Your Authentication
Omniauth: Future Proof Your Authentication
 
Ruby 1.9 Fibers
Ruby 1.9 FibersRuby 1.9 Fibers
Ruby 1.9 Fibers
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Intro to Javascript

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n