Jquery Object Object when expecting string

I wrote the following, I dont understand why its working in this case:

function newTodo() {
  let list = $('#input').val();
  $('#todo-list').append($("<li><input type='checkbox'><label>" + list + "</label>" + "</li>"));
}
list = $('#input').val('');

However when I put the variable outside of the function like so:

let list = $('#input').val();
function newTodo() {	
  $('#todo-list').append($("<li><input type='checkbox'><label>" + list + "</label>" + "</li>"));
}
list = $('#input').val('');

All I get is Object Object, when I am expecting a string. Why is this?

I don’t think it’s related to that function-call.

// this returns a string
let list = $('#input').val();

// here you are SETTING value and that returns a object, so list is now an object
list = $('#input').val('');