In this lesson, students learn about functions and parameters in the context of JavaScript, which builds on their prior knowledge of working with functions in Karel. This lesson focuses specifically on defining and calling functions, and passing simple, single parameters to functions.
Students will be able to…
In this lesson, students will work with, define and call their own functions that take in multiple parameters as input and print out output.
Students will be able to:
In this lesson, students continue working with multiple parameters that create graphics as output which is very useful, since creating several different graphical objects involves writing the same code over and over again (set the size, set the color, set the location, etc).
Students will be able to:
In this lesson, students learn about return values so they can write functions that do some work and send the result back or use later in the program.
Students will be able to:
In this lesson, students work with and define functions with return values and more than one parameter.
Students will be able to:
In this lesson, students will be introduced to the concept of using timers for animation. Now instead of having graphics programs that stay the same, the content changes every time the timer runs. The first program students will see is a moving ball, so discussing this with the class as a demo on the projector is very useful.
Students will be able to:
setTimer
functionIn this lesson, we’ll look at more examples with timers and start making more interesting animations. Students will use timers and the Randomizer to create animations on the canvas.
Students will be able to:
In this lesson, students use timers in combination with the other ideas they have learned, including more graphics as well as coordinate math to create different objects. The random ghosts serves as a fun example to show how you can modify things once you have the basic building blocks in place to make them more readable and easier to alter.
Students will be able to:
In this lesson, students build on the use of timers and utilize if statements inside timers to dynamically change what the animations are doing.
Students will be able to:
In this lesson, students are introduced to a way input can be taken from the user’s mouse using the mouse clicked method.
Students will be able to:
In this lesson, students learn about lists/arrays and how to access an element in an array with an index so they can create ordered collections of items and use them in their programs.
Students will be able to:
In this lesson, students learn how to add and remove elements at the end of an array using the push
and pop
methods.
Students will be able to:
push
methodpop
methodIn this lesson, students will be able to get the length of an array and learn how to loop through an array so they can have more functionality with arrays in their programs.
Students will be able to:
In this lesson, students will be able to get the length of an array and loop through an array so they can use arrays in problems involving random numbers and JavaScript graphics.
Students will be able to: