add checkbox dynamically in javascript

JavaScript
$(document).ready(function() {
  $('#submit').click(function() {
    var list = ['Car', 'Bike', 'Scooter'];
    for (var value of list) {
      $('#container')
        .append(`<input type="checkbox" id="${value}" name="interest" value="${value}">`)
        .append(`<label for="${value}">${value}</label></div>`)
        .append(`<br>`);
    }
  })
});

Source

Also in JavaScript: