How to create a pure javascript variable and access to its data using only javascript?

I know we can create variables inside Storyline and store their data throughout the course, but I noted that whenever I create a variable in javascript and execute it at the start of the timeline, I couldn't access it(the variable) on the end of the same slide on javascript execution?

Is there any way to create a pure javascript variable and access to its data using only javascript? 

For example, I want something like this :

At timeline start I execute a javascript code:

var javascriptVar = 360;

and at the end of that slide or another slide I execute another javascript code to bring javascriptVar value back to Storyline :

var player = GetPlayer();
player.SetVar("storylineVar",javascriptVar);

Thank you for your kind assistance...

2 Replies