Whatās wrong with this JavaScript code
Itās a practice question in sololearn javascript. Practice Using āreturnā. Question and my coding (After //complete the function) as follows and I am not sure whatās wrong with it. Question: You are given a program that takes 3 numbers as input. Complete the given function to calculate the average of those 3 numbers, assign it to the given variable, and output it. Sample Input 3 6 9 Sample Output 6 ............................................................ Coding: function main() { var num1 = parseInt(readLine(),10); var num2 = parseInt(readLine(),10); var num3 = parseInt(readLine(),10); var average; //assign the average value to the variable average console.log(average) } //complete the function function avg(num1 ,num2 ,num3){ var average = (num1 + num2 + num3)/2; return average;} console.log(avg(num1,num2,num3));