Can you call a function that return a Promise without await keyword? #5642
-
|
Hello, I'm fairly new to JavaScript and I'm watching the lesson 7 at the FundMe.test.js and here you are calling a function that returns a Promise without using the await keyword, and it's working for you: But for me it's working only if I use the await keyword, otherwise I get this response: Also I see that you used await when you called this function for another test: Can someone explain a little bit why did he use await sometimes and sometimes not when calling this function? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
@software-dev2010 But here it is used because later while connecting |
Beta Was this translation helpful? Give feedback.
@software-dev2010
getSignersfunction is a async function and for it we need to useawaitbefore it.But here it is used because later while connecting
awaitis used.fund.connectfor it we do not needawaitbecause it is not async function.