Liz Anaya Ramos
·Developer Community Manager @ Xano

Challenge #32 - Filter Non-Empty Entries from an Array

Objective: Create an array containing various elements, including empty values, and return a new array with only the non-empty entries.

Instructions:

  1. Define the Array:

    • Create an array variable named mixed_array and assign it the values [0, "apple", "", [], "orange", null, 23, [], "banana", 0, ""].

  2. Filter Non-Empty Entries:

    • Create a second array variable named filtered_array and use a filter to create an array that contains only the non-empty entries from mixed_array.

  3. Submit the array contained in the variable filtered_array.

Expected Result:

Submit the variable filtered_array as your answer. See example below:


Install the snippet to get started: https://www.xano.com/snippet/XwN5GThx