javascript - What is the different between calling a function like this CH.home.init({}) or CH.home.init()? -


i know if there different between calling function this

ch.home.init({}) 

or calling normal function?

ch.home.init() 

here's context it's in:

var ch = ch || {};   ch.core = function () {         ch.home.init({});     }, ... ch.home = function () {     function init(a) {        $.extend(k, a)          ...                  var k = {                         adatas: null,                         loaderid: "home",                         transitionease: "cubic-bezier(0.18, 0.11, 0.3, 1)",                         timer: null,                         nbrandom: 1,                         ratioimg: .625,                         opacityoff: .35,                         speedopacity: 400,                         delayhome: 2500,                         indexbkg: 0,                         $logo: $("h1"),                         $nav: $("nav"),                         $lineh: $("span.lineh"),                         $linev: $("span.linev"),                         imgs: [{                             src: "chny.jpg",                             align: "top"                         }, {                             src: "ch.jpg",                             align: "top"                         }, {                             src: "212.jpg",                             align: "top"                         }, {                             src: "house.jpg",                             align: "middle"                         }]                     }; 

obviously, argument different. in init({}) you're passing empty object literal, while in init() you're passing nothing. whether makes difference in outcome depends on init function does, unfortunately have not shown us.

it not seem make difference in init function, parameter used extend k object. if nothing passed, a undefined, , $.extend nothing k - as when extending no keys.


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -