JS function does not set default parameter values as expected

Hi! I’m having trouble understanding what my code is doing. The default parameter values should be undefined, yet when I use console.log to check its values, it doesn’t seem that they are undefined. “end” is undefined; “start” returns [Object object]. Why is that?
Thanks!

function createNewElem_Dates(start, end) {
  var div = document.getElementsByClassName('add-dates')[0];
  var clone = div.cloneNode(true);
  $(clone).attr('style', 'display:block');
  console.log(`${start}, ${end}`);
  start = start ? start : '';
  end = end ? end : '';
  console.log(`${start}, ${end}`);
  $(clone).children('input[name="from-date"]').val(start);
  $(clone).children('input[name="to-date"]').val(end);
  document.getElementById('inputs').appendChild(clone);
}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.