Sobes.tech
Intern — Middle

Removing null and undefined properties from an object

livecode

Task condition

Create a utility function that takes an object and returns a new object with properties removed where the values are null or undefined.

  • The object may contain properties of any type.
  • Types should be specified for both input and output.
// Example:
// input
{
  a: 'test',
  b: 23,
  c: null,
  d: undefined
}

// output
{
  a: 'test',
  b: 23
}