If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# Teaching guide: Intro to JS - Resizing with variable expressions

This is a teaching guide for the Intro to JS lesson on Resizing with variable expressions.
Depending on the level of your students, you could mark this as a "bonus" lesson. This is one of the hardest lessons, and students can learn the rest of the course even if they struggle with the concepts in this lesson. Try it out in your class and see what the response is like.

### What the student will learn

• The math operators that are valid in JavaScript (+, -, /, *, %).
• How to use variables to draw groups of shapes that can be easily resized by changing a single variable.

### Where students struggle

• As noted above, students generally have a hard time with this lesson - but they also say that it helps them understand variables much better once they do understand it.
• Some students, especially younger ones, struggle with the math that’s involved in coming up with the variable expressions. Encourage them to use grid paper to draw out the shapes, write down their proportions, and use a calculator to see what the relationships are of the numbers to each other. Once they program the numbers, remind them to try changing the numbers to see how the shapes change as a result.
• Some students wonder if they can use different sorts of math expressions - like `faceSize * 0.50`, `faceSize / 2`, and `faceSize * 1/2`. All of those are valid in JS and mean the same thing.

These are questions that you can ask students individually after they've done the lesson, or lead a group discussion around, if everyone's gotten to the same point.
• Show the diagram of an animal body (penguin, human, etc). What variables might you use to program the body and its parts (face, limbs)? You can even try measuring each other to see what the proportions are, like what fraction legs are compared to height.
• Show the diagram of a building. What variables might you use to program the building and its parts (windows, doors, etc)?