In typescript, what is the difference between
if (x)
if (!x)
if (!!x)
Could this have different behaviors depends on the type of variable? (string, number, object, etc...). What I mean with the sentence above is:
const myString = 'hello';
const myObject = new MyClass(10, 'Luke');
const ten = 10;
if(myString)
if(!myString)
if(!!myString)
if(myObject)
if(!myObject)
if(!!myObject)
if(ten)
if(!ten)
if(!!ten)
In this example, when the code enters in one if instead of another?