SlideShare une entreprise Scribd logo
1  sur  12
How I Learned to
Stop Worrying and
  Love JavaScript
JavaScript
•Technically: ECMAScript

•ECMA-262 Specification (currently
 v5.1)

•Weakly typed, interpreted, object
 based, functional, prototypical
The History
•Created by Brendan Eich in 10
 days

•Released in 1995 as part of
 Netscape Navigator 2.0

•First standardised in 1997

•Also know as Mocha, LiveScript,
The Lineage
• Scheme: Functional

•Self: Prototypical

•Java: Ugly
The Problems
•The Name: JavaScript

•Early uses: sparkly text

•Lack of useful features in Browser:
 e.g. XMLHttpRequest

•Slow
The Problems
•
Weird Shit:
NaN != NaN // true

[] + {} = 0
{} + [] = [Object object]

‘ ’ == ‘0’ // false
0 == ‘ ’   // true
0 == ‘0’ // true
The Problems
•The DOM

•Anyone can do it!

•jQuery
The Awesome
       Functional Programming
• Functions are first class

• Incredibly powerful

• Closures / Lambda Calculus

• Callbacks: non-blocking

• Definitely not scripting!
The Awesome
             Functional Programming
var array = [4, 8, 9, 1, 3, 9];

var weirdArray = (function() {
  var newArray = [], i = 0, len = array.length;

  for (i = 0; i < len; i += 1) {
     newArray.push(array[i] + ‘ tiny monkeys’);
  }

    return newArray;
}());

console.log(weirdArray); // [‘4 tiny monkeys’, ‘8 tiny monkeys’, ..., ‘9
The Awesome
                Functional Programming
var go = function (callback) {     var logger = function (fn, name) {
  var i, array = [];                 var start = new Date().getTime(),

   for (i = 0; i < 2000000; i +=         log = function () {
1) {                                        var end = new Date().getTime();
      array.push(i);                        return name + ' took ' + (end - start) + '
   }                               milliseconds';
                                         };
    return callback();
}                                       return fn(log);



       console.log(logger(go, 'go'));      //    ‘go took 114 milliseconds’
The Awesome
        Prototypical Inheritance

• Objects without classes

• Powerful enough that it can pretty much emulate
  classical inheritance

• Can reduce code significantly if used properly

• Can be a bit confusing at first
You Need to Know
• JavaScript is the new bytecode?

• Web apps are the future?

• Thin server-side architectures?

• Can’t be replaced?

• Windows 8

• Multi-processor support

Contenu connexe

Dernier

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
 
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
 

Dernier (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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 ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
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...
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

En vedette (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

How I Learned to Stop Worrying and Love JavaScript

  • 1. How I Learned to Stop Worrying and Love JavaScript
  • 2. JavaScript •Technically: ECMAScript •ECMA-262 Specification (currently v5.1) •Weakly typed, interpreted, object based, functional, prototypical
  • 3. The History •Created by Brendan Eich in 10 days •Released in 1995 as part of Netscape Navigator 2.0 •First standardised in 1997 •Also know as Mocha, LiveScript,
  • 4. The Lineage • Scheme: Functional •Self: Prototypical •Java: Ugly
  • 5. The Problems •The Name: JavaScript •Early uses: sparkly text •Lack of useful features in Browser: e.g. XMLHttpRequest •Slow
  • 6. The Problems • Weird Shit: NaN != NaN // true [] + {} = 0 {} + [] = [Object object] ‘ ’ == ‘0’ // false 0 == ‘ ’ // true 0 == ‘0’ // true
  • 7. The Problems •The DOM •Anyone can do it! •jQuery
  • 8. The Awesome Functional Programming • Functions are first class • Incredibly powerful • Closures / Lambda Calculus • Callbacks: non-blocking • Definitely not scripting!
  • 9. The Awesome Functional Programming var array = [4, 8, 9, 1, 3, 9]; var weirdArray = (function() { var newArray = [], i = 0, len = array.length; for (i = 0; i < len; i += 1) { newArray.push(array[i] + ‘ tiny monkeys’); } return newArray; }()); console.log(weirdArray); // [‘4 tiny monkeys’, ‘8 tiny monkeys’, ..., ‘9
  • 10. The Awesome Functional Programming var go = function (callback) { var logger = function (fn, name) { var i, array = []; var start = new Date().getTime(), for (i = 0; i < 2000000; i += log = function () { 1) { var end = new Date().getTime(); array.push(i); return name + ' took ' + (end - start) + ' } milliseconds'; }; return callback(); } return fn(log); console.log(logger(go, 'go')); // ‘go took 114 milliseconds’
  • 11. The Awesome Prototypical Inheritance • Objects without classes • Powerful enough that it can pretty much emulate classical inheritance • Can reduce code significantly if used properly • Can be a bit confusing at first
  • 12. You Need to Know • JavaScript is the new bytecode? • Web apps are the future? • Thin server-side architectures? • Can’t be replaced? • Windows 8 • Multi-processor support

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. - JavaScript: Sounds like a simplified Java. Actually way more powerful.\n- XMLHttp: first in 1999 in IE5, Mozilla 2002, Safari 2004\n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n