JavaScript ternary operator

(Krisztian Toth) #1

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) { = bgColor; = 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?

"Mozilla splash page" assessment
(Ajay Nara) #2

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.