For example,
var doSomething = function() {`
var a = 1, b = 2, c = 3;
var d = a;
b = b - 3;
d = b;
console.log(a,b,c,d);
}
doSomething();
Is there any possible situation beginning from the dawn of the universe until the end, that the output of the code when executed in node js - built on JavaScript's V8 engine would be anything other than 1 -1 3 -1.
Is there any combination of synchronous lines of code that do no execute in the order they are written.?
Any puns are not welcome and any help is appreciated.
Additional question:
var index = commonFunc.getObjectIndexFromArray(option[0].fields.custom_field, tableAccess.checkDomainInTable.selected_template);
if (option[0].fields.custom_field && option[0].fields.custom_field.length > 0 && index >= 0) {
userOptions = option[0]['fields']['custom_field'][index][tableAccess.checkDomainInTable.selected_template];
}
if(tableAccess.checkDomainInTable.delivery_template) {
index = commonFunc.getObjectIndexFromArray(option[0].fields.custom_field, tableAccess.checkDomainInTable.delivery_template);
if (option[0].fields.custom_field && option[0].fields.custom_field.length > 0 && index >= 0) {
deliveryOptions = option[0]['fields']['custom_field'][index][tableAccess.checkDomainInTable.delivery_template];
}
}
In the above code, after assuming that the common function gets the index of a json object from an array of json object using simple for loop, can there be any situation in which the second occurence of the assignment of the variable index be executed first and the first occurence after that & causes an ambiguity in the values of userOptions and deliveryOptions ?