SlideShare a Scribd company logo
1 of 49
Download to read offline
© 2014 Farata Systems
JavaScript - Not Just a
Pretty Face
Yakov Fain, Farata Systems
© 2014 Farata Systems
© 2014 Farata Systems
Free bonus chapter on JavaScript:

https://github.com/oreillymedia/enterprise_web_development
© 2014 Farata Systems
What’s HTML5?
HTML + JavaScript + CSS + 

AJAX + HTML APIs + 

Developer’s Tools
© 2014 Farata Systems
3
Where to Run JavaScript?
• In Your Web browser
• In any JavaScript Engine, e.g. Google’s V8 JavaScript,
Oracle’s JVM Nashorn, etc.
© 2014 Farata Systems
JavaScript arrives to the place of execution as text.
There’s no compiler helping developers with syntax errors.
Users may have different runtime environment.
Imagine writing a Java program that must work in any version of JVM.
Why JS is more difficult than Java
© 2014 Farata Systems
Debugging JavaScript
• Firefox add-on FireBug
• Chrome Developer Tools - our choice
• Internet Explorer F12 Developer Tools
• Safari Develop
• Opera Dragonfly
© 2014 Farata Systems
IDE
Eclipse for Java EE Developers withVJET Plugin 

WebStorm and IntelliJ IDEA - my choice

Aptana Studio - Eclipse-based IDE

NetBeans - Project Easel

DreamWeaver

Visual Studio

© 2014 Farata Systems
Variables
Declaring a variable (unless in strict mode) is optional:
girlfriendName=“Mary”;
Variables declared without the keyword var are global. 



Variables declared with var inside functions are local.
function calculateSalary() {

var address = "123 Main Street"; // local String variable

age = 25; // global Number variable 

var married = true; // local boolean variable

married = "don’t remember"; // now it’s String variable

}
© 2014 Farata Systems
Objects and Functions
© 2014 Farata Systems
Functions. Briefly.
You can declare a function that doesn’t belong to any object and invoke it.
You can declare a function, assign it to a property of any object and invoke it there.
Functions can be objects Functions have memory
Java 8 introduced Lambda expressions they are similar to JS functions.
© 2014 Farata Systems
Declaring and Invoking a Function
// Declaring

/*

* No var in arguments

* No data types in arguments

* No need to declare return type

* even if a function return a value

*/

function calcTax(income, dependents) {

// Do stuff here

}
//Invoking:



calcTax(50000, 2); 

var myTax = calcTax(50000, 2);

//Declaring and invoking at the same time:



(function calcTax(income, dependents) {

// Do stuff here

})();
© 2014 Farata Systems
Function Expressions
//Assigning a function literal to a variable:



var doTax = function (income, dependents){

// Do stuff here

}
//Invoking a function:



doTax(50000, 2);

© 2014 Farata Systems
Creating Objects
Create objects with one of these methods:
1. Using object literals

!
2. Using new Object() notation

!
3. Create an object based on another object:

obj2=Object.create(obj1);

!
4. Using constructor functions and a new operator
© 2014 Farata Systems
Object Literals
An object is an unordered bunch of properties: key/value
pairs.
var t = {}; // create an instance of an empty object



var a = {someValue: 125}; // an instance with one property



// Store the data about Julia Roberts

var person = { lastName: "Roberts",

firstName: "Julia",

age: 42};
© 2014 Farata Systems
Object Methods in Literals
var person = {

"last Name": "Roberts",

firstName: "Julia",

age: 42,

makeAppointment: function () {

alert("Yakov wants to see " + this.firstName);

}

};



person.makeAppointment();
© 2014 Farata Systems
Assigning a Function to
Object Property
Declaring and assigning:	

!
myCustomer.doTax = function (income, dependents){!
// Do stuff here!
}
Invoking:	

