JS Assignment 4: Control Flow Continued
BrianTran2 (13)

Is anyone doing LambdaSchool JavaScript pretest because I have worked for 40 minutes and I can get question 3 from assignment 4 correct.

You are viewing a single comment. View All
Cwill14 (13)

@noahperez I couldn't figure it out either, but I messed around and this somehow passed, even though it doesn't make much sense to me.

function exerciseFour(value){
  var greaterThanFive = value === 10;
  // 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 Sondra = 'Sondra';
  let isSondra = name === Sondra;
  // 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) {
    let isSondra = true;
  }
  // Please write your answer in the line above.
  return isSondra;

The model solution they provided once done is the following, but I swear I did the same thing and it didn't work for me:

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){
    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'){
    isSondra = true;
  }
  
  // Please write your answer in the line above.
  return isSondra;