I have the following code:
var oTable = $('#dataTable').dataTable({
...
I would like to declare oTable as a global but I am a bit confused. With javascript how do I do this and do I have to specify the object type when I declare it as a global?
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.
Put simply, you don’t. You just declare the variable as you did, and use it wherever you need.
When you’ll want to use a global variable in a function, you can simply type its name, without declaring it first.
Example