!
myCustomer.doTax(50000, 2);!
© 2014 Farata Systems
Demo
• IntelliJ IDE, JavaScript, Chrome Developer Tools
© 2014 Farata Systems
JavaScript Object Notation
(JSON)
{

"fname": "Yakov",

"lname": "Fain",

"address": {

"street": "123 Main St.",

"city": "New York"

}

}
© 2014 Farata Systems
JavaScript Talks to Java
Java should not generate the presentation for Web pages.
Java should just send/receive the data to JavaScript
Google’s Protobuf data interchange format can be an
alternative to JSON (https://code.google.com/p/protobuf/)
HTML

JavaScript

CSS
!
Java
JSON
© 2014 Farata Systems
Google’s Gson (gson.jar)
//Parsing JSON String in Java using gson
!
public Customer createCustomerFromJson(

String jsonString){	

!
Gson myGson = new Gson();	

Customer cust = myGson.fromJson(jsonString,

Customer.class);	

return cust;
}
// Parsing JSON in JavaScript
!
var customer=	

JSON.parse(myJSONString);
Prior to Java EE 7 Gson library was the most popular JSON
parser in Java.
© 2014 Farata Systems
Constructor Functions
In Java, classes have constructors	

!
class Tax {
Tax(float income, 

int dependents){
// Do something here
}
…
public static void main(

String[] args){
// Creating 2 Tax objects
Tax t1 = new Tax(50000f, 3);
Tax t2 = new Tax(68000f, 1);
}
}
In JavaScript, a function can serve as a
constructor

!
!
function Tax(income, dependents){
// Do something here
}
…
// Creating 2 Tax objects
var t1 = new Tax(50000, 3);
var t2 = new Tax(68000, 1);
Name constructor functions with capital letters.
© 2014 Farata Systems
Prototypal Inheritance
In Java or C# you define a blueprint first: class A, and another blueprint
based on the first one: class B extends A. After that you can create
instances of A and/or B.
In JavaScript, an object can inherit from other object via a property called
prototype.
Object A
Object B
ObjectB.prototype=ObjectA;
© 2014 Farata Systems
Who’s Your Daddy?
// Constructor function Person
function Person(name, title){
this.name=name;
this.title=title;
this.subordinates=[];
}
// Constructor function Employee
!
function Employee(name, title){
this.name=name;
this.title=title;
}
Person and Employee ses”.
© 2014 Farata Systems
Who’s Your Daddy?
// Constructor function Person
function Person(name, title){
this.name=name;
this.title=title;
this.subordinates=[];
}
// Constructor function Employee
!
function Employee(name, title){
this.name=name;
this.title=title;
}
Person and Employee ses”.
Let’s make an Employee a “subclass” of a Person:
Employee.prototype = new Person();
var emp = new Employee(“Mary”, “Specialist”);
If	
  a	
  JS	
  engine	
  won’t	
  find	
  a	
  property	
  in	
  Employee,	
  it’ll	
  keep	
  looking	
  in	
  its	
  
prototype	
  chain	
  –	
  Person	
  and	
  Object	
  .	

!
Mozilla	
  has	
  introduced	
  a	
  property	
  __proto__,	
  but	
  it’ll	
  become	
  official	
  
only	
  in	
  ECMA	
  6.	
  
© 2014 Farata Systems
Methods in Function Objects
function Tax(income, dependents){
this.income=income;
this.dependents=dependents;
!
this.doTaxes=function() {
return income*0.05 - dependents*500;
}
}
// Creating Tax objects
var t1 = new Tax(50000, 3);
!
console.log("Your tax is : " + t1.doTaxes());
doTaxes 

is a property of
object Tax
Calling the method
doTaxes()
Assigning 

anonymous

function to a property
© 2014 Farata Systems
Private Variables in Function
Objects
function Tax(income, dependents){
this.income=income;
this.dependents=dependents;
!
var mafiaTaxDeduction= 300; // a private variable of the Tax object
!
this.doTaxes=function() {
return income*0.05 - dependents*500 – mafiaTaxDeduction;
}
}
// Creating Tax objects
var t1 = new Tax(50000, 3);
!
console.log("Your tax is : " + t1.doTaxes());
!
console.log("Your mafiaTaxDeduction is : " + t1.mafiaTaxDeduction); // Undefined
© 2014 Farata Systems
A function can operate in any
object by using call() or apply().
Delegation in action
Function
Object
© 2014 Farata Systems
Treating Functions as Data
//load data json and create new list using jQuery

$.getJSON(“featured_products.json”, function(data) {



//set current heading

headingContainer.text(data.heading);



// Erase the previous HTML content and append compiled template

parentContainer.html('').append(data.items);



}).fail(function (jqXHR, textStatus) {

//error handling code goes here

});



© 2014 Farata Systems
Every Function Object Has
Methods apply() and call()
!
• apply() – Allows calling any function on any object. 

Parameters are given as an array.

• call() – Allows calling any function on any object.

Parameters are given as a comma-separated list.
With	
  apply() and	
  call() you	
  to	
  call	
  an	
  arbitrary	
  function	
  xyz()as	
  if	
  this	
  function	
  was	

declared	
  as	
  a	
  method	
  on	
  a	
  specified	
  object	
  (e.g.	
  myTaxObject):	



xyz.call(myTaxObject, 50000, 3); 	

!
xyz.apply(myTaxObject, [50000, 3]); 	
  
© 2014 Farata Systems
Passing a Callback to a Function
1. Declare a function that invokes a given function to process an array	

function applyHandlersToArray(someArray, someCallBackFunction){
for (var i = 0; i < someArray.length; i++)
// Invoke the callback
someCallBackFunction.call(this, someArray[i]);
!
}
} 	

	

2. Invoke a function providing an array and a function 	

to be called for every element of the array 	

applyHandlersToArray([1,2,3], function(data){
console.log("Hello from a callback. Processing the value " + data)}
);
© 2014 Farata Systems
Java Anonymous Classes vs. JavaScript Callbacks
JavaScript anonymous functions!
as callbacks

!
myButton.addEventListener(“click”,
function(){
//Process the button click event	

}
);
Java Swing and inner classes	
  
myButton.addActionListener(

new ActionListener() {
public void

actionPerformed(ActionEvent e) {
// Process the button click event	

}
}
);
© 2014 Farata Systems
Java Anonymous Classes, Lambdas 

and JavaScript Callbacks
JavaScript anonymous functions!
as callbacks

!
myButton.addEventListener(“click”,
function(){
//Process the button click event	

}
);
Java Swing and inner classes	
  
