Can someone help me understand functions? I am so confused


#1


Function Review


no error


var calculatorOn = false;

function pressPowerButton() {
  if (calculatorOn) {
    console.log('Calculator turning off.');
    calculatorOn = false;
  } else {
    console.log('Calculator turning on.');
    calculatorOn = true;
  }
}

pressPowerButton();
// Output: Calculator turning on.

pressPowerButton();
// Output: Calculator turning off.


#2

Hi,
Do you have a specific example? What is it that you don't understand?


#4

I want to understand how different parts of how a function works. For example, parameters, arguments. Sort of breaking it down piece by piece. I can provide an example if you want?


#5

leveraging some old posts of CC.
check this out..

and also check this...


#6

Thanks that helps. I will you know if I have any further questions


#7

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