Javascript Basics (9-12)

  1. How do you pass a parameter to a javascript function?
    • When the function is called, the parameter is listed
    • say changeBackground('more') The function itself just needs a variable so...function changeBackground(it) would work.
  2. Pass two parameter, manny and moe to a function. Also, show how the main line of a function is created.
    changeMe('manny','moe')

    function changeMe(main,second) {}
  3. What operator finds the remainder of a division?
    Modulus %
  4. Single increment operator
    ++ or -- for going down
  5. Compare vs assign
    • Compare ==
    • Assign =
  6. Compare operator for not equal
    !=
  7. If you have an if statement, how do you handle more than two options?
    • if () {}
    • else if () {}
    • else {} Remember that the else doesn't have parameters...ever!
  8. If you want to check to see if two conditions are occuring in a if/else statement what operator would you use to check to conditions at the same time?
    and &&
  9. Create a while loop
    while (condition) {}
  10. What are the three statements in a for loop and how are they separated?
    • for (variable defined; condition,increment )
    • for (i=0;i<5;i++)
Author
dalbabes
ID
60458
Card Set
Javascript Basics (9-12)
Description
Oreilly
Updated