SlideShare a Scribd company logo
Corso Data Journalist gen-mar 2017
TECNOLOGIE WEB BASE
Oggetti
var BOY= new Object()
var BOY= {}
BOY.AGE=10;
BOY['HEIGHT']=1.20;
BOY.SayHello= function(){console.log('Hello')};
BOY.Say=function(W){console.log(W,W,W)};
var BOY = {
'AGE':12,
'HEIGHT': 1.45,
NAME: 'Jonh',
'SayHello':
function(){console.log('Hello')},
'Say':
function(W){console.log(W,W,W)},
}
Costruzione di un oggetto
tramite notazione letterale
Medesima sintassi di utilizzo attributi e metodi
BOY[‘AGE’] oppure BOY.AGE
BOY[‘SayHello’]() oppure BOY.SayHello()
tramite costruttore Object o {}
Costruzione di un oggetto tramite function
function BOY() {}
BOY.AGE=12;
BOY.HEIGHT= 1.45;
BOY.NAME= ‘Jonh’;
BOY.SayHello= function(){console.log('Hello')};
BOY.Say=function(W){console.log(W,W,W)};
function BOY() {
AGE=12;
HEIGHT= 1.45;
NAME= 'Jonh';
SayHello= function(){console.log('Hello')};
Say=function(W){console.log(W,W,W)};
}
function BOY() {
AGE:12,
HEIGHT: 1.45,
NAME: 'Jonh',
SayHello: function(){console.log('Hello')},
Say:function(W){console.log(W,W,W)},
}
ERRORE
ALTRO
SIGNIFICATO
La parola chiave this
nella notazione letterale
var BOY= new Object()
var BOY= {}
BOY.AGE=10;
BOY.HEIGHT=1.20;
BOY.SayHello= function(){console.log(this.AGE)};
BOY.Say=function(W){console.log(W,W,W)};
nel costruttore Object / {}
BOY = {
'AGE':12,
'HEIGHT': 1.45,
‘SayHello': function(){console.log(this.AGE)},
‘Say':function(W){cvaronsole.log(W,W,W)},
}
in un oggetto costruito tramite function (crea un prototipo di oggetto)
function BOY() {
this.AGE=12;
this.HEIGHT= 1.45;
}
prototipo di oggetti
var MF = new Person("John", "Doe", 50, "blue");
var MM = new Person("Sally","Rally", 48, "green");
function Person(first, last, age, eye) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eye; }
Costruzione Utilizzo
Risultato
MF { firstName: 'John', lastName: 'Doe', age: 50, eyeColor: 'blue' }
MM { firstName: 'Sally', lastName: 'Rally', age: 48, eyeColor: 'green' }
sintassi a catena
function Boy(NAME, SURNAME, GENDER, AGE) {
this.name = NAME;
this.surname = SURNAME;
this.gender = GENDER;
this.age = AGE;
this.setName = function(x) {this.name = x; return this;};
this.setSurname = function(x) {this.surname = x; return this;};
this.setAge = function(x) {this.age= x; return this;};
this.setGender = function(x) {this.gender = x; return this;}; }
funzione Boy
attributi
metodi
oggetti MYSON1
MYSON2
var MYSON1=new Boy('John','Smith','male',11);
var MYSON2=MYSON1;
MYSON2.setName('Paul')
.setAge(8) ;
Oggetti Javascript e python
Javascript Python
class UNO():
def __init__(self,X,Y):
self.X=X
self.Y=Y
def Show(self):
print('Questa è la variabile X: ',self.X)
print('Questa è la variabile Y: ',self.Y)
A=UNO(10,20)
A.Show()
Questa è la variabile X: 10
Questa è la variabile Y: 20
function UNO(X,Y) {
this.X=X;
this.Y=Y;
this.Show=function(){
console.log('Questa è la variabile X: ',this.X);
console.log('Questa è la variabile Y: ',this.Y); }
}
var A =new UNO(10,20);
A.Show()
Questa è la variabile X: 10
Questa è la variabile Y: 20
LEZIONE 1..
www.fordatascientist.org
D00-Web-JsBase
D14-Nodejs-Object.ipynb
CONTATTI TELEFONO
051 22 35 20
EMAIL
WORKSHOP@VICEM.IT

More Related Content

Viewers also liked

Web advanced-11-d3 js
Web advanced-11-d3 jsWeb advanced-11-d3 js
Web advanced-11-d3 js
Studiabo
 
Python advanced 06-matplotlib
Python advanced 06-matplotlibPython advanced 06-matplotlib
Python advanced 06-matplotlib
Studiabo
 
Web advanced-01-asincrono
Web advanced-01-asincronoWeb advanced-01-asincrono
Web advanced-01-asincrono
Studiabo
 
