es6console
es6console copied to clipboard
Support plain ES6 without transpile
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.
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);
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.