SlideShare une entreprise Scribd logo
1  sur  25
Piyush Katariya 
corporate.piyush@gmail.com
 First appearance in Netscape Navigator 2.0 in Sept 1995 
 Microsoft launched JScript as alternative in Aug 1996 
 Request for Standardization in Nov 1996 
 ECMA-262 specification in June 1997 
 Third edition in Dec 1999 
 Fifth edition in Dec 2009 
 Sixth edition expected by mid 2015 
 Today – Preferred programming language of the Web 
 Not limited to Web Browsers – node.js, ringo.js
 Imperative, Object Oriented, Functional, and Prototypal 
 Dynamic 
 Single Threaded 
 Asynchronous, Event Driven 
 Sandboxed 
 God created the earth in 7 days. 
Brendan Eich created JavaScript in 10 days. 
UI Thread 
Browser 
DOM 
Work Queue 
JS Engine Layout Engine 
Operating System 
C P U G P U
 Never mind ! Everything is a var 
 var stringVariable = “JavaScript” 
 var booleanVariable = true 
 var intVariable = 10 
 var floatVariable = 10.5 
 Numbers are treated as float 
 null !== undefined 
 Falsy values – 0 (zero), NaN, ‘’, false, null, undefined
 Object is collection of key–value pairs with optional hidden link to prototype object 
 Instantiation 
 var obj = new Object() 
 var objShortHand = { } 
 var objWithInitialValue = { “property” : “value”} 
 var objTheUltimate = Object.create(parentObject) 
 Access 
 obj.property 
 obj[“property”] 
 obj.nestedObj.property 
 obj[“nestedObj”].property 
 Runtime Mutation 
 obj.newProperty = “value” 
 obj.nestedObj = { “property” : “value”} 
 obj.nestedObj[“property”] = “different value” 
 Deletion 
 delete obj.property
 Callable first class citizen 
 Linked to Function.prototype linked to Object.prototype 
 Can be passed and return as object 
 No Overloading 
 Definitions 
 var add = new Function(‘a’, ‘b’, ‘return a + b’); 
 var add = function (a, b) { return a + b; }; 
 function add(a, b) { return a + b;} 
 Blessed with 
 this 
 arguments
Function invocation (Direct Invocation) 
 add(1, 2) 
 isPalindrome(‘madam’) 
 this bound to global object !!!
Method Invocation 
 Method => a function stored as property of object 
 this bound to method holder object 
var obj = { 
value : 0, //zero 
increment : function (inc) { 
this.value += typeof inc === ‘number’ ? inc : 1; 
} 
} 
obj.increment(1) ; // 1 
obj.increment(2); // 3
var someClass = function (property) { 
this.publicProperty = property; 
var privateVariable = “value”; 
this.publicMethod = function () { 
//code for method definition 
}; 
var privateMethod = function () { 
//code for method definition 
}; 
// return this; 
}
Constructor Invocation 
 JS way of creating objects OO style 
var EmployeeClass = function (firstName, designation) { 
this.firstName = firstName; 
this.designation = designation; 
}; 
EmployeeClass.protoype.getFirstName = function () { return this.firstName;}; 
EmployeeClass.protoype.getDesignation = function () { return this.designation;}; 
var employee = new EmployeeClass(‘Piyush’, ‘Software Dev’) 
employee.getFirstName(); // ‘Piyush’ 
employee.getDesignation(); // ‘Software Dev’
Apply Invocation (Reflective Invocation) 
var argsArray = [2, 3]; 
var sum = add.apply( null, argsArray); // 3 
//OR 
var sum = add.call( null, 2, 3); //3 
var firstName = EmployeeClass.getFirstName.apply(empObject); 
//OR 
var firstName = EmployeeClass.getFirstName.call(empObject);
 Facilitates late(runtime) binding 
Function.prototype.bind = function (objToBind) { 
var self = this; 
return function () { 
var argArr = Array.prototype.slice.call(arguments); 
return self.apply(objToBind || null, argArr); 
}; 
}
 Use when some of the inputs to function are always known 
