Help With Variable and Converting Variable to a String to be Concatenated

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.

  1. function updateDistances(item) {
  2. try {
  3. var prev = $($(item).prevAll('li:not(.show_placeholder):first'));
  4. if (prev != undefined && !$(prev).hasClass('temp_placeholder')) {
  5. calcRoute(prev, $(item));
  6. }
  7. } catch(e) {
  8. log(e);
  9. }
  10. try {
  11. var next = $($(item).nextAll('li:not(.show_placeholder):first'));
  12. if (next == undefined || $(next).hasClass('temp_placeholder')) {
  13. $($(item).find('span.drive_time')[0]).text(hours.toString().substring(0, 4) + ' h' + ' :' + ' m');
  14. $($(item).find('span.drive_miles')[0]).text('0.0 mi');
  15. $(item).find('select.transfer').val('');
  16. } else {
  17. calcRoute($(item), next);
  18. }
  19. } catch(e) {
  20. log(e);
  21. }
  22. }