javascript - Chrome is unable to do array destructuring -


i have following function:

function evaluatescroll(positions, width){     var scale = width / (width - math.abs(positions[0]) - math.abs(positions[1]));     var startlocation = positions[0] / width;      return [scale, startlocation]; } 

and use in following way:

[tscale, tstartlocation] = evaluatescroll(scrollpositions, scrollplotwidth); 

in safari , firefox, works expected work. in chrome, however, code hangs-up @ line.

changing to:

var holder = evaluatescroll(scrollpositions, scrollplotwidth); 

works, have parse out indexes of holder appropriate variables.

how come chrome won't work array-style assignment? there syntax can implement work across browsers, without having holder variable , reassigning appropriate ones?

it appears chrome 48 (current stable) not support destructuring assignment syntax yet: https://kangax.github.io/compat-table/es6/#destructuring

looks it's in 49+ though!


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -