What is this syntax in Babel compiled code?

I read the ES2015 primer on this site , and this example was given for the names of the calculated properties :

const namespace = '-webkit-'; 
const style = { 
  [namespace + 'box-sizing'] : 'border-box', 
  [namespace + 'box-shadow'] : '10px10px5px #888888' 
}; 

It's pretty straightforward, but I don't understand what Babel is doing to block him. He gives the following:

var _style;
var namespace = '-webkit-';
var style = (
  _style = {},
  _style[namespace + 'box-sizing'] = 'border-box',
  _style[namespace + 'box-shadow'] = '10px 10px 5px #888888',
  _style
);

(I reformatted the indentation)

Online Babel Transpilation is here

I canโ€™t find the documentation about what the syntax is: declaring an object _style, then listing in paranthesis the names of the properties and their values, and then just ends on , _styleuntil the end of the parthenthesis.

+4
source share
1 answer

JavaScript - - . ,

console.log(
    (console.log(1), console.log(2), 3)
);
Hide result

1, 2 3 . 3 console.log.


,

var style = (
  _style = {},
  _style[namespace + 'box-sizing'] = 'border-box',
  _style[namespace + 'box-shadow'] = '10px 10px 5px #888888',
  _style
);

  _style = {},

_style,

  _style[namespace + 'box-sizing'] = 'border-box',

namespace + 'box-sizing' ,

  _style[namespace + 'box-shadow'] = '10px 10px 5px #888888',

, , , _style .

style.

+6

Source: https://habr.com/ru/post/1665194/


All Articles