I have a suggestion for ternary operations for ease of use and cleaner code. The main premise is as follows:
There are plenty of situations where people implement a conditional statement without including an else clause such as :
var x = "World";
var y = "";
if(typeof x === "string")
{
y = Hello ${x}
);
}
This is prevalent in much coding, and sometimes people choose to use ternary operators to go through that process but end up either not being able to do so, or end up having longer than necessary resolutions to their code.
What I SHOULD be able to do INSTEAD of needing the bracketing is this:
var x = "World";
var y = typeof x === "string" ? Hello ${x}
;
with it yet being decided as to whether or not the return should be the default value of what was the original assignment, null, or both depending on whether or not there was an original assignment. As you can see above, the assignment is much cleaner and in one line versus multiple, and despite the fact that you could have a return of null, the simplicity of simply having it AS a default isn't the worst option to help clean things up and then only offer an alternative solution as needed/defined.