Pls why do I get null as the output on the console? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Pls why do I get null as the output on the console?

I want to log 40 as a value on the console using the code(javaScript) https://code.sololearn.com/WtcAe23Re63j/?ref=app

30th Sep 2021, 12:31 AM
Okafor Okwuchukwu Charisma
Okafor Okwuchukwu Charisma - avatar
8 Answers
+ 1
When i chain than and catch uncaught(in promise) disapire and error is catched. Dont know why it work with chain but dont work in way you tried first. It look like we need to use this syntax https://code.sololearn.com/WhXv3zy8z1FV/?ref=app
14th Oct 2021, 7:52 AM
PanicS
PanicS - avatar
+ 4
On line 7 You wrote: resolve(add((multiply(5,6),10))); That is actually one more pair of () than what You need. It should like this: resolve(add(multiply(5,6),10)); And then Your output should be 40. Furthermore I recommend formatting Your code better. Use spaces after commas, spaces after the "=>" and either use semicolons or don't.
30th Sep 2021, 9:18 AM
Nick Crisci
Nick Crisci - avatar
+ 2
There is more "()" than needed in your line 7 https://code.sololearn.com/W8IF180vp8rl/?ref=app
30th Sep 2021, 9:16 AM
PanicS
PanicS - avatar
+ 2
Wow! I am proud to be a member of this community, you are such a wonderful and supportive people. Thanks a lot for your contributions
30th Sep 2021, 6:44 PM
Okafor Okwuchukwu Charisma
Okafor Okwuchukwu Charisma - avatar
+ 1
@Sanja Panic , what I meant is that the system says there is error in line 1(Promise). Of course I expect to see the reject value passed as the argument to the .catch()
14th Oct 2021, 4:27 AM
Okafor Okwuchukwu Charisma
Okafor Okwuchukwu Charisma - avatar
+ 1
@Sanja Panic, thanks a lot for your help, I really appreciate it. Any time you find the reason for that, please let me know.
15th Oct 2021, 3:30 AM
Okafor Okwuchukwu Charisma
Okafor Okwuchukwu Charisma - avatar
0
Pls why do I get null as the output on the console? Thanks for resolving the issue. I noticed an error message when the promise is being rejected, please how do I solve that? I want to log 40 as a value on the console using the code(javaScript) https://code.sololearn.com/WtcAe23Re63j/?ref=app
30th Sep 2021, 6:58 PM
Okafor Okwuchukwu Charisma
Okafor Okwuchukwu Charisma - avatar
0
okafor okwuchukwu charisma you check arr.length to be bigger than 5, but arr.length is 3. So this will show your reject code
1st Oct 2021, 7:39 PM
PanicS
PanicS - avatar