in a case i have a little “framework” for the public , how can i make my own “workspace”? so i can use what ever variable name i want?
how can i make it done?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use an anonymous function wrapper. Any variables which are defined using
varwill not be available for the code outside the wrapper. Whenever you want to define a method or property, add them to thetobepublicobject (which is returned at the end).Publicly, the above code looks like the code below. The methods above, however can also have access to private methods/variables, which cannot be seen “from the outside”: