Help! Javascript & Booleans

Hi all,

I’m trying to get the following to run but it’s coming up wrong. If the dolphin (boolean) is true, then I need to divide the sharkSpeed by 2. Any ideas on how i would write this?

function shark(pontoonDistance, sharkDistance, youSpeed, sharkSpeed, dolphin){
  dolphin = (sharkSpeed / 2);  
  let sharkTime = (sharkDistance / sharkSpeed);
  let youTime = (pontoonDistance / youSpeed);
    if (sharkTime < youTime) {
    return "Shark Bait!";
  } else if (youTime < sharkTime) {
    return "Alive!";

// if dolphin is true then half the speed of the shark before doing sharkDistance / sharkSpeed

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

  dolphin = (sharkSpeed / 2);  

In this line you are reassigning dolphin to a number (sharkSpeed divided by 2). You are not using the argument variable dolphin that is being passed into the function.