0

Return an array

Why this code bellow doesn't return an array and instead return a function https://code.sololearn.com/W0chC51O4yjw/?ref=app

22nd Jan 2022, 2:18 AM
EsaKurniawan
1 Answer
+ 2
The code prints a function because selectOne is a function. If you want the return value of said function, you need to invoke it (call it): console.log(selectOne()) Note the added parentheses after 'selectOne'.
22nd Jan 2022, 3:44 AM
Ani Jona 🕊
Ani Jona 🕊 - avatar