This is one of those questions that I don’t know how to fold, so I apologize if it was asked earlier.
Python provides some very simple instructions for quickly assigning arrays to values. For example, if I have a field in the form of an array of like box=[0,0,100,100], I can assign these points, for example x1,y1,x2,y2=box. Is there such an expression in javascript? This would be especially useful in class functions, where var x1,y1,x2,y2=this.boxit would be much less verbose than
var x1=this.box[0];
var y1=this.box[1];
var x2=this.box[2];
var y2=this.box[3];
If so, are there any javascript methods that apply this for loops? Coming from python, below just seems so intuitive
boxes = [[0,0,100,100], [0,0,100,100], [0,0,100,100], [0,0,100,100]]
for box in boxes:
x1,x2,x3,x4 = box
definitely more intuitive than
var boxes=[[0,0,100,100],[0,0,100,100],[0,0,100,100],[0,0,100,100]];
for (var i = 0; i < boxes.length : i++){
var box = boxes[i];
var x1 = box[0];
var y1 = box[1];
var x2 = box[2];
var y2 = box[3];