conditional structure such as if...else
if...else executes different code depending on the input providedfunction myFunction(p1, p2){return p1 * p2;}function keyword, followed by a name, followed by ()F names can contain letters, digits, underscores, and dollar signs same rules as variables
{}function name(para1, para2, para3){**code to be executed**}let x = myFunction(4, 3)function myFunction(a, b) {return a * b;} returns product of a*b as xfunction toCel(fahrenheit) {return (5/9) * (fahrenheit-32);} document.getElementById("demo").innerHTML = toCel(77);toCel refers to the function objecttoCel() refers to the function resultaccessing a funtino without () returns the function object instead of the function result
let x = toCel(77); let text = "The temp is " + x + " Celsius";let text = "The temp is " + toCel(77) + " Celsius";function myFunction() {let carName = "Subaru"; code here CAN use carName} while any code outside of that function can NOT use carName= assigns a value to a variablelet x = 10; assigns a value of 10 to variable x+ adds numbers* multiplication operatoroperand1 operator operand2operator operand OR operand operator| Logical *&& logical and; | logical or; ! logical not* |