@cheshireoctopus/

FEWD: Conditional Statements + Logical Operators

JavaScript

No description

fork
loading
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Instructions:
// Write the following conditions so that 'Print this!' appears three times in the console
// Use the following variable when writing:
var x = 10

// 1. Use a < or a > (less than, or greater than) operator
if (x > 8) {
	console.log('Print this!')
} else {
	console.log('Do not print this!')
}

// 2. Use the === (equal to) operator
if (x === 10) {
	console.log('Print this!')
} else {
	console.log('Do not print this!')
}

// 3. Use the !== (not equal to) operator
if (x !== 'cat') {
	console.log('Print this!')
} else {
	console.log('Do not print this!')
}

// 4. Write your own using whatever operator you like :D
Native Browser JavaScript