Function.prototype.curry = function () { 
var initArgs = Array.prototype.slice.call(arguments); 
var self = this; 
return function () { 
var args = Array.prototype.slice.call(arguments); 
return self.apply(null, initArgs.concat(args)) 
} 
};
 Never ever ever make use for loop again while operating on Arrays ! 
 var names = [‘Piyush’, ‘James’, ‘Shwetha’, ‘Kapil’, ‘Praveen’, ‘Matt’, ‘Nag’, ‘Shabina’] 
 map => conversion function which get executed for every element 
 names.map(function(name){ return name.substring(0, 3); }) 
 filter => logical condition function to consider only sub set of array 
 names.filter(function(name){ return name.indexOf(‘i’) > 0; }) 
 reduce => compute result by considering each element with optional initial value 
 names.reduce(function(name1, name2) { return name1 + ‘ , ’ + name2; }) 
 names.reduce(function(name1, name2) { return name1 + ‘ , ’ + name2; }, ‘ Madhu’) 
 sort => comparison function to order the element in custom fashion 
 names.sort() 
 names.sort(function(name1, name2) { return name1 < name2; }) 
 forEach => alternative to for loop to just focus on operation 
 names.forEach(function(name) { console.log(name); }) 
 every => does every element in array satisfies the logical condition 
 some => does at least one element in array satisfies the logical condition 
 reduceRight => same as reduce but iterates array from last to first index
 It’s a LIVE chain
 Avoid global variables and functions 
 Use parseInt(obj, 10) 
 eval function is evil ! 
 ‘===’ and ‘!== ’ for comparison 
 Never use void, becoz its operator ! 
 Always prefix var with variable declaration 
 Use semicolons everywhere at EOL 
 Never augment built in objects 
 Consider underscore.js as default choice 
 Use JSLint for code inspection 
 And of course above all, Do Meditate ! 
var clockOnce = setTimeout(fn, delay) 
 Execute function <fn> after <delay> milliseconds 
 Queue function <fn> to execute after <delay> milliseconds 
 Used to divide highly computationally complex(CPU bound) tasks 
 Cancellation => clearTimeout(clockOnce) 
var timer = setInterval(fn, delay) 
 Execute function <fn> after every <delay> milliseconds 
 Queue function <fn> to execute after every <delay> milliseconds 
 Cancellation => clearInterval(timer)
var counterModule = ( function( ) { 
var privateCount = 0; 
function changeBy(val) { 
return privateCount += val; 
} 
return { 
increment : function() { 
changeBy(1); 
}, 
decrement : function() { 
changeBy(-1); 
}, 
currentValue : function() { 
return privateCount; 
} 
}; 
} ) ( );
var Singleton = ( function () { 
var instance; 
function createInstance() { 
var object = new Object("I am the only instance"); 
return object; 
} 
return { 
getInstance : function () { 
if (! instance) { 
instance = createInstance(); 
} 
return instance; 
} 
}; 
})();
 Why ? 
 Higher level abstraction and constructs 
 Type safety 
 Declarative - More focus on WHAT need to be done instead of HOW 
 Stick to one worthy language for end to end application stack 
 Usage 
 Code in your own language 
 Compile it into JS (either offline or in browser itself ) 
 Run in browser 
 Support debugging for original language in browser using source maps 
 Options 
 CoffeeScript 
 TypeScript 
 Dart 
 ScalaJS 
 PythonJS 
 ClojureScript 
 More at this link
 Process of removing all unnecessary characters and 
modifying source code spread over single or multiple 
file without changing its functionality 
 Advantages 
 Single artifact for whole application 
 Reduced size of code 
 Obfuscated code 
 Applicable for JS and CSS
 JavaScript : The Good Parts by Douglas Crockford 
 JavaScript Pattern by Stoyan Stefanov 
 Wikipedia.org
 jQuery - for DOM access and manipulation 
 Node.js – server side JS 
 Require.js - async module loader 
 Backbone.js – client side MVC 
 Angular.js – powerpack SPA framework
