es6console icon indicating copy to clipboard operation
es6console copied to clipboard

Support plain ES6 without transpile

Open suntong opened this issue 7 years ago • 2 comments

The current option of COMPILER are:

  • babel (6)
  • babel (5)
  • traceur
  • typescript
  • regenerator
  • prepack

Please provide an option of no transpile (or JavaScript) so that people can try out plain ES6 as-is without transpile. Thx.

suntong avatar Feb 18 '18 21:02 suntong

I'm new to JavaScript/ES6, so I need to know the exact behavior of JavaScript/ES6, not babel -- the following code behaves differently when run directly under JavaScript/ES6, or after babel transpile:

var obj1 = {a: 1, b: 2}; 
var obj3 = Object.assign({},obj1, obj2);
var obj2 = {a: 4, c: 110}; 
console.log(obj3);
obj3 = Object.assign({},obj1, obj2);
console.log(obj3);

suntong avatar Feb 19 '18 19:02 suntong

Found another one,

https://es6console.com/jdxg96oh/

String.prototype.interpolate = function(params) {
  const names = Object.keys(params);
  const vals = Object.values(params);
  return new Function(...names, `return \`${this}\`;`)(...vals);
}

const template = 'Example text: ${text}';
const result = template.interpolate({
  text: 'Foo Boo'
});
console.log(result);

it's just plain normal ES6, but can't run in es6console.com.

suntong avatar Feb 21 '18 19:02 suntong