0

“ES6 Object” code practice doesn’t work

Can someone tell me what’s wrong with this ES6 code? I’ve run it on another JS app on my mobile & it gives the desired output. But in the sololearn practice it doesn’t pass the test case let basic = { ex1: 'PushUps: 20 times', ex2: 'Jumps: 20 times' }; let advanced = { ex3: 'Squats: 30 times', ex4: 'Run: 2km' }; //your code goes here let total=Object.assign({},basic,advanced); for(let ex in total) { console.log(total[ex]) };

29th Nov 2020, 10:55 AM
Boulos Ananian
Boulos Ananian - avatar
18 Answers
+ 7
Boulos Ananian Locked cases are hidden and I am not pro member 😅 you can ask it with a pro member - Morpheus - he is best in JavaScript, he can help you
1st Dec 2020, 2:59 AM
Priyanshi
Priyanshi - avatar
+ 7
Boulos Ananian Sorry I don't know much about js 😅 I am learning it
2nd Dec 2020, 9:29 AM
Priyanshi
Priyanshi - avatar
+ 6
Hello Morpheus sir, The problem Boulos Ananian mentioned here is indeed legit Im also stuck with the same problem I have tried all these possible ways of merging objects and all of them works perfectly fine in my SL's js console But The test case does Not approve of it By any way can you find out why Is this happening or maybe what can be the possible Test Case in it https://code.sololearn.com/W49Z6znvOrr2/?ref=app
1st Dec 2020, 8:21 PM
ASM
ASM - avatar
+ 4
Maybe because of network problems, it's working bro see it https://code.sololearn.com/cggCsE9TT752/?ref=app
30th Nov 2020, 2:50 PM
Priyanshi
Priyanshi - avatar
+ 4
yea it works here, but it seems there’s a test case that doesn’t pass
30th Nov 2020, 8:31 PM
Boulos Ananian
Boulos Ananian - avatar
+ 4
HYG the problematic: “You are making a workout app. After completing the basic exercises in the app, the user is able to access advanced content. The given program declares two classes - basic and advanced with corresponding properties. Complete the code to combine basic and advanced level exercises into one new object named total, so that the given code for final output works correctly.”
30th Nov 2020, 8:32 PM
Boulos Ananian
Boulos Ananian - avatar
+ 4
the test case is locked
30th Nov 2020, 8:34 PM
Boulos Ananian
Boulos Ananian - avatar
+ 4
Morpheus can u help plz?
1st Dec 2020, 6:40 AM
Boulos Ananian
Boulos Ananian - avatar
+ 4
Boulos Ananian There are no issues with this code this code is correct. The problem might be with the newer ES6 syntaxes like - Let, Object.assign() and for-in loop. which were not available prior to ES6 version in Javascript. Your default browser in phone might be old and doesn't support the new Javascript. The other apps must be having their own Javascript environment configured. I suggest sharing your browser version using this code to make sure its the old browser issue. https://code.sololearn.com/W4vC0w43yqNQ/?ref=app To see the new code in older ES5 syntax I use babel. https://babeljs.io/repl
1st Dec 2020, 7:46 AM
Morpheus
Morpheus - avatar
+ 4
Try resetting The Code, then add that line again let total = Object.assign({}, basic, advanced) and run it should work
2nd Dec 2020, 7:58 AM
ASM
ASM - avatar
+ 4
it worked! thanks but i’ve a similar issue in another code practice & it doesn’t respond, the following code works well in the code playground but doesn’t pass a hidden test case. Morpheus , Rishi or A. S. M. do u have any idea? HYG //complete the function function Add(...nums){ return nums.reduce((a,b)=> a+b); } console.log(Add(1,2,3)); console.log(Add(4,14,5,9,14)); console.log(Add(2,36));
2nd Dec 2020, 8:36 AM
Boulos Ananian
Boulos Ananian - avatar
+ 4
and HYG the problem proposed: “You are making a program to calculate the sum of any number of values. Complete the given function so that it takes as parameters as many numbers as needed and returns.”
2nd Dec 2020, 8:37 AM
Boulos Ananian
Boulos Ananian - avatar
+ 3
Boulos Ananian Well Your code does indeed work But Since I cant access any more of the pro ES6 challenges, I cant help you Sorry
2nd Dec 2020, 8:52 AM
ASM
ASM - avatar
+ 3
thanks A. S. M. for ur concern. Morpheus can u help? another question, why can’t I access these hidden test while I have a Pro account?
2nd Dec 2020, 8:54 AM
Boulos Ananian
Boulos Ananian - avatar
+ 2
ok, thanks Rishi 👍
1st Dec 2020, 6:39 AM
Boulos Ananian
Boulos Ananian - avatar
+ 1
Morpheus I use the app not the broswer & in case the app uses my mobile browser engine (which i doubt), then i’m using iOS 14 with the browsers updated. I guess it’s a sololearn app issue. what do u think?
1st Dec 2020, 6:46 PM
Boulos Ananian
Boulos Ananian - avatar
+ 1
Boulos Ananian Are you getting an error message? If yes then whats the error message you are getting? If nothing is happening and you are not able to run the code itself then I suggest reporting this issue in info@sololearn.com
1st Dec 2020, 7:37 PM
Morpheus
Morpheus - avatar
+ 1
i’m not getting an error message. ok, i’ll report it, thanks Morpheus a lot
1st Dec 2020, 7:38 PM
Boulos Ananian
Boulos Ananian - avatar