Thank You

Contenu connexe

Tendances

Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced JavascriptDhruvin Shah
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascriptGarrison Locke
 
Continuations in scala (incomplete version)
Continuations in scala (incomplete version)Continuations in scala (incomplete version)
Continuations in scala (incomplete version)Fuqiang Wang
 
Exploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App developmentExploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App developmentJayaprakash R
 
Sprint Boot & Kotlin - Meetup.pdf
Sprint Boot & Kotlin - Meetup.pdfSprint Boot & Kotlin - Meetup.pdf
Sprint Boot & Kotlin - Meetup.pdfChristian Zellot
 
Functional programming principles and Java 8
Functional programming principles and Java 8Functional programming principles and Java 8
Functional programming principles and Java 8Dragos Balan
 
Model with actors and implement with Akka
Model with actors and implement with AkkaModel with actors and implement with Akka
Model with actors and implement with AkkaNgoc Dao
 
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)raja kvk
 
Typescript for the programmers who like javascript
Typescript for the programmers who like javascriptTypescript for the programmers who like javascript
Typescript for the programmers who like javascriptAndrei Sebastian Cîmpean
 
Oslo.versioned objects - Deep Dive
Oslo.versioned objects - Deep DiveOslo.versioned objects - Deep Dive
Oslo.versioned objects - Deep Divedavanum
 
Functional programing jargon
Functional programing jargonFunctional programing jargon
Functional programing jargonRemo Jansen
 
Swift, a quick overview
Swift, a quick overviewSwift, a quick overview
Swift, a quick overviewJulian Król
 
Testing of React JS app
Testing of React JS appTesting of React JS app
Testing of React JS appAleks Zinevych
 

Tendances (20)

Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced Javascript
 
Functional Programming in Java
Functional Programming in JavaFunctional Programming in Java
Functional Programming in Java
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascript
 
Continuations in scala (incomplete version)
Continuations in scala (incomplete version)Continuations in scala (incomplete version)
Continuations in scala (incomplete version)
 
Exploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App developmentExploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App development
 
Sprint Boot & Kotlin - Meetup.pdf
Sprint Boot & Kotlin - Meetup.pdfSprint Boot & Kotlin - Meetup.pdf
Sprint Boot & Kotlin - Meetup.pdf
 
jQuery (intermediate)
jQuery (intermediate)jQuery (intermediate)
jQuery (intermediate)
 
Functional programming principles and Java 8
Functional programming principles and Java 8Functional programming principles and Java 8
Functional programming principles and Java 8
 
JavaScript Fundamentals
JavaScript FundamentalsJavaScript Fundamentals
JavaScript Fundamentals
 
Model with actors and implement with Akka
Model with actors and implement with AkkaModel with actors and implement with Akka
Model with actors and implement with Akka
 
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
 
TypeScript Overview
TypeScript OverviewTypeScript Overview
TypeScript Overview
 
Typescript for the programmers who like javascript
Typescript for the programmers who like javascriptTypescript for the programmers who like javascript
Typescript for the programmers who like javascript
 
Oslo.versioned objects - Deep Dive
Oslo.versioned objects - Deep DiveOslo.versioned objects - Deep Dive
Oslo.versioned objects - Deep Dive
 
me-and-python
me-and-pythonme-and-python
me-and-python
 
Functional programing jargon
Functional programing jargonFunctional programing jargon
Functional programing jargon
 
Modern Java Development
Modern Java DevelopmentModern Java Development
Modern Java Development
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
 
Swift, a quick overview
Swift, a quick overviewSwift, a quick overview
Swift, a quick overview
 
Testing of React JS app
Testing of React JS appTesting of React JS app
Testing of React JS app
 

En vedette

