Skip to content

Feedback entry task 2 #1

Description

@hnngo
  1. Hạn chế sử dụng var, nên sử dụng let hoặc const. Vì var là function scope, let, const là block scope cho nên sẽ an toàn và dễ kiểm soát scope của biến hơn.
    Ref: https://hackernoon.com/why-you-shouldnt-use-var-anymore-f109a58b9b70

  2. Có thể optimize chỗ này bằng cách clone cả list todoItems trước rồi gán dữ liệu mới vào thì sẽ gọn hơn là 2 lần spread, 2 lần slice.
    image
    image

  3. Thay vì phải dùng thêm 2 if để check 2 trường hợp text là space và empty string thì có thể check ở dòng if root.
    image

  4. Array map nhận một callback, và callback đó bắc buộc phải return gì đó lại để construct thành array, nếu em chỉ muốn loop qua để thực hiện task vụ cho từng phần tử thì dùng forEach nha
    image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions