Look through these now and then use them to test yourself after doing the assignment:
Save and open this file up in a web browser (you can use Live Server to do this!) and then open up the browser’s console by right-clicking on the blank webpage and selecting “Inspect” or “Inspect Element”. In the ‘Developer Tools’ pane find and select the ‘Console’ tab, where you should see the output of our
console.log()is the command to print something to the developer console in your browser. You can use this to print the results from any of the following articles and exercises to the console. We encourage you to code along with all of the examples in this and future lessons.
.js similar to
The above tutorial mentioned this, but it’s important enough to note again:
var statements. Don’t let it bother you! There’s nothing inherently wrong with
var, and in most cases
let behave the same way. But sometimes the behavior of
var is not what you would expect. Just stick to
const) for now. The precise differences between
let will be explained later.
Numbers are the building blocks of programming logic! In fact, it’s hard to think of any useful programming task that doesn’t involve at least a little basic math… so knowing how numbers work is obviously quite important. Luckily, it’s also fairly straightforward.
Try the following exercises (and don’t forget to use
console.log(23 + 97)into your html file)
(4 + 6 + 9) / 77
let a = 10
9 * a
let b = 7 * a(returns
undefined*) and then
maxwith the value
max - 13
actual / max
percentagein the console and press enter you should see a value like
b = 7 * a) returns
undefined and so you cannot assign a value to a variable and read its value in the same line.`
This section contains helpful links to other content. It isn’t required, so consider it supplemental.
This section contains questions for you to check your understanding of this lesson. If you’re having trouble answering the questions below on your own, review the material above to find the answer.
+operator with numbers and strings?