Lesson 13: TypeError: Cannot read properties of undefined (reading 'toString') #4854
-
Hi All, I am on lesson 13 (20.08.18) and getting the follwong error: TypeError: Cannot read properties of undefined (reading 'toString'). I looked throuigh the previous discussion, stackoverflow. But, unfortunately could not find anything. Thansks for your help guys. Code - aaveBorrow.js, I am geeting an error on line 26 - "const amountDaiToBorrow = availableBorrowsETH.toString() * 0.95 * (1 / daiPrice.toNumber());" |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hello @Sol-Devloper, I think the issue is that in line 45 you are returning with parenthesis and not with curly braces, also you need to reorder the variables so when you destructure the object on line 24 in the The undefined error should be solved If you make the return statement in line 45 look like this: return { availableBorrowsETH, totalDebtETH } |
Beta Was this translation helpful? Give feedback.
Hello @Sol-Devloper, I think the issue is that in line 45 you are returning with parenthesis and not with curly braces, also you need to reorder the variables so when you destructure the object on line 24 in the
main
function, the names of the keys matches the ones in the return statement.The undefined error should be solved If you make the return statement in line 45 look like this: