Avatar of OMIED BADR
OMIED BADR

asked on 

JavaScript problem

I'm having issues with the problem below. It's telling me to Use the conditional operator to rewrite the if...else statement in the editor.  on the very bottom is my answer and the beginning part is where we to take the problem and rewrite it.  please help.


function greet(hour) {
  if (hour < 12) {
    return "Good morning!";
  } else {
    return "Good afternoon!";
  }
}

var greet = greet(hour);
 greet() = (hour < 12) ? "Good morning!" : "Good afternoon!";
JavaScript

Avatar of undefined
Last Comment
OMIED BADR

8/22/2022 - Mon