I'm new at javascript and here is a newbie question:
In php, there is an extract() method which can import variables from an associative array. For example:
$var_array = array("color" => "blue",
"size" => "medium",
"shape" => "sphere");
extract($var_array);
// $color is a defined varible here with the value of "blue"
I wonder if there is a method in standard Javascript, or in popular libraries like jQuery or underscore, that does the same for a Javascript Object. I mean something like this:
jsObject = {"color" : "blue",
"size" : "medium",
"shape" : "sphere"};
extract(jsObject); // Is there such a thing?
// Here, color is a defined variable
windowobject (global scope):jsObject.forEach(function(value, key){ window[key] = value; });