Tim Williams
Feb 23, 2022

There's a pretty big issue here, in that you've overlooked the most common type of object. An object with object properties. For instance:

This shows a correct return, but it's not why you expect.

```

compareObject({a: {one: 'awesome'}}, {a: {one: 'not awesome'}})

```

This shows an incorrect return, these objects are the same.

```

compareObject({a: {one: 'awesome'}}, {a: {one: 'awesome'}})

```

What you've created is a shallow object comparer, and that should be reflected in the function name, or you should modify the function to work recursively.

Tim Williams
Tim Williams

Written by Tim Williams

I am a Web Developer passionate about new technologies, as well as time tested best practices (here’s looking at you Uncle Bob).

Responses (1)