Compare numbers, return with the highest value

Asked

Viewed 89 times

0

Ok, basically I need to create a simple javascript function where I enter two values, and it returns the largest of them. My solution was:

function eMaior(A,B) {
  
  if (A > B) {return: A}
  else {return B}
  
}

but it doesn’t work and I don’t understand what I’m doing wrong. someone can help?

1 answer

0


Kathryn, just remove the : of this excerpt {Return: A}

  • omeudeus, such a small business hahahaha thank you Rodrigo!!! <3

  • Welcome to the life of a programmer :)

  • Always look for the error log ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.