Complete the code to add two numbers and store the result in sum.
let a = 5; let b = 3; let sum = a [1] b;
- instead of + will subtract instead of add.The + operator adds two numbers together.
Complete the code to multiply two numbers and store the result in product.
let x = 4; let y = 7; let product = x [1] y;
+ will add instead of multiply.The * operator multiplies two numbers.
Fix the error in the code to correctly divide num1 by num2.
let num1 = 20; let num2 = 4; let result = num1 [1] num2;
* multiplies instead of divides.The / operator divides the first number by the second.
Fill both blanks to create an object that maps numbers to their squares only if the number is even.
const squares = {n[1]2 for n in [1, 2, 3, 4, 5, 6] if n [2] 2 === 0};+ instead of ** will add instead of square.The ** operator raises a number to a power (square here). The % operator finds the remainder, used to check if a number is even.
Fill all three blanks to create an object mapping uppercase letters to their ASCII codes only if the code is greater than 65.
const codes = {[[1]]: [2] for [3] of ['A', 'B', 'C', 'D'] if [2] > 65};for ... in instead of for ... of will iterate keys, not values.letter is the variable for each character. charCodeAt(0) gets the ASCII code. The loop uses for ... of to iterate over letters.