JavaScript What does … mean in {a, b, …others} = myObject? [duplicate] what does mean,what does mean in math,what does

I haven't seen this syntax before and am wondering what it's all about.

var { Navigation } = require('react-router');

The brackets on the left are throwing a syntax error:

unexpected token {

I'm not sure what part of the webpack config is transforming or what the purpose of the syntax is. Is it a Harmony thing? Can someone enlighten me?

Answer:1

This is destructuring assignment. It's a new feature of ECMAScript 2015.

var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
} = React;

Is the equivalent to:

var AppRegistry = React.AppRegistry;
var StyleSheet = React.StyleSheet;
var Text = React.Text;
var View = React.View;
Answer:2
var { Navigation } = require('react-router');

... uses destructuring to achieve the same thing as ...

var Navigation = require('react-router').Navigation;

... but is far more readable.

Answer:3

Every time i try to use console.log i get this kind of error. ERROR: Unexpected console statement. [no-console] console.log(name + ' is a ' + age + ' years old ' + job + ' who is married ' + ...

Every time i try to use console.log i get this kind of error. ERROR: Unexpected console statement. [no-console] console.log(name + ' is a ' + age + ' years old ' + job + ' who is married ' + ...

  1. console.log error in brackets
  2. brackets console error

If my web server is configured to allow cross-origin requests in his crossdomain.xml, and also to deny them via CORS (Access-Control-Allow-Origin: site111.org), which configuration will be respected ...

If my web server is configured to allow cross-origin requests in his crossdomain.xml, and also to deny them via CORS (Access-Control-Allow-Origin: site111.org), which configuration will be respected ...

I'm trying to build a sample extension that can field incoming messages from a serial device connected to the computer and have that affect an on screen UI element. For example. Lets say the ...

I'm trying to build a sample extension that can field incoming messages from a serial device connected to the computer and have that affect an on screen UI element. For example. Lets say the ...

  1. getting my head wrapped around

Hi I try to receive a value from span from table like this: function getValueFromSibling(this) { var id = $(this).parent().siblings('span.childSibbling'); } Table looks like this: <tr> ...

Hi I try to receive a value from span from table like this: function getValueFromSibling(this) { var id = $(this).parent().siblings('span.childSibbling'); } Table looks like this: <tr> ...

  1. return value from init python
  2. python value from __init__
  3. value in javascript
  4. value_init
  5. value_init boost
  6. cannot return value from init
  7. g_value_init_from_instance