Lesson 9: Passing an argument to a function raffle.enterRaffle()
with no parameters
#2542
-
I need a clarification on usage of a function in "scripts/enter.js" script. Two questions :
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @tsuccar
As we know, we have to pay some eth when calling the |
Beta Was this translation helpful? Give feedback.
Hey @tsuccar
enterRaffle
function does not take any parameters, however, it is payable and has to receive some ETH before allowing anybody to enter the raffle as evidenced by the snippet below.As we know, we have to pay some eth when calling the
enterRaffle
function for us to enter the raffle and the method used in the code above it how we send eth with our transactions (Yes. Calling a function is a transaction). So in this case,{value: entranceFee + 1}
isn't really a parameter, more like a value/data that we send along with our transaction. When we send like this, the eth beco…