Différences entre les techniques de création d'objet
Bonjour,
J'aimerais savoir si il y a une différence entre ces 3 techniques de création d'objet :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| var unObj = function() {
this.prop1 = valeur1;
this.prop2 = valeur2;
this.method1 = function() { ... }
}
var useObj = new unObj();
-----
var unObj = {
prop1 : valeur1,
propr2 : valeur2.
method1 : function() { ... }
}
-----
var unObj = new Object();
unObj.prop1 = valeur1;
unObj.prop2 = valeur2;
unObj.method1 = function() { ... }; |
Merci.