Python advanced 01-numpypandas
Python advanced 01-numpypandasPython advanced 01-numpypandas
Python advanced 01-numpypandas
Studiabo
 
Web base-01-html
Web base-01-htmlWeb base-01-html
Web base-01-html
Studiabo
 
Python advanced 02-dataframe
Python advanced 02-dataframePython advanced 02-dataframe
Python advanced 02-dataframe
Studiabo
 
Python advanced 20-classioggetti-sintesi
Python advanced 20-classioggetti-sintesiPython advanced 20-classioggetti-sintesi
Python advanced 20-classioggetti-sintesi
Studiabo
 
Python base 01-numeristringhe
Python base 01-numeristringhePython base 01-numeristringhe
Python base 01-numeristringhe
Studiabo
 
Web advanced-10-svg
Web advanced-10-svgWeb advanced-10-svg
Web advanced-10-svg
Studiabo
 
Why use slideshare
Why use slideshareWhy use slideshare
Why use slideshare
Say Digital Media
 
How to Use Slideshare
How to Use SlideshareHow to Use Slideshare
How to Use Slideshare
Converting Copy
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great Infographics
SlideShare
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShare
Kapost
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
Empowered Presentations
 
You Suck At PowerPoint!
You Suck At PowerPoint!You Suck At PowerPoint!
You Suck At PowerPoint!
Jesse Desjardins - @jessedee
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization
Oneupweb
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
Content Marketing Institute
 
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...SlideShare
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
SlideShare
 

Viewers also liked (20)

Web advanced-11-d3 js
Web advanced-11-d3 jsWeb advanced-11-d3 js
Web advanced-11-d3 js
 
Python advanced 06-matplotlib
Python advanced 06-matplotlibPython advanced 06-matplotlib
Python advanced 06-matplotlib
 
Web advanced-01-asincrono
Web advanced-01-asincronoWeb advanced-01-asincrono
Web advanced-01-asincrono
 
Python advanced 01-numpypandas
Python advanced 01-numpypandasPython advanced 01-numpypandas
Python advanced 01-numpypandas
 
Web base-01-html
Web base-01-htmlWeb base-01-html
Web base-01-html
 
Python advanced 02-dataframe
Python advanced 02-dataframePython advanced 02-dataframe
Python advanced 02-dataframe
 
Python advanced 20-classioggetti-sintesi
Python advanced 20-classioggetti-sintesiPython advanced 20-classioggetti-sintesi
Python advanced 20-classioggetti-sintesi
 
Python base 01-numeristringhe
Python base 01-numeristringhePython base 01-numeristringhe
Python base 01-numeristringhe
 
Web advanced-10-svg
Web advanced-10-svgWeb advanced-10-svg
Web advanced-10-svg
 
Why use slideshare
Why use slideshareWhy use slideshare
Why use slideshare
 
How to Use Slideshare
How to Use SlideshareHow to Use Slideshare
How to Use Slideshare
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great Infographics
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShare
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
 
You Suck At PowerPoint!
You Suck At PowerPoint!You Suck At PowerPoint!
You Suck At PowerPoint!
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
 
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
 

More from Studiabo

Big data rischi
Big data rischiBig data rischi
Big data rischi
Studiabo
 
Big data correlazioni
Big data correlazioniBig data correlazioni
Big data correlazioni
Studiabo
 
Ravenna2019 - lezione Big Data
Ravenna2019 - lezione Big DataRavenna2019 - lezione Big Data
Ravenna2019 - lezione Big Data
Studiabo
 
Strutture dati 08-reshape
Strutture dati 08-reshapeStrutture dati 08-reshape
Strutture dati 08-reshape
Studiabo
 
Strutture dati 07-multiindex
Strutture dati 07-multiindexStrutture dati 07-multiindex
Strutture dati 07-multiindex
Studiabo
 
Strutture dati 06-dataframe
Strutture dati 06-dataframeStrutture dati 06-dataframe
Strutture dati 06-dataframe
Studiabo
 
Strutture dati 05-numpypandas
Strutture dati 05-numpypandasStrutture dati 05-numpypandas
Strutture dati 05-numpypandas
Studiabo
 
Strutture dati 04-funzionicustom-classioggetti
Strutture dati 04-funzionicustom-classioggettiStrutture dati 04-funzionicustom-classioggetti
Strutture dati 04-funzionicustom-classioggetti
Studiabo
 
Strutture dati 03-stutturedatibuiltin
Strutture dati 03-stutturedatibuiltinStrutture dati 03-stutturedatibuiltin
Strutture dati 03-stutturedatibuiltin
Studiabo
 
Strutture dati 02-strutturecontrollo-funzionibuiltin
Strutture dati 02-strutturecontrollo-funzionibuiltinStrutture dati 02-strutturecontrollo-funzionibuiltin
Strutture dati 02-strutturecontrollo-funzionibuiltin
Studiabo
 
Strutture dati 01-numeristringhe
Strutture dati 01-numeristringheStrutture dati 01-numeristringhe
Strutture dati 01-numeristringhe
Studiabo
 
Strutture dati 00-corso2018-2019
Strutture dati 00-corso2018-2019Strutture dati 00-corso2018-2019
Strutture dati 00-corso2018-2019
Studiabo
 
Pres ulisse acciaio-ottobre2018
Pres ulisse acciaio-ottobre2018Pres ulisse acciaio-ottobre2018
Pres ulisse acciaio-ottobre2018
Studiabo
 
Strutture dati 08-reshape
Strutture dati 08-reshapeStrutture dati 08-reshape
Strutture dati 08-reshape
Studiabo
 
Pres ulisse acciaio-aprile2018
Pres ulisse acciaio-aprile2018Pres ulisse acciaio-aprile2018
Pres ulisse acciaio-aprile2018
Studiabo
 
Strutture dati 02-strutturecontrollo-funzionibuiltin
Strutture dati 02-strutturecontrollo-funzionibuiltinStrutture dati 02-strutturecontrollo-funzionibuiltin
Strutture dati 02-strutturecontrollo-funzionibuiltin
Studiabo
 
Strutture dati 07-multiindex
Strutture dati 07-multiindexStrutture dati 07-multiindex
Strutture dati 07-multiindex
Studiabo
 
Strutture dati 05-numpypandas
Strutture dati 05-numpypandasStrutture dati 05-numpypandas
Strutture dati 05-numpypandas
Studiabo
 
Strutture dati 06-dataframe
Strutture dati 06-dataframeStrutture dati 06-dataframe
Strutture dati 06-dataframe
Studiabo
 
Strutture dati 04-funzionicustom-classioggetti
Strutture dati 04-funzionicustom-classioggettiStrutture dati 04-funzionicustom-classioggetti
Strutture dati 04-funzionicustom-classioggetti
Studiabo
 

More from Studiabo (20)

Big data rischi
Big data rischiBig data rischi
Big data rischi
 
Big data correlazioni
Big data correlazioniBig data correlazioni
Big data correlazioni
 
Ravenna2019 - lezione Big Data
Ravenna2019 - lezione Big DataRavenna2019 - lezione Big Data
Ravenna2019 - lezione Big Data
 
Strutture dati 08-reshape
Strutture dati 08-reshapeStrutture dati 08-reshape
Strutture dati 08-reshape
 
Strutture dati 07-multiindex
Strutture dati 07-multiindexStrutture dati 07-multiindex
Strutture dati 07-multiindex
 
Strutture dati 06-dataframe
Strutture dati 06-dataframeStrutture dati 06-dataframe
Strutture dati 06-dataframe
 
Strutture dati 05-numpypandas
Strutture dati 05-numpypandasStrutture dati 05-numpypandas
Strutture dati 05-numpypandas
 
Strutture dati 04-funzionicustom-classioggetti
Strutture dati 04-funzionicustom-classioggettiStrutture dati 04-funzionicustom-classioggetti
Strutture dati 04-funzionicustom-classioggetti
 
Strutture dati 03-stutturedatibuiltin
Strutture dati 03-stutturedatibuiltinStrutture dati 03-stutturedatibuiltin
Strutture dati 03-stutturedatibuiltin
 
Strutture dati 02-strutturecontrollo-funzionibuiltin
Strutture dati 02-strutturecontrollo-funzionibuiltinStrutture dati 02-strutturecontrollo-funzionibuiltin
Strutture dati 02-strutturecontrollo-funzionibuiltin
 
Strutture dati 01-numeristringhe
Strutture dati 01-numeristringheStrutture dati 01-numeristringhe
Strutture dati 01-numeristringhe
 
Strutture dati 00-corso2018-2019
Strutture dati 00-corso2018-2019Strutture dati 00-corso2018-2019
Strutture dati 00-corso2018-2019
 
Pres ulisse acciaio-ottobre2018
Pres ulisse acciaio-ottobre2018Pres ulisse acciaio-ottobre2018
Pres ulisse acciaio-ottobre2018
 
Strutture dati 08-reshape
Strutture dati 08-reshapeStrutture dati 08-reshape
Strutture dati 08-reshape
 
Pres ulisse acciaio-aprile2018
Pres ulisse acciaio-aprile2018Pres ulisse acciaio-aprile2018
Pres ulisse acciaio-aprile2018
 
Strutture dati 02-strutturecontrollo-funzionibuiltin
Strutture dati 02-strutturecontrollo-funzionibuiltinStrutture dati 02-strutturecontrollo-funzionibuiltin
Strutture dati 02-strutturecontrollo-funzionibuiltin
 
