JavaScript ternary operator

I am currently doing the JavaScript tutorial and on this page in the Ternary operator example
there is the following example snippet:

function update(bgColor, textColor) {
  html.style.backgroundColor = bgColor;
  html.style.color = textColor;
}

and the arguments for the function are simply named. I was wondering how this works, or how I can look it up. Because I thought the arguments here are variables, but they were never declared. I would like to know the rules on this. Where can I read up about it?

JavaScript is types afe hence we don’t have to give type to arguments, when we call this function from another place these arguments will get reference to those values hence we don’t need to declare these as variables.

1 Like