+ 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 }

15th Jun 2020, 7:39 AM
Alain Mazy
Alain Mazy - avatar
9 Antworten
+ 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.
15th Jun 2020, 7:51 AM
Calviղ
Calviղ - avatar
+ 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
15th Jun 2020, 10:18 AM
Calviղ
Calviղ - avatar
+ 2
Calviղ thanks alot sir. It works
15th Jun 2020, 10:34 AM
Emmanuel Omolewu
Emmanuel Omolewu - avatar
+ 2
SoloLearn compiles Web Code using client's device.
15th Jun 2020, 12:54 PM
Gordon
Gordon - avatar
0
Calviղ mine seems not compatible with ES6 it shows synthax error for every example of try it yourself
15th Jun 2020, 9:35 AM
Emmanuel Omolewu
Emmanuel Omolewu - avatar
0
Calviղ I understand that babel is a transpiler, does this imply that Sololearn playground runs on ecma2015
15th Jun 2020, 10:56 AM
Emmanuel Omolewu
Emmanuel Omolewu - avatar
0
Emmanuel Omolewu Babel transpiler takes the ES6 source code we write and produce ES5 code that old browsers can interpret more consistently.
15th Jun 2020, 11:22 AM
Calviղ
Calviղ - avatar
0
Gordon Wow, dat answers it
16th Jun 2020, 10:57 AM
Emmanuel Omolewu
Emmanuel Omolewu - avatar
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; )
18th Jul 2020, 12:43 PM
Alain Mazy
Alain Mazy - avatar