Why am I taught to write this (basic) function with no parameter?
function idealSleepHours () {
const idealHours = 8;
return idealHours*7
};
It is working with parameter as well. Am I missing something?
function idealSleepHours (idealHours) {
idealHours = 8;
return idealHours * 7
};
I am sorry for a dumb question, I am new in JavaScript (and programming), therefore everything is a little bit confusing for me.
Edit: Thank you very much for your answers, now I absolutely understand the difference.