Check if array is empty

    0

    10

    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
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.