SlideShare une entreprise Scribd logo
1  sur  31
Javascript
Topics


Javascript Basics
Modularization
Dependency Management
Bundling
JavaScript Basics
Topics

 Variables & Data types

 Object Literals

 Functions
   Declarations
   Functions as arguments
   Anonymous functions
Variables & Data types

In javascript, variables can hold any type of
 data.
Variable types keep on changing as we assign
 new data to them.

Code Examples:
  var hello = “world”;
  hello = 23;
  hello = function(){ return “world” }
Object Literals

 An object literal is a comma separated list of name
  value pairs wrapped in curly braces.

 In JavaScript an object literal is defined as follows:
    var person = {
          name: 'James',
          age: 28,
          isAlive: true
     };
Objects can have arrays, objects and functions as
their properties
  var person = {
        name: 'James',
        age: 28,
        isAlive: true,
        childObject: {
             property1: „hello world‟,
             property2: 4938,
             property3: false
        },
        favoriteColors: [“Blue”, “Yellow”, “Magenta”],
        getAge: function(){
             return this.age;
        }
   };
Function Declarations
 function isNimble() { return true; }
 var canFly = function () { return true; };
 window.isDeadly = function () { return true; };


 Differences:
    isNumble is defined at parse-time, whereas canFly and isDeadly is
     defined at runtime.


    canFly and isDeadly are merely two variables which have anonymous
     functions assigned to them whereas isNumble is a named function.
Functions as Arguments
 function greet( getMessage ) {
     var message = “Good “ + getMessage();
     alert( message );
 }


 function eveningGreet () {
     return “evening”;
 }


 greet( eveningGreet );
Anonymous Functions
 function greet( getMessage ) {
        var message = “Good “ + getMessage();
        alert( message );
 }


 greet( function () {
        return “evening”;
 } );
Modularization
What & Why?

 A module is an independent unit of functionality that is part of the total
  structure of a web application


 it‟s very important to have all the code well-organized


 Maintaining a spaghetti-coded application will only cause you headaches
  and nightmares


 Modularization makes your code easier to manage
Benefits

 Small pieces of code are separately stored in modules

 Easier maintenance

 Avoid global namespace problems.

 Encapsulation - Expose only selected functions or
  properties by wrapping all your code inside a module
Module Rules
Modules are like little kids, they need a strict set of rules so
they don’t get into trouble.

 Hands to yourself
     Only call your own methods or those available in application core.
     Don‟t access DOM elements outside of your box
     Don‟t access non-native global objects


 Don‟t leave your toys around
     Don‟t create global objects


 Don‟t talk to strangers
     Don‟t directly reference other modules
LoadRunner

 A small javascript dependency manager.

 Modules are loaded asynchronously.
Defining a module:

provide(„module_name‟, function( exporter ){

      function say ( text ) {

          alert ( text ) ;

      }

      exporter( say );

});
Using a module:


using(„module_name‟, function( speak ){

      speak( „ hello world „);

});
Code Examples

 Example1.html - Global functions
 Example2.html - Modularized functions – single module
 Example3.html - Modularized functions – multiple modules at once
Dependency Management
Single module dependency


using(„module_say‟, function( speak ){

      speak( „ hello world „);

});
Multiple module dependency


using(„module_say‟, „module_greet‟,

      function( speak , greet){

         speak(„ hello world ‟); // say hello to world

         greet(„Mr. Zain‟); // greet Mr. Zain

});
Automatic dependency loading


Loading external files automatically when
 required.


Code Examples
   Example4.html - Modularization - loading external modules
   Example5.html - Modularization - loading external modules on
    click event
AMD – Asynchronous Module Definition

 Non-blocking
 Parallel loading
 Fast
 Improved maintainability
 Well-defined / standardized
How AMD works?

 Core methods to implement an AMD Module
   require – used to get reference to an already loaded module.
   define – used to define a module.


 define method:
   require, exports, module parameters
