You redeclare gsd as a new variable inside your function. Remove var in front of gsd inside the function to address the gsd in the outer scope.
You redeclare gsd as a new variable inside your function. Remove var in front of gsd inside the function to address the gsd in the outer scope.