JavaScript Falsy Explanation

and still, no, your example is NOT what I am talking about, that’s an expression that is evalauted as a boolean. I am talking about putting in the parenthesis just a value, without any operator

i know but i don’t understand why you would do that. why use an if statement if you’re not testing anything?

This is how an if statement works:

if (thisThingIsTrue) {
  Do something
}
if (thisThingIsFalse) {
  Don't do this
}

I don’t know what the value of your hypothetical variable var is: it might be the string “false” or it might not be. So var === "false" is either false or true. So

if (var === "false") 

Is either if (false) or if (true), it’s impossible for me to know

you said to see if a variable would be something so i reverted to that example i used before.

I am putting in the parenthesis a variable, that can be any value

you are putting in an expression which is evaluated only to true or to false

this

if (myVal) {...}

is not the same thing as

if (myVal === 3) {...}

but what i still don’t understand is what test you are performing on the first example and if you are not performing a test, why you are using an if statement.

if (this value is considered true) {
  Do a thing
}

such as if (var === “false”) ?

Sure. Or if (myVal) if you want to test if myVal is a truthy value or not

truthy as to what condition?

Anything you put into round brackets at the top of an if statement JavaScript will convert to the value true or false regardless of what it is.

You are testing if it is considered truthy or not

except something that’s already true/false as you stated above. right?

sky = blue
sky=blue -> true
sky = green -> false

sky = ? is this true or false? how can you tell if you’re not coding the test?

Sure, but false is a falsey value, true is a truthy value, it just won’t coerce it to true or false because it doesn’t need to

At the end of the day, the if statement needs to be either

if (true)

Or

if (false)

i think that’s my point. all if statements evaluate a test as either true or false but it requires the test to evaluate it.

how can it evaluate to true or false without the test?

I’m out, man, this is just going round and round in circles.

Thank you for trying. Sorry I’m so dense about this topic.