1

I have:

String.prototype.callcm = function(something[]){
alert(something);
};

"something".callcm({a:50,b:60});

how can the arguments with there variable name get in the something array.

1
  • As a side note, it's a good idea to use console.log() instead of alert(), as it will allow you to interact with the object in your developer tools console. This might be useful as you troubleshoot. Commented Jan 24, 2012 at 20:28

1 Answer 1

1

I think you are asking for a way to pass the values {a:50,b:60} to the function.. then you just need to fix the syntax.

Change function(something[])

to function(something)

jsFiddle here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.