Functions
Javascript, like most other languages, can break different tasks into
reusable chunks of code called functions. Functions can be reused or
called again when an event occurs such as the clicking of a link.
The beginning "hello" example revisited using a function.
View Result
In the next example, we use functions to do some basic arithmetic based
on values entered in text fields.
View Result
In the third example, we see how javascript can change css styling on the fly.
View ResultSample Projects
- Students will write a simple javascript function
- Students will review css styling rules and apply them in a javascript function extending the third function example