Question about const variable inside function


#1

Here is the code:

const getAverage = (numberOne, numberTwo) => {
const average = (numberOne + numberTwo) / 2;
return average;
}

My question is why we declare average as const? In this case what is the difference with let.

the code shoud be :

const getAverage = (numberOne, numberTwo) => {
let average = (numberOne + numberTwo) / 2;
return average;
}strong text


#2

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.