myButton.addActionListener(

new ActionListener() {
public void

actionPerformed(ActionEvent e) {
// Process the button click event	

}
}
);
Java Swing with Lambda Expressions!
!
myButton.addActionListener( evt ->{
// Process the button click event}
);
© 2014 Farata Systems
Closures
© 2014 Farata Systems
Closure is a function call with strings attached
Closure is a function call with memory.

Larry Ullman
Java 8 should support closures (JSR 335).
Original image url: http://bit.ly/MYFaXD
© 2014 Farata Systems
Controlling Exposure with Closures
(function () { // this is an anonymous function expression



var taxDeduction = 500; // private context to remember 



//exposed closure

this.doTaxes = function (income, customerName) {



var yourTax;



if (customerName != "God Father") {

yourTax = income * 0.05 - taxDeduction;

} else {

yourTax = mafiaSpecial(income);

}



console.log(" Dear " + customerName + ", your tax is " + yourTax);

return yourTax;

}



//private function

function mafiaSpecial(income) {

return income * 0.05 - taxDeduction * 2;

}



})(); // Self-invoked function



// calling doTaxes() in the global scope. 

doTaxes(100000, "John Smith"); // The closure remembers its context: taxDeduction=500



doTaxes(100000, "God Father");

setTimeout(doTaxes(50000, "Mary Lou"), 2); // Call in 2 seconds 

mafiaSpecial(); // an error - this function is private
doTaxes

exposed
Anonymous function expression creates a scope
© 2014 Farata Systems
Person.prototype.doTaxes = function () {



var taxDeduction = 500;



//private function

function mafiaSpecial(income) {

return income * 0.05 - taxDeduction * 2;

}



//exposed function is returned as a value to the caller

return function (income) {



var yourTax;



if (this.name != "God Father") {

yourTax = income * 0.05 - taxDeduction;

} else {

yourTax = mafiaSpecial(income);

}



console.log(" My dear " + this.name + ", your tax is " + yourTax);

return yourTax;

}

}();
Returning a Closure
function Person(name){
this.name = name;
}
//Using closure
var p1=new Person("John Smith");
p1.doTaxes(100000);
!
var p2=new Person("God Father");
p2.doTaxes(100000);
© 2014 Farata Systems
Monitoring Closures in Chrome
© 2014 Farata Systems
Demo
Runing closure in Chrome Developer Tools
© 2014 Farata Systems
JavaScript in a Web Browser
Tipically we place <script> tags at the bottom of HTML page.
© 2014 Farata Systems
Some Properties of the window Object
location - an information about the window’s current location	



document - a reference to the Document object that provides access to all

HTML elements in a Web page

!
opener - a reference to the parent window that opened the current popup window	

	

parent - a reference to the parent of a frame or iFrame	

!
cookie - a reference to all name/value pairs of cookies in the document	

location=‘’http://yahoo.com”; // redirects your window to Yahoo’s home page
!
location.reload(); // reloads the current page
var childWindow = open(“xyz.html”); // opens a new browser child 



childWindow.moveTo(200,300); // moves the window to x=200, y=300



childWindow.close(); // closes the window
© 2014 Farata Systems
Web Browser’s Circle
Adding
to DOM
and
laying
out
Render
UI
Process
Events
Run the
scripts
The content is coming
© 2014 Farata Systems
Working with DOM
!
document.getElementById(id) – get a reference to HTML element by unique identifier
!
document.getElementsByTagName(tagname) - get a reference to one or more elements by

tag name, like a reference to all <div> elements.
!
document.getElementsByName(name) - get a reference to all elements that have 

specified value in their name attribute.
!
document.getElementsByClassName(className) – get a reference to all elements to

use specified CSS class.
© 2014 Farata Systems
Selectors API
document.querySelector(cssSelector) – Find the first element that matches 

a CSS selector string.

document.querySelectorAll(cssSelector) – Find all elements by a CSS selector string.	

!


	

These methods allows using more complex CSS selector
strings than getElementById(id) or
getElementsByTagName(tname).
© 2014 Farata Systems
Selecting an element by ID
and changing its value
<html>

<body>

The employee of the month is <span id="emp">...</span>



<script>

function setEmployeeOfTheMonth(){ 

var mySpan = document.getElementById("emp"); 



mySpan.firstChild.nodeValue= “John Smith”; 

} 

</script>

</body>

</html>

!
© 2014 Farata Systems
Using Styles
HTML use CSS class selectors, and you can control
styles programmatically in JavaScript.
!
The styles can be either embedded in your HTML page
in using <style> tag or loaded from the external .css file
using the <link> tag:
!
<head>	

<link rel=“stylesheet” type=“text/css” href=“mystyles.css”>	

</head>	

<body>	

<div id=“billingInfo” class=“niceStyle”>….</div>	

</body> .niceStyle{
font-family: Verdana;
font-size:large;
font-style:italic;
color:gray;
background-color:green;
}
© 2014 Farata Systems
Changing Styles in JavaScript
To find elements that use specified class selectors use
getElementsByClassName(), which returns a NodeList of
matching elements.
!
document.getElementsByClassName("niceStyle");
!
To change the selector on the HTML element, use the
attribute className: 	

!
document.getElementsByClassName("niceStyle")[0].className=“badStyle”;
© 2014 Farata Systems
Web Browser’s Events
Browser dispatches events: load, mousemove, click, keydown etc.
!
An event handler (a.k.a. listener) is a function you want to be called as a
response to this event. 	
  
!
//Declaring an event handler in HTML
<button id=“myButton” onclick=“myFunctionHandler(event)”>

Click Me

</button>
	

//Declaring an event handler in JavaScript	

<script>	

window.onload=function(){ … }	

myButton.click=myFunctionHandler; 	

</script>
© 2014 Farata Systems
• Farata Systems:

http://faratasystems.com 

• My Video Lessons “Intro to Java and Java EE”:

http://bit.ly/UFrVHb 

• Blog: 

yakovfain.com

• Twitter:

@yfain
Contacts and Links

More Related Content

What's hot

Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application TestingTroy Miles
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSKnoldus Inc.
 
Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)Yevgeniy Brikman
 