debug module()
define(„ debug„ ,
     [ „module‟, „require‟, „exports‟ ] ,
     function (module , require, exports) {


         function debug( data ) {
              console.log( data );
         }
         module.exports = debug;


     }
);
define()
define(„ module_1 „ ,
     [ „module‟, „require‟, „exports‟, „depA‟, „depB‟ ] ,
     function (module , require, exports, depA , depB) {


         var myModule = {};
         myModule.play = depA.play;
         myModule.player = depB.player;
         module.exports = myModule;
     }
);
Lets see code examples

 Example6.html - Modularization – define a module AMD way
 Example7.html - Modularization – loading external AMD modules
 Example8.html - Modularization – loading external modules which are
  dependent on other modules.
 Example9.html - Modularization – loading external modules on click event
Bundling
 Used to merge multiple modules in one single file to reduce number of http
  requests.


 Code Examples
     Example10.html – loading bundles instead of separate modules
Questions?
References

 Function definition
     http://stackoverflow.com/questions/336859/javascript-var-functionname-
      function-vs-function-functionname
 Modularization
     https://github.com/danwrong/loadrunner
     https://tutsplus.com/tutorial/writing-modular-javascript/

Contenu connexe

Tendances

jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentation
John Slick
 
Powerful persistence layer with Google Guice & MyBatis
Powerful persistence layer with Google Guice & MyBatisPowerful persistence layer with Google Guice & MyBatis
Powerful persistence layer with Google Guice & MyBatis
simonetripodi
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
Kai Koenig
 
Codebits 2012 - Fast relational web site construction.
Codebits 2012 - Fast relational web site construction.Codebits 2012 - Fast relational web site construction.
Codebits 2012 - Fast relational web site construction.
Nelson Gomes
 

Tendances (20)

Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for PerformanceMeet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
 
Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)
 
The Naked Bundle - Tryout
The Naked Bundle - TryoutThe Naked Bundle - Tryout
The Naked Bundle - Tryout
 
Backbone js
Backbone jsBackbone js
Backbone js
 
jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentation
 
hibernate with JPA
hibernate with JPAhibernate with JPA
hibernate with JPA
 
Powerful persistence layer with Google Guice & MyBatis
Powerful persistence layer with Google Guice & MyBatisPowerful persistence layer with Google Guice & MyBatis
Powerful persistence layer with Google Guice & MyBatis
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernate
 
(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)
(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)
(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)
 
Knockout.js
Knockout.jsKnockout.js
Knockout.js
 
Angular Directives from Scratch
Angular Directives from ScratchAngular Directives from Scratch
Angular Directives from Scratch
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
 
Codebits 2012 - Fast relational web site construction.
Codebits 2012 - Fast relational web site construction.Codebits 2012 - Fast relational web site construction.
Codebits 2012 - Fast relational web site construction.
 
Difference between java script and jquery
Difference between java script and jqueryDifference between java script and jquery
Difference between java script and jquery
 
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
 
Jpa 2.1 Application Development
Jpa 2.1 Application DevelopmentJpa 2.1 Application Development
Jpa 2.1 Application Development
 
Drupal Module Development
Drupal Module DevelopmentDrupal Module Development
Drupal Module Development
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in Components
 
Javascript Module Patterns
Javascript Module PatternsJavascript Module Patterns
Javascript Module Patterns
 
Java beans
Java beansJava beans
Java beans
 

En vedette

Modular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S MakModular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S Mak
mfrancis
 
Modular JavaScript
Modular JavaScriptModular JavaScript
Modular JavaScript
NLJUG
 
The Many Ways to Build Modular JavaScript
The Many Ways to Build Modular JavaScriptThe Many Ways to Build Modular JavaScript
The Many Ways to Build Modular JavaScript
Tim Perry
 

En vedette (12)

The Future is Modular, Jonathan Snook
The Future is Modular, Jonathan SnookThe Future is Modular, Jonathan Snook
The Future is Modular, Jonathan Snook
 
Analyzing Java Applications Using Thermostat (Omair Majid)
Analyzing Java Applications Using Thermostat (Omair Majid)Analyzing Java Applications Using Thermostat (Omair Majid)
Analyzing Java Applications Using Thermostat (Omair Majid)
 
Write Powerful Javascript Modules To Make Your Apps DRY (Brian Leathem)
Write Powerful Javascript Modules To Make Your Apps DRY (Brian Leathem)Write Powerful Javascript Modules To Make Your Apps DRY (Brian Leathem)
Write Powerful Javascript Modules To Make Your Apps DRY (Brian Leathem)
 
Writing modular java script
Writing modular java scriptWriting modular java script
Writing modular java script
 
Week 06 Modular Javascript_Brandon, S. H. Wu
Week 06 Modular Javascript_Brandon, S. H. WuWeek 06 Modular Javascript_Brandon, S. H. Wu
Week 06 Modular Javascript_Brandon, S. H. Wu
 
Modular JavaScript
Modular JavaScriptModular JavaScript
Modular JavaScript
 
Modular JavaScript
Modular JavaScriptModular JavaScript
Modular JavaScript
 
Modular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S MakModular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S Mak
 
Modular JavaScript
Modular JavaScriptModular JavaScript
Modular JavaScript
 
Turn your spaghetti code into ravioli with JavaScript modules
Turn your spaghetti code into ravioli with JavaScript modulesTurn your spaghetti code into ravioli with JavaScript modules
Turn your spaghetti code into ravioli with JavaScript modules
 
The Many Ways to Build Modular JavaScript
The Many Ways to Build Modular JavaScriptThe Many Ways to Build Modular JavaScript
The Many Ways to Build Modular JavaScript
 
reveal.js 3.0.0
reveal.js 3.0.0reveal.js 3.0.0
reveal.js 3.0.0
 

Similaire à Modular javascript

Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
intelliyole
 
Jquery Plugin
Jquery PluginJquery Plugin
Jquery Plugin
Ravi Mone
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 

Similaire à Modular javascript (20)

How AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design Patterns
 
IOC + Javascript
IOC + JavascriptIOC + Javascript
IOC + Javascript
 
AngularJS Custom Directives
AngularJS Custom DirectivesAngularJS Custom Directives
AngularJS Custom Directives
 
Javascript Best Practices
Javascript Best PracticesJavascript Best Practices
Javascript Best Practices
 
Advanced Node.JS Meetup
Advanced Node.JS MeetupAdvanced Node.JS Meetup
Advanced Node.JS Meetup
 
6976.ppt
6976.ppt6976.ppt
6976.ppt
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
Jquery Plugin
Jquery PluginJquery Plugin
Jquery Plugin
 
NodeJs Modules1.pdf
NodeJs Modules1.pdfNodeJs Modules1.pdf
NodeJs Modules1.pdf
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Dom
 
Modular programming Using Object in Scala
Modular programming Using Object in ScalaModular programming Using Object in Scala
Modular programming Using Object in Scala
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Java 9
Java 9Java 9
Java 9
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
Global objects in Node.pdf
Global objects in Node.pdfGlobal objects in Node.pdf
Global objects in Node.pdf
 
Built to last javascript for enterprise
Built to last   javascript for enterpriseBuilt to last   javascript for enterprise
Built to last javascript for enterprise
 
