0

bug in 'The Spread Operator' course ?

Hi, I have a strange behavior with the Javascript code (Try it Yourself) in the Spread in object literals const obj1 = { foo: 'bar', x: 42 }; const obj2 = { foo: 'baz', y: 5 }; const merge = (...objects) => ({...objects}); let mergedObj = merge(obj1, obj2); // { 0: { foo: 'bar', x: 42 }, 1: { foo: 'baz', y: 5 } } let mergedObj2 = merge({}, obj1, obj2); // { 0: {}, 1: { foo: 'bar', x: 42 }, 2: { foo: 'baz', y: 5 } } I don't get anything in the SoloLearn Javascript console (I use Safari on Macbook). Same when I run it the code in Visual Studio Code as Output, I only get [Running] node "/var/folders/rh/fcqxsdxn2fnbjg_xssrj2k3c0000gp/T/tempCodeRunnerFile.javascript" [Done] exited with code=0 in 1.476 seconds And nothing in Debug Console. Thank you for your help. Best, Alex

10th Dec 2019, 1:45 PM
Alex
1 Antwort
0
There isn't a bug, they've put the output as comments so you don't actually need to run it at all - it tells you what the output is.
10th Dec 2019, 5:34 PM
Russ
Russ - avatar