JavaScript Part Two – Mad Scientist

Control Flow!

  • Control Flow statements enable JavaScript programs to make decisions by executing code based on a condition. If a given condition is true, we execute one block of code. If false, we execute another block.

So, if and else statements. Similar to the things we programmed in Action Script during undergraduate study. After reflecting on the previous lessons, it’s become quiet obvious how similar JavaScript is to Action Script.

Test code given:

Screenshot (158)

In this case, we give the variable userName a value, and we can change the variable knowsJavaScript to true if we want and all possibilities have an outcome.

Screenshot (159)

Yes. With further experimentation through the exercises, this is exactly like Action Script.

Advertisements

What's your thoughts?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s