Names for different Javascript Object Notation -


is there name describing different ways can define object in javascript?

there method more 'class-like' :

function myobject() {      this.amethod= new function(){     };      this.anothermethod = new function(){     }; } 

and other technique more 'dynamic'.

myobject = new object(); myobject.amethod= new function(){ }; myobject.anothermethod = new function(){ }; 

i have been using both of these techniques in various ways, , understand benefits of each, life of me, don't have idea how call these 2 techniques when discussing colleauges.

do these techniques have names?

in first case myobject constructor function, since supposed called new:

var obj = new myobject(); 

in second case, myobject object , assign properties it. not have special name.

note in both cases myobject has different values. myobject in second case equivalent obj.

a third way use object initilizer or "object literal":

var obj = {     amethod: function(){},     anothermethod: function(){} }; 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -