I am wondering how I can define a global variable in javascript. That's what I am doing and I want currentValue to be global so everytime gotoNext and previous function can change its value
onPageClick : function(event) { var currentValue = event.target.innerHTML; if (currentValue == "Next") this.gotoNext(); if (currentValue == "previous") this.gotoPrev(); }, gotoNext : function() { this.currentValue +1; }, gotoPrevious : function() { this.currentValue -1; }, but currentValue is not defined in goToNext and gotoPrevious!