Ad
  • Custom User Avatar

    The return statement(s) do the following:

    1: If o[v] is falsey (i.e. not an array in this case), set o[v] to an empty array.

    This ensures o[v] is always an array before the next statement is processed.

    2: Push a into the array at o[v].

    Now that we're sure o[v] is an array we can safely push a into it without any checks.

    3: The comma operator evaluates all statements separated by them (regardless of return), and returns the final value. In this case the final statment to be returned is simply o;

    This line is a more terse way of writing:

    if (!o[v]) o[v] = [];
    o[v].push(a);
    return o;
    
  • Default User Avatar

    Don't know if the description updated, but it at least returns a falsy value.