Introduction to programming with JavaScript, Chapter 1.
Video version: https://www.youtube.com/watch?v=Ps03yn2XlUw
In this chapter, we explore the basics of computer programming through hands on exercises with JavaScripts.
Concepts covered:
- expressions
- statements
- values
- operators
30. What value is the variable bottles set to?
var cans = 2 + 10;
var bottles = 2 + cans - 10 - cans;
31. Homework #1
Write a JavaScript
expression which adds
5 to 10.
This expression
should evaluate to 15.
Use www.repl.it to
write your code.
32. Homework #2
Define three variables. One
should hold your age, one
should hold your favorite
number, and one should hold
the number of siblings you
have.
Next, define a new variable
which stores the result of
adding the previous three
variables together.
33. Homework #3
Define a variable to hold the number
of hours in a day.
Multiply this value by 7 to get the
number of hours in a week. Assign
this to a new variable.
Next, multiply this by the number of
weeks in a year (52) and assign the
result of this in a new variable.
Finally, divide this number by the
number of days in a year (365). What is
the result?