Help With Variable and Converting Variable to a String to be Concatenated
Hello:
I am working with this snippet of code and having problems because I don't understand the syntax. Could someone help me with this? I need to separate the hours variable into hours and minutes an then I need to turn that into a concatenated string.
- function updateDistances(item) {
- try {
- var prev = $($(item).prevAll('li:not(.show_placeholder):first'));
-
- if (prev != undefined && !$(prev).hasClass('temp_placeholder')) {
- calcRoute(prev, $(item));
- }
- } catch(e) {
- log(e);
- }
-
- try {
- var next = $($(item).nextAll('li:not(.show_placeholder):first'));
- if (next == undefined || $(next).hasClass('temp_placeholder')) {
- $($(item).find('span.drive_time')[0]).text(hours.toString().substring(0, 4) + ' h' + ' :' + ' m');
-
-
- $($(item).find('span.drive_miles')[0]).text('0.0 mi');
- $(item).find('select.transfer').val('');
- } else {
- calcRoute($(item), next);
- }
- } catch(e) {
- log(e);
- }
- }