Help with else if statement Javascript Challenges

const calculateWeight = (earthWeight, planet) => {
if ('Mercury') {
return earthWeight * 0.378
} else if ('Venus') {
  return earthWeight * 0.907
} else if ('Mars') {
  return earthWeight * 0.377
} else if ('Jupiter') {
  return earthWeight * 2.36
} else if ('Saturn') {
  return earthWeight * 0.916
} else {
  return 'Invalid Planet Entry. Try: Mercury, Venus, Mars, Jupiter or Saturn.'
  console.log(calculateWeight(100, 'Jupiter'));

My code isn’t working it should be returning 236 but it returns value for ‘Mercury’ every time I’m lost… I managed to complete this challenge with a switch statement but I would still like to know what i’m doing wrong with this.
PS, sorry for the poor post quality first post ever will improve in the future :slight_smile:


if ('Mercury') what? You are not comparing 'Mercury' to anything, so JS will just evaluate the string, which is considered true. So no matter what planet you provide, you will always get Mercury


Ah wow thank you idk how I didn’t think of that.