Intro to Programming

Values and expressions To facts …

Topic Basic Intermediate Advanced
Numeric expressions
Translate simple numeric Javascript expressions into English descriptions of what they compute.
Write simple expressions using the six arithmetic operators: +, -, *, /, %, and ** from descriptions in English of the desired result.
Write simple numeric literals like 10, 1.5.
Write compound numeric expressions using the six arithmetic operators: +, -, *, /, %, and ** and ()s for grouping from descriptions in English of the desired result.
Describe some uses of the % operator.
Use the function Math.sqrt and Math.abs as appropriate.
Use constant Math.PI in mathematical formulas when needed.
Translate complex formulas descrbed in English into Javascript.
Use alternative forms of numeric literals such as 1e6 and 1_000_000. (And 0xdeadbeef if you’re really fancy.)
Explain why 0.1 + 0.2 is 0.30000000000000004 and not 0.3.
Boolean basics
Describe some Boolean attributes that people or things can have? (Ignore nuance.)
Describe the two values a Boolean expression can have.
Use boolean literals true and false in expressions.
Given a set of people or objects with various characteristics pick out the instances that match some boolean expression.
Given a set of people or objects with various characteristics write a boolean expression that identified a specific subset.
Describe how boolean expressions are analogous to arithmetic expressions.
Logical operators
Write boolean expressions using one or two variables and one of the logical operators (!, &&, and ||) to achieve a described meaning.
Write boolean expressions using three or more variables and two or more logical operators to achieve a described meaning.
Properly parenthesize and de-parenthesize boolean expressions involving the three logical operators.
Simplify boolean expressions using Boolean algebra.
Apply De Morgan’s Laws to transform boolean expressions involving just logical operators.
Apply De Morgan’s Laws to transform boolean expressions involving relational operators. (Recall that !(a > b) can also be written as a <= b.)
Apply the distributive property to expressions like a && (b || c) and a || (b && c)
Explain short circuiting of || and &&.
Equality operators
Use === and !== to compare primitive values..
Explain the difference between = and ===.
Always simplify boolean expressions involving equality operators and boolean literals. I.e. always simplify x === true to just x and x !== true to !x.
Explain the difference between == and === and why we prefer the latter.
Explain why it’s important to always simplify boolean comparisons as in the previous column.
Explain what === and !== do when used with reference types.
Understand why equality operators may produce surprising results when used with numbers with fractional parts.
Relational operators
Write expressions using equality and relational operators (===, !==, <, >, <=, and >=) and one variable and one literal to achieve a described meaning.
Use parentheses correctly to control the order of operations.
Write expressions using relational operators (===, !==, <, >, <=, and >=) and multiple variables to achieve a described meaning.
Chain relational operators with logical operators to translate mathematical expressions like 0 ≤ x < 10 into 0 <= x && x < 10.
Write boolean expressions using a combination of logical and relational operators and variables with values of various types.
String expressions