ECMAScript 6 Rest & Spread | SoloLearn: Learn to code for FREE!

+1

ECMAScript 6 Rest & Spread

Hello everyone, the test code in this part of course, seems not working with playground ?? it's a compatibility problem with ES6? I don't really understand this way of doing things and I think I will never use it. const obj1 = { foo: 'bar', x: 42 }; const obj2 = { foo: 'baz', y: 5 }; const clonedObj = { ...obj1 }; // { foo: "bar", x: 42 } const mergedObj = { ...obj1, ...obj2 }; // { foo: "baz", x: 42, y: 5 }

6/15/2020 7:39:02 AM

Alain Mazy

9 Answers

New Answer

+2

How do you know the code is not working with playground? Show your not working playground by sharing it. If your playground is really not working with es6, that's because of your phone webview can't support it, it's not playground problem, please update your webview from your phone.

+2

Emmanuel Omolewu Alain Mazy Try to use babel to precompile your code. You can erase my vode put your es6 code to this template. Just don't erase the starting comment: //</script><script type="text/babel"> https://code.sololearn.com/WVZ7dAJQN7kW/?ref=app

+2

Calviղ thanks alot sir. It works

+2

SoloLearn compiles Web Code using client's device.

+1

Emmanuel Omolewu Babel transpiler takes the ES6 source code we write and produce ES5 code that old browsers can interpret more consistently.

0

Calviղ mine seems not compatible with ES6 it shows synthax error for every example of try it yourself

0

Calviղ I understand that babel is a transpiler, does this imply that Sololearn playground runs on ecma2015

0

Gordon Wow, dat answers it

0

II don't learn on phone, but on pc. I am using sololearn playground. After that, that's okay, I moved on, other lessons .. if it turns out that one day I need that, I will come back to it, but that would surprise me all the same; )