Forum Discussion

PotterLi-297c87's avatar
PotterLi-297c87
Community Member
2 months ago

Creating a new or cloning a variable using Javascript? (Not referencing)

I'm using javascript to copy the string from a Storyline variable into another Storyline variable. Here is the script but I realise the biggest issue here is that all I'm creating here is referencing the value/string from one variable to another variable. What this means is that when I clear the variable for "A", it will also clear for "B". Was wondering is their a way to do this without referencing? I've tried "Object.assign" but it doesn't seem to work.

var player = GetPlayer();
var A = player.GetVar("Response_var");
var B = A;
player.SetVar("Note1_var", B);

No RepliesBe the first to reply