I have a JS file where I am getting .phtml variable dates like:

initialize: function (config)
    dates = config.dates;

test: function(){
    //get variable dates

another: function(){
    //get variable dates

How to access dates without passing in function i.e make dates available to all function

  • Declare var dates outside of the initialize method ? And then you can access it the same way you access the methods with this.dates ?
    – Claims
    Oct 13 at 10:01
  • If I declare outside, How to access variable ? i.e config.dates
    – Pawan
    Oct 13 at 10:38
  • It's just a scope variable visibility issue : See for the js example there : w3schools.com/js/tryit.asp?filename=tryjs_scope_global
    – Claims
    Oct 13 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.