Not really sure what you are after. But I think you need to make an new instance of test first:
var test = function (defaults){ this.defaults = defaults || this.defaults; alert(this.defaults.test); } test.prototype = { defaults : { test : 'nothing' } }; new test(); new test({test: 'hello world'}); On Jun 24, 8:07 am, Nic Hubbard <nnhubb...@gmail.com> wrote: > I have used an object in the past as a function argument, but this was > for a plugin that I wrote. Using it in the architecture of a plugin > it worked. > > BUT, this time, I just want to write a normal function, but still use > an object to set defaults and pass in changes to those defaults > through as a param. Is this possible, or do I have to make this a > jQuery function like $.myfunction() ? > > I am trying: > > function test(defaults) > { > var defaults = { > test: '' > }; > > alert(defaults.test); > > } > > test({test: 'It works!'}); > > The above does not seem to work, and replace the default with that was > passed in the function. What am I doing wrong here?