JavaScript for Enterprise Applications
JavaScript for Enterprise ApplicationsJavaScript for Enterprise Applications
JavaScript for Enterprise ApplicationsPiyush Katariya
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom ManipulationMohammed Arif
 
An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOMMindy McAdams
 

En vedette (6)

What is scala
What is scalaWhat is scala
What is scala
 
JavaScript and DOM
JavaScript and DOMJavaScript and DOM
JavaScript and DOM
 
JavaScript for Enterprise Applications
JavaScript for Enterprise ApplicationsJavaScript for Enterprise Applications
JavaScript for Enterprise Applications
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
 
Javascript and DOM
Javascript and DOMJavascript and DOM
Javascript and DOM
 
An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOM
 

Similaire à JavaScript (without DOM)

Similaire à JavaScript (without DOM) (20)

Oojs 1.1
Oojs 1.1Oojs 1.1
Oojs 1.1
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
Let's JavaScript
Let's JavaScriptLet's JavaScript
Let's JavaScript
 
oojs
oojsoojs
oojs
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
 
Javascript tid-bits
Javascript tid-bitsJavascript tid-bits
Javascript tid-bits
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues
 
Functional Programming with JavaScript
Functional Programming with JavaScriptFunctional Programming with JavaScript
Functional Programming with JavaScript
 
ES6 metaprogramming unleashed
ES6 metaprogramming unleashedES6 metaprogramming unleashed
ES6 metaprogramming unleashed
 
Java script Techniques Part I
Java script Techniques Part IJava script Techniques Part I
Java script Techniques Part I
 
Module design pattern i.e. express js
Module design pattern i.e. express jsModule design pattern i.e. express js
Module design pattern i.e. express js
 
Javascript
JavascriptJavascript
Javascript
 
Advance JS and oop
Advance JS and oopAdvance JS and oop
Advance JS and oop
 
Advanced javascript
Advanced javascriptAdvanced javascript
Advanced javascript
 
JavaScript Misunderstood
JavaScript MisunderstoodJavaScript Misunderstood
JavaScript Misunderstood
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
JavaScript(Es5) Interview Questions & Answers
JavaScript(Es5)  Interview Questions & AnswersJavaScript(Es5)  Interview Questions & Answers
JavaScript(Es5) Interview Questions & Answers
 
jQuery with javascript training by Technnovation Labs
jQuery with javascript training by Technnovation LabsjQuery with javascript training by Technnovation Labs
jQuery with javascript training by Technnovation Labs
 

Plus de Piyush Katariya

Concurrency, Parallelism And IO
Concurrency,  Parallelism And IOConcurrency,  Parallelism And IO
Concurrency, Parallelism And IOPiyush Katariya
 
Handling the growth of data
Handling the growth of dataHandling the growth of data
Handling the growth of dataPiyush Katariya
 
My inspirations and learned lessons
My inspirations and learned lessonsMy inspirations and learned lessons
My inspirations and learned lessonsPiyush Katariya
 
Rise of the Single Page Application
Rise of the Single Page ApplicationRise of the Single Page Application
Rise of the Single Page ApplicationPiyush Katariya
 
Introduction to Web Application Clustering
Introduction to Web Application ClusteringIntroduction to Web Application Clustering
Introduction to Web Application ClusteringPiyush Katariya
 

Plus de Piyush Katariya (6)

Concurrency, Parallelism And IO
Concurrency,  Parallelism And IOConcurrency,  Parallelism And IO
Concurrency, Parallelism And IO
 
Handling the growth of data
Handling the growth of dataHandling the growth of data
Handling the growth of data
 
Expression problem
Expression problemExpression problem
Expression problem
 
My inspirations and learned lessons
My inspirations and learned lessonsMy inspirations and learned lessons
My inspirations and learned lessons
 
Rise of the Single Page Application
Rise of the Single Page ApplicationRise of the Single Page Application
Rise of the Single Page Application
 
Introduction to Web Application Clustering
Introduction to Web Application ClusteringIntroduction to Web Application Clustering
Introduction to Web Application Clustering
 

Dernier

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 Pakistandanishmna97
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
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...apidays
 
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 Ontologyjohnbeverley2021
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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 AmsterdamUiPathCommunity
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
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 FresherRemote DBA Services
 
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 challengesrafiqahmad00786416
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
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...Jeffrey Haguewood
 
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.pdfOrbitshub
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
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...DianaGray10
 
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, ...apidays
 
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 FMESafe Software
 
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 REVIEWERMadyBayot
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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, Adobeapidays
 

Dernier (20)

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
 
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...
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
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
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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...
 
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
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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...
 
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, ...
 
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
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 

JavaScript (without DOM)

  • 2.  First appearance in Netscape Navigator 2.0 in Sept 1995  Microsoft launched JScript as alternative in Aug 1996  Request for Standardization in Nov 1996  ECMA-262 specification in June 1997  Third edition in Dec 1999  Fifth edition in Dec 2009  Sixth edition expected by mid 2015  Today – Preferred programming language of the Web  Not limited to Web Browsers – node.js, ringo.js
  • 3.  Imperative, Object Oriented, Functional, and Prototypal  Dynamic  Single Threaded  Asynchronous, Event Driven  Sandboxed  God created the earth in 7 days. Brendan Eich created JavaScript in 10 days. 
  • 4. UI Thread Browser DOM Work Queue JS Engine Layout Engine Operating System C P U G P U
  • 5.  Never mind ! Everything is a var  var stringVariable = “JavaScript”  var booleanVariable = true  var intVariable = 10  var floatVariable = 10.5  Numbers are treated as float  null !== undefined  Falsy values – 0 (zero), NaN, ‘’, false, null, undefined
  • 6.  Object is collection of key–value pairs with optional hidden link to prototype object  Instantiation  var obj = new Object()  var objShortHand = { }  var objWithInitialValue = { “property” : “value”}  var objTheUltimate = Object.create(parentObject)  Access  obj.property  obj[“property”]  obj.nestedObj.property  obj[“nestedObj”].property  Runtime Mutation  obj.newProperty = “value”  obj.nestedObj = { “property” : “value”}  obj.nestedObj[“property”] = “different value”  Deletion  delete obj.property
  • 7.  Callable first class citizen  Linked to Function.prototype linked to Object.prototype  Can be passed and return as object  No Overloading  Definitions  var add = new Function(‘a’, ‘b’, ‘return a + b’);  var add = function (a, b) { return a + b; };  function add(a, b) { return a + b;}  Blessed with  this  arguments
  • 8. Function invocation (Direct Invocation)  add(1, 2)  isPalindrome(‘madam’)  this bound to global object !!!
  • 9. Method Invocation  Method => a function stored as property of object  this bound to method holder object var obj = { value : 0, //zero increment : function (inc) { this.value += typeof inc === ‘number’ ? inc : 1; } } obj.increment(1) ; // 1 obj.increment(2); // 3
  • 10. var someClass = function (property) { this.publicProperty = property; var privateVariable = “value”; this.publicMethod = function () { //code for method definition }; var privateMethod = function () { //code for method definition }; // return this; }
  • 11. Constructor Invocation  JS way of creating objects OO style var EmployeeClass = function (firstName, designation) { this.firstName = firstName; this.designation = designation; }; EmployeeClass.protoype.getFirstName = function () { return this.firstName;}; EmployeeClass.protoype.getDesignation = function () { return this.designation;}; var employee = new EmployeeClass(‘Piyush’, ‘Software Dev’) employee.getFirstName(); // ‘Piyush’ employee.getDesignation(); // ‘Software Dev’
  • 12. Apply Invocation (Reflective Invocation) var argsArray = [2, 3]; var sum = add.apply( null, argsArray); // 3 //OR var sum = add.call( null, 2, 3); //3 var firstName = EmployeeClass.getFirstName.apply(empObject); //OR var firstName = EmployeeClass.getFirstName.call(empObject);
  • 13.  Facilitates late(runtime) binding Function.prototype.bind = function (objToBind) { var self = this; return function () { var argArr = Array.prototype.slice.call(arguments); return self.apply(objToBind || null, argArr); }; }
  • 14.  Use when some of the inputs to function are always known Function.prototype.curry = function () { var initArgs = Array.prototype.slice.call(arguments); var self = this; return function () { var args = Array.prototype.slice.call(arguments); return self.apply(null, initArgs.concat(args)) } };
  • 15.  Never ever ever make use for loop again while operating on Arrays !  var names = [‘Piyush’, ‘James’, ‘Shwetha’, ‘Kapil’, ‘Praveen’, ‘Matt’, ‘Nag’, ‘Shabina’]  map => conversion function which get executed for every element  names.map(function(name){ return name.substring(0, 3); })  filter => logical condition function to consider only sub set of array  names.filter(function(name){ return name.indexOf(‘i’) > 0; })  reduce => compute result by considering each element with optional initial value  names.reduce(function(name1, name2) { return name1 + ‘ , ’ + name2; })  names.reduce(function(name1, name2) { return name1 + ‘ , ’ + name2; }, ‘ Madhu’)  sort => comparison function to order the element in custom fashion  names.sort()  names.sort(function(name1, name2) { return name1 < name2; })  forEach => alternative to for loop to just focus on operation  names.forEach(function(name) { console.log(name); })  every => does every element in array satisfies the logical condition  some => does at least one element in array satisfies the logical condition  reduceRight => same as reduce but iterates array from last to first index
  • 16.  It’s a LIVE chain
  • 17.  Avoid global variables and functions  Use parseInt(obj, 10)  eval function is evil !  ‘===’ and ‘!== ’ for comparison  Never use void, becoz its operator !  Always prefix var with variable declaration  Use semicolons everywhere at EOL  Never augment built in objects  Consider underscore.js as default choice  Use JSLint for code inspection  And of course above all, Do Meditate ! 
  • 18. var clockOnce = setTimeout(fn, delay)  Execute function <fn> after <delay> milliseconds  Queue function <fn> to execute after <delay> milliseconds  Used to divide highly computationally complex(CPU bound) tasks  Cancellation => clearTimeout(clockOnce) var timer = setInterval(fn, delay)  Execute function <fn> after every <delay> milliseconds  Queue function <fn> to execute after every <delay> milliseconds  Cancellation => clearInterval(timer)
  • 19. var counterModule = ( function( ) { var privateCount = 0; function changeBy(val) { return privateCount += val; } return { increment : function() { changeBy(1); }, decrement : function() { changeBy(-1); }, currentValue : function() { return privateCount; } }; } ) ( );
  • 20. var Singleton = ( function () { var instance; function createInstance() { var object = new Object("I am the only instance"); return object; } return { getInstance : function () { if (! instance) { instance = createInstance(); } return instance; } }; })();
  • 21.  Why ?  Higher level abstraction and constructs  Type safety  Declarative - More focus on WHAT need to be done instead of HOW  Stick to one worthy language for end to end application stack  Usage  Code in your own language  Compile it into JS (either offline or in browser itself )  Run in browser  Support debugging for original language in browser using source maps  Options  CoffeeScript  TypeScript  Dart  ScalaJS  PythonJS  ClojureScript  More at this link
  • 22.  Process of removing all unnecessary characters and modifying source code spread over single or multiple file without changing its functionality  Advantages  Single artifact for whole application  Reduced size of code  Obfuscated code  Applicable for JS and CSS
  • 23.  JavaScript : The Good Parts by Douglas Crockford  JavaScript Pattern by Stoyan Stefanov  Wikipedia.org
  • 24.  jQuery - for DOM access and manipulation  Node.js – server side JS  Require.js - async module loader  Backbone.js – client side MVC  Angular.js – powerpack SPA framework