Check if array is empty



    My JavaScript recipes

    The code block checks to see if the array is an array and if it is, it checks to see if the length of the array is zero.

    Shortcut: array.is_empty

    const isEmpty = Array.isArray(array) && array.length == 0;
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.