AngularJS Unit Testing
AngularJS Unit TestingAngularJS Unit Testing
AngularJS Unit TestingPrince Norin
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Ran Mizrahi
 
Angularjs - Unit testing introduction
Angularjs - Unit testing introductionAngularjs - Unit testing introduction
Angularjs - Unit testing introductionNir Kaufman
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJSPeter Drinnan
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
 
Dependency Injection @ AngularJS
Dependency Injection @ AngularJSDependency Injection @ AngularJS
Dependency Injection @ AngularJSRan Mizrahi
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Eliran Eliassy
 
Building scalable applications with angular js
Building scalable applications with angular jsBuilding scalable applications with angular js
Building scalable applications with angular jsAndrew Alpert
 
Angular - Improve Runtime performance 2019
Angular - Improve Runtime performance 2019Angular - Improve Runtime performance 2019
Angular - Improve Runtime performance 2019Eliran Eliassy
 
Angular Dependency Injection
Angular Dependency InjectionAngular Dependency Injection
Angular Dependency InjectionNir Kaufman
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java DevelopersYakov Fain
 
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJSDeveloping Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJSShekhar Gulati
 
Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"Fwdays
 
Async patterns in javascript
Async patterns in javascriptAsync patterns in javascript
Async patterns in javascriptRan Wahle
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemAndres Almiray
 
Intro to testing Javascript with jasmine
Intro to testing Javascript with jasmineIntro to testing Javascript with jasmine
Intro to testing Javascript with jasmineTimothy Oxley
 

What's hot (20)

Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application Testing
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
 
Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)
 
AngularJS Unit Testing
AngularJS Unit TestingAngularJS Unit Testing
AngularJS Unit Testing
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
 
Angularjs - Unit testing introduction
Angularjs - Unit testing introductionAngularjs - Unit testing introduction
Angularjs - Unit testing introduction
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJS
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
Dependency Injection @ AngularJS
Dependency Injection @ AngularJSDependency Injection @ AngularJS
Dependency Injection @ AngularJS
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
 
Building scalable applications with angular js
Building scalable applications with angular jsBuilding scalable applications with angular js
Building scalable applications with angular js
 
Angular - Improve Runtime performance 2019
Angular - Improve Runtime performance 2019Angular - Improve Runtime performance 2019
Angular - Improve Runtime performance 2019
 
Angular Dependency Injection
Angular Dependency InjectionAngular Dependency Injection
Angular Dependency Injection
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJSDeveloping Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJS
 
Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"
 
Async patterns in javascript
Async patterns in javascriptAsync patterns in javascript
Async patterns in javascript
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
 
Ngrx meta reducers
Ngrx meta reducersNgrx meta reducers
Ngrx meta reducers
 
Intro to testing Javascript with jasmine
Intro to testing Javascript with jasmineIntro to testing Javascript with jasmine
Intro to testing Javascript with jasmine
 

Viewers also liked

Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to JavascriptKevin Ball
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScriptDan Phiffer
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to JavascriptAnjan Banda
 
NodeJs Intro - JavaScript Zagreb Meetup #1
NodeJs Intro - JavaScript Zagreb Meetup #1NodeJs Intro - JavaScript Zagreb Meetup #1
NodeJs Intro - JavaScript Zagreb Meetup #1Tomislav Capan
 
JavaScript Intro
JavaScript IntroJavaScript Intro
JavaScript IntroEric Brown
 
Cours java smi 2007 2008
Cours java smi 2007 2008Cours java smi 2007 2008
Cours java smi 2007 2008Khalil Lechheb
 
Javascript Intro 01
Javascript Intro 01Javascript Intro 01
Javascript Intro 01vikram singh
 
Integrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowIntegrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowYakov Fain
 
Intro to Javascript and jQuery
Intro to Javascript and jQueryIntro to Javascript and jQuery
Intro to Javascript and jQueryShawn Calvert
 
Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Shekhar Gulati
 
Bonnes pratiques des applications java prêtes pour la production
Bonnes pratiques des applications java prêtes pour la productionBonnes pratiques des applications java prêtes pour la production
Bonnes pratiques des applications java prêtes pour la productionCyrille Le Clerc
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developersYakov Fain
 
AngularJS for Java Developers
AngularJS for Java DevelopersAngularJS for Java Developers
AngularJS for Java DevelopersLoc Nguyen
 

Viewers also liked (20)

Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
JavaScript - Intro
JavaScript - IntroJavaScript - Intro
JavaScript - Intro
 
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
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
NodeJs Intro - JavaScript Zagreb Meetup #1
NodeJs Intro - JavaScript Zagreb Meetup #1NodeJs Intro - JavaScript Zagreb Meetup #1
NodeJs Intro - JavaScript Zagreb Meetup #1
 
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
 
Cours java smi 2007 2008
Cours java smi 2007 2008Cours java smi 2007 2008
Cours java smi 2007 2008
 
Javascript Intro 01
Javascript Intro 01Javascript Intro 01
Javascript Intro 01
 
Integrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowIntegrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business Workflow
 
Intro to Javascript and jQuery
Intro to Javascript and jQueryIntro to Javascript and jQuery
Intro to Javascript and jQuery
 
Introduction àJava
Introduction àJavaIntroduction àJava
Introduction àJava
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud
 
