repl.it
@poysed2code/

JS Assignment 3: Introduction to Control Flow

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function exampleExercise(value){
  // !!! This is an example exercise, we will show you how to complete the following exercises here. 
  // !!! There is NO need to write any code for this exercise. 
  // !!! This exercise is ALREADY complete, Use this as reference to complete the others.
  
  // In this exercise, you will be given a variable, it will be called: value
  // On the next line create a variable called 'notEqualTo' and using a comparison operator, check to see if value is not equal to 'green'.
  // Assign the results of that to 'notEqualTo'
  let notEqualTo = value !== 'green';
  
  // Please write your answer in the line above.
  return notEqualTo;
}

function exerciseOne(value){
  // In this exercise, you will be given a variable, it will be called: value
  // On the next line create a variable called 'greaterThan' and using a comparison operator, check to see if value is greater than 5.
  // Assign the results of that to 'greaterThan'
  let greaterThan = value > 5;
  
  // Please write your answer in the line above.
  return greaterThan;
}

function exerciseTwo(value){
  // In this exercise, you will be given a variable, it will be called: value
  // On the next line create a variable called 'lessThan' and using a comparison operator, check to see if value is less than 20.
  // Assign the results of that to 'lessThan'
  let lessThan = value < 20;
  
  // Please write your answer in the line above.
  return lessThan;
}

function exerciseThree(value){
  // In this exercise, you will be given a variable, it will be called: value
  // On the next line create a variable called 'equalTo' and using a comparison operator, check to see if value is equal to 37.
  // Assign the results of that to 'equalTo'
  let equalTo = value === 37;
  
  // Please write your answer in the line above.
  return equalTo;
}

function exerciseFour(value){
  let greaterThanFive = false;
  // In this exercise, you will be given a variable, it will be called: value
  // You will also be given a variable named: greaterThanFive
  // Using an 'if' statement check to see if the value is greater than 5. If it is, re-assign greaterThanFive the boolean true.
  if(value > 5);
  let greaterThanFive = true;
  // Please write your answer in the line above.
  return greaterThanFive;
}

function exerciseFive(name){
  let isSondra = false;
  // In this exercise, you will be given a variable, it will be called: name
  // You will also be given a variable named: isSondra
  // Using an 'if' statement check to see if the name is equal to the string 'Sondra'. If it is, re-assign isSondra the boolean true.
  if (name ='Sondra');
  return true;
   else;
  // Please write your answer in the line above.
  return isSondra;
}
Native Browser JavaScript