Caspert Caspert -5 years ago 90
Javascript Question

How to use two types of parameters within a function?

I call the following function to create a new css object:

dot, {
x: mX,
y: mY,
force3D: !0

set: function(el) {

var dot = $(el).css('-webkit-transform', 'translate3d(' + x + ', ' + y + ', ' + z + ')');
return dot;

Now I was wondering how to get the first parameter of the function set, to be more precise: dot.
I already tried: alert(el); but this will give me an alert with [object Object].
I know you can access the object options by using
, but how to access the first parameter I doesn't know.

Can someone help me out. Thanks a lot!

Answer Source

Is this what you're trying to do?

set = function(el) {
    console.log(el.x); // You can access the properties like this
    return dot;

// Build the params
var dot = {
    x: 'asdf',
    y: 'asdf',
    force3D: !0

// Call the set() method

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download