So, I recently started work at a new place of work, and I came across a javascript format that makes me question its purpose. (in particular, brackets {})
var _occurrences = getOccurrences($('#ddlTours').val()); { var _occurrence = getObjectByValue(_occurrences, 'tourID', booking.tourID); { _occurrenceID = _occurrence.occurrenceID; } }
For me, it is almost like trying to build an object. i.e.
var _occurrences : // Ignoring = getOccurrences($('#ddlTours').val()); { _occurrence : // Ignoring getObjectByValue(_occurrences, 'tourID', booking.tourID); { _occurrenceID : _occurrence.occurrenceID; } }
But, as I understand it, he will execute it as.
var _occurrences = getOccurrences($('#ddlTours').val()); var _occurrence = getObjectByValue(_occurrences, 'tourID', booking.tourID); _occurrenceID = _occurrence.occurrenceID;
Or is it so that _occurrence gets delete and does not sit around like its encapsulated, and we assign var, which is outside the encapsulation. Does this really work as a performance improvement? i.e.
Global var a = 1 { b = someFunction()
Another option is just bad code?
Or perhaps this is meant as a logical separation of the code to help dev?
I'm just wondering if anyone can shed some light on this for me :)
javascript
Spaceman May 19 '15 at 5:41 a.m. 2015-05-19 05:41
source share