Unit V - Lesson 3

6.3.1. Addition Operator

// write your code below this line
const v1 = boo+num;
const v2 = boo+str;
const v3 = num+arr;

6.3.2. Other Arithmetic Operators

// write your code below this line
const v1 = boo*num;
const v2 = str/boo;
const v3 = num**arr;

6.3.3. Relational Operators

// write your code below this line
const v1 = boo <= num;
const v2 = str > arr;
const v3 = num >= -10;

6.3.4. Strict Equality & Inequality Operators

// write your code below this line
const v1 = 10 === '10';
const v2 = 'he' === 'h' + 'e';
const v3 = v1 === v2;

6.3.5. Falsy or Truthy?

(b) NaN === NaN is falsy
(c) let variable;
variable is falsy
(d) 140 + 12 - 151 is truthy

6.3.6. Logical Operators

(b) The snippet below results in 'RRR'

let movie = 'RRR', booking = true;
booking && movie
(d) The snippet below results in false

let date = '2023-11-01', balance = 500;
var a = date >= '2023-10-15' && '2023-12-31' > date, b = balance > 500;
a && !b

6.3.7. typeof operator

(b) The result of the expression in the snippet is 'string'

typeof ('alert'.length + ' miles')

6.3.8. Ternary operator

(a) The result of the expression in the snippet is 'water'

'eagle' > 'swan' ? 'air' : 'water'
(b) The result of the expression in the snippet is 'string'

Infinity + Infinity === Infinity - 1 ? typeof 'yellow' : typeof []

Post a Comment