When using React Native, you're going to be running your JavaScript code in two environments:
While both environments are very similar, you may end up hitting some inconsistencies. We're likely going to experiment with other JS engines in the future, so it's best to avoid relying on specifics of any runtime.
React Native ships with many JavaScript transforms to make writing code more enjoyable. If you are curious, you can see the implementation of all those transformations. Here's the full list:
ES5
promise.catch(function() { });ES6
<C onPress={() => this.setState({pressed: true})}Math.max(...array);class C extends React.Component { render() { return <View />; } }var {isActive, style} = this.props;for (var element of array) { }var key = 'abc'; var obj = {[key]: 10};var obj = { method() { return 10; } };var name = 'vjeux'; var obj = { name };function(type, ...args) { }var who = 'world'; var str = `Hello ${who}`;ES7
var extended = { ...obj, a: 10 };function f(a, b, c,) { }