Lấy các mục của danh sách dropdown bằng JavaScript

Giả sử chúng ta có một danh sách dropdown:

html<select id="select">
  <option value="one">một</option>
  <option value="two">hai</option>
  <option value="three">ba</option>
</select>

Câu hỏi: làm thế nào để chúng ta lấy tất cả các mục của danh sách này? Cách đơn giản nhất là sử dụng bộ chọn tương ứng:

javascriptlet options = document.querySelectorAll('#select option');
console.log(options);

Có thể không tìm kiếm trong toàn bộ tài liệu, mà cụ thể trong select của chúng ta:

javascriptlet select  = document.querySelector('#select');
let options = select.querySelectorAll('option');
console.log(options);