Professional Documents
Culture Documents
In any programming language, code needs to make decisions and carry out
actions accordingly depending on different inputs. For example, in a game, if the
player's number of lives is 0, then it's game over. In a weather app, if it is being
looked at in the morning, show a sunrise graphic; show stars and a moon if it is
night. In this article we'll explore how conditional structures work in JavaScript.
Looping code
Sometimes you need a task done more than once in a row. For example, looking
through a list of names. In programming, loops perform this job very well. Here
we will look at loop structures in JavaScript.
With most of the essential theory dealt with previously, this article provides a
practical experience. Here you'll get some practice with building up your own
custom function. Along the way, we'll also explain some further useful details of
dealing with functions.
The last essential concept you must know about a function is return values. Some
functions don't return a significant value after completion, but others do. It's
important to understand what their values are, how to make use of them in your
code, and how to make your own custom functions return useful values.
Introduction to events
Events are actions or occurrences that happen in the system you are
programming, which the system tells you about so you can respond to them in
some way if desired. For example if the user clicks a button on a webpage, you
might want to respond to that action by displaying an information box. In this
final article we will discuss some important concepts surrounding events, and
look at how they work in browsers.