javascript - difference between jquery styles -
which style fastest? when use 1 on other?
type 1:
function makemap(){ getlatlong(); draw(); } function getlatlong(){ ... } function draw(){ ... } makemap();
type 2:
var map = { init: function(){ ... } getlatlong: function(){ ... } draw: function(){ ... } } $test = map.init()
the better style 1 best fits solution.
in general, time '.' used reference property, performance hit; however, may small may not matter.
as speed, let's test it:
http://jsperf.com/compare-object-function-properties-vs-functions
in both chrome , ie, direct function call faster object property reference function call.