Which is the better way for conditional variable assignment?
1st method
if (true) {
var myVariable = \'True\';
} else {
var myVariable = \'False\
I would prefer 2nd option too, no technical reason but for the sake of easy to read code, readability is very important in code.
If you see the second option, from processing point of view only one check will ever be executed, saved some very minute processing time, so there is only one check in second case.