Bonnes pratiques des applications java prêtes pour la production
Bonnes pratiques des applications java prêtes pour la productionBonnes pratiques des applications java prêtes pour la production
Bonnes pratiques des applications java prêtes pour la production
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developers
 
AngularJS for Java Developers
AngularJS for Java DevelopersAngularJS for Java Developers
AngularJS for Java Developers
 

Similar to Intro to JavaScript

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
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
How AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsRan Mizrahi
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...Guillaume Laforge
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationAjax Experience 2009
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorialKat Roque
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineRicardo Silva
 
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)James Titcumb
 
What's new in DWR version 3
What's new in DWR version 3What's new in DWR version 3
What's new in DWR version 3Joe Walker
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to JavascriptAmit Tyagi
 
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)James Titcumb
 
Sencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScriptSencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScriptRohan Chandane
 
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklum Ukraine
 
Apache Wicket Web Framework
Apache Wicket Web FrameworkApache Wicket Web Framework
Apache Wicket Web FrameworkLuther Baker
 
Ajax Fundamentals Web Applications
Ajax Fundamentals Web ApplicationsAjax Fundamentals Web Applications
Ajax Fundamentals Web Applicationsdominion
 

Similar to Intro to JavaScript (20)

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...
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
How AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design Patterns
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
 
[2015/2016] JavaScript
[2015/2016] JavaScript[2015/2016] JavaScript
[2015/2016] JavaScript
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus Presentation
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
 
Ajax Lecture Notes
Ajax Lecture NotesAjax Lecture Notes
Ajax Lecture Notes
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
 
Json generation
Json generationJson generation
Json generation
 
What's new in DWR version 3
What's new in DWR version 3What's new in DWR version 3
What's new in DWR version 3
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
 
Sencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScriptSencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScript
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForce
 
Apache Wicket Web Framework
Apache Wicket Web FrameworkApache Wicket Web Framework
Apache Wicket Web Framework
 
Ajax Fundamentals Web Applications
Ajax Fundamentals Web ApplicationsAjax Fundamentals Web Applications
Ajax Fundamentals Web Applications
 

More from Yakov Fain

Web sockets in Angular
Web sockets in AngularWeb sockets in Angular
Web sockets in AngularYakov Fain
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsYakov Fain
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsYakov Fain
 
Reactive Streams and RxJava2
Reactive Streams and RxJava2Reactive Streams and RxJava2
Reactive Streams and RxJava2Yakov Fain
 
Using JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot appsUsing JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot appsYakov Fain
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java DevelopersYakov Fain
 
Reactive programming in Angular 2
Reactive programming in Angular 2Reactive programming in Angular 2
Reactive programming in Angular 2Yakov Fain
 
Reactive Thinking in Java with RxJava2
Reactive Thinking in Java with RxJava2Reactive Thinking in Java with RxJava2
Reactive Thinking in Java with RxJava2Yakov Fain
 
Reactive Thinking in Java
Reactive Thinking in JavaReactive Thinking in Java
Reactive Thinking in JavaYakov Fain
 
Angular 2 for Java Developers
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java DevelopersYakov Fain
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework Yakov Fain
 
RESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTRESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTYakov Fain
 
Java Intro: Unit1. Hello World
Java Intro: Unit1. Hello WorldJava Intro: Unit1. Hello World
Java Intro: Unit1. Hello WorldYakov Fain
 
Running a Virtual Company
Running a Virtual CompanyRunning a Virtual Company
Running a Virtual CompanyYakov Fain
 
Princeton jug git_github
Princeton jug git_githubPrinceton jug git_github
Princeton jug git_githubYakov Fain
 
Surviving as a Professional Software Developer
Surviving as a Professional Software DeveloperSurviving as a Professional Software Developer
Surviving as a Professional Software DeveloperYakov Fain
 
Becoming a professional software developer
Becoming a professional software developerBecoming a professional software developer
Becoming a professional software developerYakov Fain
 

More from Yakov Fain (17)

Web sockets in Angular
Web sockets in AngularWeb sockets in Angular
Web sockets in Angular
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot apps
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot apps
 
Reactive Streams and RxJava2
Reactive Streams and RxJava2Reactive Streams and RxJava2
Reactive Streams and RxJava2
 
Using JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot appsUsing JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot apps
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java Developers
 
Reactive programming in Angular 2
Reactive programming in Angular 2Reactive programming in Angular 2
Reactive programming in Angular 2
 
Reactive Thinking in Java with RxJava2
Reactive Thinking in Java with RxJava2Reactive Thinking in Java with RxJava2
Reactive Thinking in Java with RxJava2
 
Reactive Thinking in Java
Reactive Thinking in JavaReactive Thinking in Java
Reactive Thinking in Java
 
Angular 2 for Java Developers
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java Developers
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework
 
RESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTRESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoT
 
Java Intro: Unit1. Hello World
Java Intro: Unit1. Hello WorldJava Intro: Unit1. Hello World
Java Intro: Unit1. Hello World
 
Running a Virtual Company
Running a Virtual CompanyRunning a Virtual Company
Running a Virtual Company
 
Princeton jug git_github
Princeton jug git_githubPrinceton jug git_github
Princeton jug git_github
 
Surviving as a Professional Software Developer
Surviving as a Professional Software DeveloperSurviving as a Professional Software Developer
Surviving as a Professional Software Developer
 
Becoming a professional software developer
Becoming a professional software developerBecoming a professional software developer
Becoming a professional software developer
 

Recently uploaded

Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 

Recently uploaded (20)

Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 

Intro to JavaScript

  • 1. © 2014 Farata Systems JavaScript - Not Just a Pretty Face Yakov Fain, Farata Systems
  • 2. © 2014 Farata Systems
  • 3. © 2014 Farata Systems Free bonus chapter on JavaScript:
 https://github.com/oreillymedia/enterprise_web_development
  • 4. © 2014 Farata Systems What’s HTML5? HTML + JavaScript + CSS + 
 AJAX + HTML APIs + 
 Developer’s Tools
  • 5. © 2014 Farata Systems 3 Where to Run JavaScript? • In Your Web browser • In any JavaScript Engine, e.g. Google’s V8 JavaScript, Oracle’s JVM Nashorn, etc.
  • 6. © 2014 Farata Systems JavaScript arrives to the place of execution as text. There’s no compiler helping developers with syntax errors. Users may have different runtime environment. Imagine writing a Java program that must work in any version of JVM. Why JS is more difficult than Java
  • 7. © 2014 Farata Systems Debugging JavaScript • Firefox add-on FireBug • Chrome Developer Tools - our choice • Internet Explorer F12 Developer Tools • Safari Develop • Opera Dragonfly
  • 8. © 2014 Farata Systems IDE Eclipse for Java EE Developers withVJET Plugin 
 WebStorm and IntelliJ IDEA - my choice
 Aptana Studio - Eclipse-based IDE
 NetBeans - Project Easel
 DreamWeaver
 Visual Studio

  • 9. © 2014 Farata Systems Variables Declaring a variable (unless in strict mode) is optional: girlfriendName=“Mary”; Variables declared without the keyword var are global. 
 
 Variables declared with var inside functions are local. function calculateSalary() {
 var address = "123 Main Street"; // local String variable
 age = 25; // global Number variable 
 var married = true; // local boolean variable
 married = "don’t remember"; // now it’s String variable
 }
  • 10. © 2014 Farata Systems Objects and Functions
  • 11. © 2014 Farata Systems Functions. Briefly. You can declare a function that doesn’t belong to any object and invoke it. You can declare a function, assign it to a property of any object and invoke it there. Functions can be objects Functions have memory Java 8 introduced Lambda expressions they are similar to JS functions.
  • 12. © 2014 Farata Systems Declaring and Invoking a Function // Declaring
 /*
 * No var in arguments
 * No data types in arguments
 * No need to declare return type
 * even if a function return a value
 */
 function calcTax(income, dependents) {
 // Do stuff here
 } //Invoking:
 
 calcTax(50000, 2); 
 var myTax = calcTax(50000, 2);
 //Declaring and invoking at the same time:
 
 (function calcTax(income, dependents) {
 // Do stuff here
 })();
  • 13. © 2014 Farata Systems Function Expressions //Assigning a function literal to a variable:
 
 var doTax = function (income, dependents){
 // Do stuff here
 } //Invoking a function:
 
 doTax(50000, 2);

  • 14. © 2014 Farata Systems Creating Objects Create objects with one of these methods: 1. Using object literals
 ! 2. Using new Object() notation
 ! 3. Create an object based on another object:
 obj2=Object.create(obj1);
 ! 4. Using constructor functions and a new operator
  • 15. © 2014 Farata Systems Object Literals An object is an unordered bunch of properties: key/value pairs. var t = {}; // create an instance of an empty object
 
 var a = {someValue: 125}; // an instance with one property
 
 // Store the data about Julia Roberts
 var person = { lastName: "Roberts",
 firstName: "Julia",
 age: 42};
  • 16. © 2014 Farata Systems Object Methods in Literals var person = {
 "last Name": "Roberts",
 firstName: "Julia",
 age: 42,
 makeAppointment: function () {
 alert("Yakov wants to see " + this.firstName);
 }
 };
 
 person.makeAppointment();
  • 17. © 2014 Farata Systems Assigning a Function to Object Property Declaring and assigning: ! myCustomer.doTax = function (income, dependents){! // Do stuff here! } Invoking: ! myCustomer.doTax(50000, 2);!
  • 18. © 2014 Farata Systems Demo • IntelliJ IDE, JavaScript, Chrome Developer Tools
  • 19. © 2014 Farata Systems JavaScript Object Notation (JSON) {
 "fname": "Yakov",
 "lname": "Fain",
 "address": {
 "street": "123 Main St.",
 "city": "New York"
 }
 }
  • 20. © 2014 Farata Systems JavaScript Talks to Java Java should not generate the presentation for Web pages. Java should just send/receive the data to JavaScript Google’s Protobuf data interchange format can be an alternative to JSON (https://code.google.com/p/protobuf/) HTML
 JavaScript
 CSS ! Java JSON
  • 21. © 2014 Farata Systems Google’s Gson (gson.jar) //Parsing JSON String in Java using gson ! public Customer createCustomerFromJson(
 String jsonString){ ! Gson myGson = new Gson(); Customer cust = myGson.fromJson(jsonString,
 Customer.class); return cust; } // Parsing JSON in JavaScript ! var customer= JSON.parse(myJSONString); Prior to Java EE 7 Gson library was the most popular JSON parser in Java.
  • 22. © 2014 Farata Systems Constructor Functions In Java, classes have constructors ! class Tax { Tax(float income, 
 int dependents){ // Do something here } … public static void main(
 String[] args){ // Creating 2 Tax objects Tax t1 = new Tax(50000f, 3); Tax t2 = new Tax(68000f, 1); } } In JavaScript, a function can serve as a constructor
 ! ! function Tax(income, dependents){ // Do something here } … // Creating 2 Tax objects var t1 = new Tax(50000, 3); var t2 = new Tax(68000, 1); Name constructor functions with capital letters.
  • 23. © 2014 Farata Systems Prototypal Inheritance In Java or C# you define a blueprint first: class A, and another blueprint based on the first one: class B extends A. After that you can create instances of A and/or B. In JavaScript, an object can inherit from other object via a property called prototype. Object A Object B ObjectB.prototype=ObjectA;
  • 24. © 2014 Farata Systems Who’s Your Daddy? // Constructor function Person function Person(name, title){ this.name=name; this.title=title; this.subordinates=[]; } // Constructor function Employee ! function Employee(name, title){ this.name=name; this.title=title; } Person and Employee ses”.
  • 25. © 2014 Farata Systems Who’s Your Daddy? // Constructor function Person function Person(name, title){ this.name=name; this.title=title; this.subordinates=[]; } // Constructor function Employee ! function Employee(name, title){ this.name=name; this.title=title; } Person and Employee ses”. Let’s make an Employee a “subclass” of a Person: Employee.prototype = new Person(); var emp = new Employee(“Mary”, “Specialist”); If  a  JS  engine  won’t  find  a  property  in  Employee,  it’ll  keep  looking  in  its   prototype  chain  –  Person  and  Object  . ! Mozilla  has  introduced  a  property  __proto__,  but  it’ll  become  official   only  in  ECMA  6.  
  • 26. © 2014 Farata Systems Methods in Function Objects function Tax(income, dependents){ this.income=income; this.dependents=dependents; ! this.doTaxes=function() { return income*0.05 - dependents*500; } } // Creating Tax objects var t1 = new Tax(50000, 3); ! console.log("Your tax is : " + t1.doTaxes()); doTaxes 
 is a property of object Tax Calling the method doTaxes() Assigning 
 anonymous
 function to a property
  • 27. © 2014 Farata Systems Private Variables in Function Objects function Tax(income, dependents){ this.income=income; this.dependents=dependents; ! var mafiaTaxDeduction= 300; // a private variable of the Tax object ! this.doTaxes=function() { return income*0.05 - dependents*500 – mafiaTaxDeduction; } } // Creating Tax objects var t1 = new Tax(50000, 3); ! console.log("Your tax is : " + t1.doTaxes()); ! console.log("Your mafiaTaxDeduction is : " + t1.mafiaTaxDeduction); // Undefined
  • 28. © 2014 Farata Systems A function can operate in any object by using call() or apply(). Delegation in action Function Object
  • 29. © 2014 Farata Systems Treating Functions as Data //load data json and create new list using jQuery
 $.getJSON(“featured_products.json”, function(data) {
 
 //set current heading
 headingContainer.text(data.heading);
 
 // Erase the previous HTML content and append compiled template
 parentContainer.html('').append(data.items);
 
 }).fail(function (jqXHR, textStatus) {
 //error handling code goes here
 });
 

  • 30. © 2014 Farata Systems Every Function Object Has Methods apply() and call() ! • apply() – Allows calling any function on any object. 
 Parameters are given as an array.
 • call() – Allows calling any function on any object.
 Parameters are given as a comma-separated list. With  apply() and  call() you  to  call  an  arbitrary  function  xyz()as  if  this  function  was declared  as  a  method  on  a  specified  object  (e.g.  myTaxObject): 
 xyz.call(myTaxObject, 50000, 3); ! xyz.apply(myTaxObject, [50000, 3]);  
  • 31. © 2014 Farata Systems Passing a Callback to a Function 1. Declare a function that invokes a given function to process an array function applyHandlersToArray(someArray, someCallBackFunction){ for (var i = 0; i < someArray.length; i++) // Invoke the callback someCallBackFunction.call(this, someArray[i]); ! } } 2. Invoke a function providing an array and a function to be called for every element of the array applyHandlersToArray([1,2,3], function(data){ console.log("Hello from a callback. Processing the value " + data)} );
  • 32. © 2014 Farata Systems Java Anonymous Classes vs. JavaScript Callbacks JavaScript anonymous functions! as callbacks
 ! myButton.addEventListener(“click”, function(){ //Process the button click event } ); Java Swing and inner classes   myButton.addActionListener(
 new ActionListener() { public void
 actionPerformed(ActionEvent e) { // Process the button click event } } );
  • 33. © 2014 Farata Systems Java Anonymous Classes, Lambdas 
 and JavaScript Callbacks JavaScript anonymous functions! as callbacks
 ! myButton.addEventListener(“click”, function(){ //Process the button click event } ); Java Swing and inner classes   myButton.addActionListener(
 new ActionListener() { public void
 actionPerformed(ActionEvent e) { // Process the button click event } } ); Java Swing with Lambda Expressions! ! myButton.addActionListener( evt ->{ // Process the button click event} );
  • 34. © 2014 Farata Systems Closures
  • 35. © 2014 Farata Systems Closure is a function call with strings attached Closure is a function call with memory.
 Larry Ullman Java 8 should support closures (JSR 335). Original image url: http://bit.ly/MYFaXD
  • 36. © 2014 Farata Systems Controlling Exposure with Closures (function () { // this is an anonymous function expression
 
 var taxDeduction = 500; // private context to remember 
 
 //exposed closure
 this.doTaxes = function (income, customerName) {
 
 var yourTax;
 
 if (customerName != "God Father") {
 yourTax = income * 0.05 - taxDeduction;
 } else {
 yourTax = mafiaSpecial(income);
 }
 
 console.log(" Dear " + customerName + ", your tax is " + yourTax);
 return yourTax;
 }
 
 //private function
 function mafiaSpecial(income) {
 return income * 0.05 - taxDeduction * 2;
 }
 
 })(); // Self-invoked function
 
 // calling doTaxes() in the global scope. 
 doTaxes(100000, "John Smith"); // The closure remembers its context: taxDeduction=500
 
 doTaxes(100000, "God Father");
 setTimeout(doTaxes(50000, "Mary Lou"), 2); // Call in 2 seconds 
 mafiaSpecial(); // an error - this function is private doTaxes
 exposed Anonymous function expression creates a scope
  • 37. © 2014 Farata Systems Person.prototype.doTaxes = function () {
 
 var taxDeduction = 500;
 
 //private function
 function mafiaSpecial(income) {
 return income * 0.05 - taxDeduction * 2;
 }
 
 //exposed function is returned as a value to the caller
 return function (income) {
 
 var yourTax;
 
 if (this.name != "God Father") {
 yourTax = income * 0.05 - taxDeduction;
 } else {
 yourTax = mafiaSpecial(income);
 }
 
 console.log(" My dear " + this.name + ", your tax is " + yourTax);
 return yourTax;
 }
 }(); Returning a Closure function Person(name){ this.name = name; } //Using closure var p1=new Person("John Smith"); p1.doTaxes(100000); ! var p2=new Person("God Father"); p2.doTaxes(100000);
  • 38. © 2014 Farata Systems Monitoring Closures in Chrome
  • 39. © 2014 Farata Systems Demo Runing closure in Chrome Developer Tools
  • 40. © 2014 Farata Systems JavaScript in a Web Browser Tipically we place <script> tags at the bottom of HTML page.
  • 41. © 2014 Farata Systems Some Properties of the window Object location - an information about the window’s current location 
 document - a reference to the Document object that provides access to all
 HTML elements in a Web page
 ! opener - a reference to the parent window that opened the current popup window parent - a reference to the parent of a frame or iFrame ! cookie - a reference to all name/value pairs of cookies in the document location=‘’http://yahoo.com”; // redirects your window to Yahoo’s home page ! location.reload(); // reloads the current page var childWindow = open(“xyz.html”); // opens a new browser child 
 
 childWindow.moveTo(200,300); // moves the window to x=200, y=300
 
 childWindow.close(); // closes the window
  • 42. © 2014 Farata Systems Web Browser’s Circle Adding to DOM and laying out Render UI Process Events Run the scripts The content is coming
  • 43. © 2014 Farata Systems Working with DOM ! document.getElementById(id) – get a reference to HTML element by unique identifier ! document.getElementsByTagName(tagname) - get a reference to one or more elements by
 tag name, like a reference to all <div> elements. ! document.getElementsByName(name) - get a reference to all elements that have 
 specified value in their name attribute. ! document.getElementsByClassName(className) – get a reference to all elements to
 use specified CSS class.
  • 44. © 2014 Farata Systems Selectors API document.querySelector(cssSelector) – Find the first element that matches 
 a CSS selector string.
 document.querySelectorAll(cssSelector) – Find all elements by a CSS selector string. ! 
 These methods allows using more complex CSS selector strings than getElementById(id) or getElementsByTagName(tname).
  • 45. © 2014 Farata Systems Selecting an element by ID and changing its value <html>
 <body>
 The employee of the month is <span id="emp">...</span>
 
 <script>
 function setEmployeeOfTheMonth(){ 
 var mySpan = document.getElementById("emp"); 
 
 mySpan.firstChild.nodeValue= “John Smith”; 
 } 
 </script>
 </body>
 </html>
 !
  • 46. © 2014 Farata Systems Using Styles HTML use CSS class selectors, and you can control styles programmatically in JavaScript. ! The styles can be either embedded in your HTML page in using <style> tag or loaded from the external .css file using the <link> tag: ! <head> <link rel=“stylesheet” type=“text/css” href=“mystyles.css”> </head> <body> <div id=“billingInfo” class=“niceStyle”>….</div> </body> .niceStyle{ font-family: Verdana; font-size:large; font-style:italic; color:gray; background-color:green; }
  • 47. © 2014 Farata Systems Changing Styles in JavaScript To find elements that use specified class selectors use getElementsByClassName(), which returns a NodeList of matching elements. ! document.getElementsByClassName("niceStyle"); ! To change the selector on the HTML element, use the attribute className: ! document.getElementsByClassName("niceStyle")[0].className=“badStyle”;
  • 48. © 2014 Farata Systems Web Browser’s Events Browser dispatches events: load, mousemove, click, keydown etc. ! An event handler (a.k.a. listener) is a function you want to be called as a response to this event.   ! //Declaring an event handler in HTML <button id=“myButton” onclick=“myFunctionHandler(event)”>
 Click Me
 </button> //Declaring an event handler in JavaScript <script> window.onload=function(){ … } myButton.click=myFunctionHandler; </script>
  • 49. © 2014 Farata Systems • Farata Systems:
 http://faratasystems.com 
 • My Video Lessons “Intro to Java and Java EE”:
 http://bit.ly/UFrVHb 
 • Blog: 
 yakovfain.com
 • Twitter:
 @yfain Contacts and Links