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 addition +.The + operator adds two numbers together.
Complete the code to check if age is greater than 18.
let age = 20; if (age [1] 18) { console.log('Adult'); }
< instead of greater than >.The > operator checks if the left value is greater than the right value.
Fix the error in the code to multiply x and y.
let x = 4; let y = 7; let product = x [1] y;
+ or subtraction - instead of multiplication *.The * operator multiplies two numbers.
Fill both blanks to create an object with keys as uppercase letters and values as numbers greater than 10.
const data = {
[1]: 15,
[2]: 20
};Keys in objects are strings. Using uppercase letters 'A' and 'B' as keys matches the requirement.
Fill both blanks to create a condition that checks if score is between 50 and 100 (inclusive).
if (score [1] 50 && score [2] 100) { console.log('Pass'); } else { console.log('Fail'); }
> or < without equals, missing boundary values.The condition uses >= to check if score is at least 50 and <= to check if score is at most 100.
