315,489 views
10 votes
10 votes
Function test(name, birth_year, current_year) {

const age = current_year - birth_year;
const response = name + " is " + age;
return response;
}

test("john", 1917, 2006)

User Garvin
by
3.0k points

1 Answer

24 votes
24 votes

Answer:

Step-by-step explanation:

The output of the function would be "john is 89". The function calculates the age of the person by subtracting the birth year from the current year and storing the result in the variable age. The response variable is then defined as the concatenation of the name variable, the string " is ", and the age variable. The return statement then returns the value of the response variable, which is "john is 89" in this case.

User Abdelrahman Wahdan
by
3.1k points