-2

I just want to have a function VK.Share.Count(param1,param2) and property VK.Share.WorkUrl.

VK.Share.WorkUrl must be available from VK.Share.Count function. What is best way to do it? Can i just write:

VK.Share.Count = function(a,b) {
 //blablablablablalbalblablal
 VK.Share.WorkUrl = "sdfgfgadf";
}
VK.Share.WorkUrl = "lalalala";
Andrew Marshall
97.3k20 gold badges228 silver badges217 bronze badges
asked Mar 10, 2011 at 17:22

2 Answers 2

2
var vk={
 share:{ 
 count:function(){},
 WorkUrl:"lalala"
 }
};

or

var vk={}
vk.share={};
vk.share.count=function(){
}
vk.share.WorkUrl="lalal";
answered Mar 10, 2011 at 17:25
Sign up to request clarification or add additional context in comments.

Comments

0

You example will work and this will also work, if you are always calling the Count function like this VK.Share.Count();

VK.Share.Count = function(a,b) { this.WorkUrl = "foobar"; }
VK.Share.WorkUrl = "123";
answered Mar 10, 2011 at 17:29

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.