Strutture dati 07-multiindex
Strutture dati 07-multiindexStrutture dati 07-multiindex
Strutture dati 07-multiindex
 
Strutture dati 05-numpypandas
Strutture dati 05-numpypandasStrutture dati 05-numpypandas
Strutture dati 05-numpypandas
 
Strutture dati 06-dataframe
Strutture dati 06-dataframeStrutture dati 06-dataframe
Strutture dati 06-dataframe
 
Strutture dati 04-funzionicustom-classioggetti
Strutture dati 04-funzionicustom-classioggettiStrutture dati 04-funzionicustom-classioggetti
Strutture dati 04-funzionicustom-classioggetti
 

Web base-05-js-object

  • 1. Corso Data Journalist gen-mar 2017 TECNOLOGIE WEB BASE Oggetti
  • 2. var BOY= new Object() var BOY= {} BOY.AGE=10; BOY['HEIGHT']=1.20; BOY.SayHello= function(){console.log('Hello')}; BOY.Say=function(W){console.log(W,W,W)}; var BOY = { 'AGE':12, 'HEIGHT': 1.45, NAME: 'Jonh', 'SayHello': function(){console.log('Hello')}, 'Say': function(W){console.log(W,W,W)}, } Costruzione di un oggetto tramite notazione letterale Medesima sintassi di utilizzo attributi e metodi BOY[‘AGE’] oppure BOY.AGE BOY[‘SayHello’]() oppure BOY.SayHello() tramite costruttore Object o {}
  • 3. Costruzione di un oggetto tramite function function BOY() {} BOY.AGE=12; BOY.HEIGHT= 1.45; BOY.NAME= ‘Jonh’; BOY.SayHello= function(){console.log('Hello')}; BOY.Say=function(W){console.log(W,W,W)}; function BOY() { AGE=12; HEIGHT= 1.45; NAME= 'Jonh'; SayHello= function(){console.log('Hello')}; Say=function(W){console.log(W,W,W)}; } function BOY() { AGE:12, HEIGHT: 1.45, NAME: 'Jonh', SayHello: function(){console.log('Hello')}, Say:function(W){console.log(W,W,W)}, } ERRORE ALTRO SIGNIFICATO
  • 4. La parola chiave this nella notazione letterale var BOY= new Object() var BOY= {} BOY.AGE=10; BOY.HEIGHT=1.20; BOY.SayHello= function(){console.log(this.AGE)}; BOY.Say=function(W){console.log(W,W,W)}; nel costruttore Object / {} BOY = { 'AGE':12, 'HEIGHT': 1.45, ‘SayHello': function(){console.log(this.AGE)}, ‘Say':function(W){cvaronsole.log(W,W,W)}, } in un oggetto costruito tramite function (crea un prototipo di oggetto) function BOY() { this.AGE=12; this.HEIGHT= 1.45; }
  • 5. prototipo di oggetti var MF = new Person("John", "Doe", 50, "blue"); var MM = new Person("Sally","Rally", 48, "green"); function Person(first, last, age, eye) { this.firstName = first; this.lastName = last; this.age = age; this.eyeColor = eye; } Costruzione Utilizzo Risultato MF { firstName: 'John', lastName: 'Doe', age: 50, eyeColor: 'blue' } MM { firstName: 'Sally', lastName: 'Rally', age: 48, eyeColor: 'green' }
  • 6. sintassi a catena function Boy(NAME, SURNAME, GENDER, AGE) { this.name = NAME; this.surname = SURNAME; this.gender = GENDER; this.age = AGE; this.setName = function(x) {this.name = x; return this;}; this.setSurname = function(x) {this.surname = x; return this;}; this.setAge = function(x) {this.age= x; return this;}; this.setGender = function(x) {this.gender = x; return this;}; } funzione Boy attributi metodi oggetti MYSON1 MYSON2 var MYSON1=new Boy('John','Smith','male',11); var MYSON2=MYSON1; MYSON2.setName('Paul') .setAge(8) ;
  • 7. Oggetti Javascript e python Javascript Python class UNO(): def __init__(self,X,Y): self.X=X self.Y=Y def Show(self): print('Questa è la variabile X: ',self.X) print('Questa è la variabile Y: ',self.Y) A=UNO(10,20) A.Show() Questa è la variabile X: 10 Questa è la variabile Y: 20 function UNO(X,Y) { this.X=X; this.Y=Y; this.Show=function(){ console.log('Questa è la variabile X: ',this.X); console.log('Questa è la variabile Y: ',this.Y); } } var A =new UNO(10,20); A.Show() Questa è la variabile X: 10 Questa è la variabile Y: 20
  • 9. CONTATTI TELEFONO 051 22 35 20 EMAIL WORKSHOP@VICEM.IT