AJS UNIT-1 2021-converted.pdf
AJS UNIT-1 2021-converted.pdfAJS UNIT-1 2021-converted.pdf
AJS UNIT-1 2021-converted.pdf
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS Architecture
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
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
 
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, ...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Modular javascript

  • 4. Topics  Variables & Data types  Object Literals  Functions Declarations Functions as arguments Anonymous functions
  • 5. Variables & Data types In javascript, variables can hold any type of data. Variable types keep on changing as we assign new data to them. Code Examples: var hello = “world”; hello = 23; hello = function(){ return “world” }
  • 6. Object Literals  An object literal is a comma separated list of name value pairs wrapped in curly braces.  In JavaScript an object literal is defined as follows: var person = { name: 'James', age: 28, isAlive: true };
  • 7. Objects can have arrays, objects and functions as their properties var person = { name: 'James', age: 28, isAlive: true, childObject: { property1: „hello world‟, property2: 4938, property3: false }, favoriteColors: [“Blue”, “Yellow”, “Magenta”], getAge: function(){ return this.age; } };
  • 8. Function Declarations  function isNimble() { return true; }  var canFly = function () { return true; };  window.isDeadly = function () { return true; };  Differences:  isNumble is defined at parse-time, whereas canFly and isDeadly is defined at runtime.  canFly and isDeadly are merely two variables which have anonymous functions assigned to them whereas isNumble is a named function.
  • 9. Functions as Arguments function greet( getMessage ) { var message = “Good “ + getMessage(); alert( message ); } function eveningGreet () { return “evening”; } greet( eveningGreet );
  • 10. Anonymous Functions function greet( getMessage ) { var message = “Good “ + getMessage(); alert( message ); } greet( function () { return “evening”; } );
  • 12. What & Why?  A module is an independent unit of functionality that is part of the total structure of a web application  it‟s very important to have all the code well-organized  Maintaining a spaghetti-coded application will only cause you headaches and nightmares  Modularization makes your code easier to manage
  • 13. Benefits  Small pieces of code are separately stored in modules  Easier maintenance  Avoid global namespace problems.  Encapsulation - Expose only selected functions or properties by wrapping all your code inside a module
  • 14. Module Rules Modules are like little kids, they need a strict set of rules so they don’t get into trouble.  Hands to yourself  Only call your own methods or those available in application core.  Don‟t access DOM elements outside of your box  Don‟t access non-native global objects  Don‟t leave your toys around  Don‟t create global objects  Don‟t talk to strangers  Don‟t directly reference other modules
  • 15. LoadRunner  A small javascript dependency manager.  Modules are loaded asynchronously.
  • 16. Defining a module: provide(„module_name‟, function( exporter ){ function say ( text ) { alert ( text ) ; } exporter( say ); });
  • 17. Using a module: using(„module_name‟, function( speak ){ speak( „ hello world „); });
  • 18. Code Examples  Example1.html - Global functions  Example2.html - Modularized functions – single module  Example3.html - Modularized functions – multiple modules at once
  • 20. Single module dependency using(„module_say‟, function( speak ){ speak( „ hello world „); });
  • 21. Multiple module dependency using(„module_say‟, „module_greet‟, function( speak , greet){ speak(„ hello world ‟); // say hello to world greet(„Mr. Zain‟); // greet Mr. Zain });
  • 22. Automatic dependency loading Loading external files automatically when required. Code Examples  Example4.html - Modularization - loading external modules  Example5.html - Modularization - loading external modules on click event
  • 23. AMD – Asynchronous Module Definition  Non-blocking  Parallel loading  Fast  Improved maintainability  Well-defined / standardized
  • 24. How AMD works?  Core methods to implement an AMD Module  require – used to get reference to an already loaded module.  define – used to define a module.  define method:  require, exports, module parameters
  • 25. debug module() define(„ debug„ , [ „module‟, „require‟, „exports‟ ] , function (module , require, exports) { function debug( data ) { console.log( data ); } module.exports = debug; } );
  • 26. define() define(„ module_1 „ , [ „module‟, „require‟, „exports‟, „depA‟, „depB‟ ] , function (module , require, exports, depA , depB) { var myModule = {}; myModule.play = depA.play; myModule.player = depB.player; module.exports = myModule; } );
  • 27. Lets see code examples  Example6.html - Modularization – define a module AMD way  Example7.html - Modularization – loading external AMD modules  Example8.html - Modularization – loading external modules which are dependent on other modules.  Example9.html - Modularization – loading external modules on click event
  • 29.  Used to merge multiple modules in one single file to reduce number of http requests.  Code Examples  Example10.html – loading bundles instead of separate modules
  • 31. References  Function definition  http://stackoverflow.com/questions/336859/javascript-var-functionname- function-vs-function-functionname  Modularization  https://github.com/danwrong/loadrunner  https://tutsplus.com/tutorial/writing-modular-javascript/