I have a single object that returns the following:
{left: "642px", top: "305px", opacity: "1"}
I am trying to break these out into three separate variables: var left, var top, and var opacity
What is the simplest way to go about this?
I have a single object that returns the following:
{left: "642px", top: "305px", opacity: "1"}
I am trying to break these out into three separate variables: var left, var top, and var opacity
What is the simplest way to go about this?
Use:
var data = {left: "642px", top: "305px", opacity: "1"};
var left = data.left,
top = data.top,
opacity = data.opacity;
var left = object.left, top = object.top, opacity = object.opacity;
JavaScript doesn't have (currently) any fancy decomposing assignments like some other languages do.