---
title: "Discussion on \"Convert undefined keys to null using array.reduce()\" | Hashnode"
description: "Discussion on \"Convert undefined keys to null using array.reduce()\". Hi  👋\nObjective : Convert the undefined keys of an object to null without mutating the original object.\nFocus : Usage of array reduce method.\nLets take the below object as our target - \nconst testObject = {\nname: 'example',\nage: '',\naddress : '',\nci..."
url: "https://hashnode.com/posts/convert-undefined-keys-to-null-using-arrayreduce/5fcbad862e4db7780e4839a9"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Convert undefined keys to null using array.reduce()](https://blog.lalitsheoran.com/convert-undefined-keys-to-null-using-arrayreduce?utm_source=hashnode&utm_medium=feed)

Hi 👋 Objective : Convert the undefined keys of an object to null without mutating the original object. Focus : Usage of array reduce method. Lets take the below object as our target - const testObject = { name: 'example', age: '', address : '', ci...

Dec 5, 2020 · 2 min read · blog.lalitsheoran.com  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#array-methods](https://hashnode.com/tag/array-methods)
-   [#array](https://hashnode.com/tag/array)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#beginners](https://hashnode.com/tag/beginners)

## Written by

[Lalit Sheoran](https://hashnode.com/@lalitsheoran)

@lalitsheoran

  
[View profile](https://hashnode.com/@lalitsheoran)

Software Engineer aka newbie for life 🌱

## Responses 4

Markdown supported · ⌘↵ to post

[Mukund Chandak](https://hashnode.com/@Mukund)

[Dec 28, 2020](https://hashnode.com/posts/convert-undefined-keys-to-null-using-arrayreduce/5fcbad862e4db7780e4839a9/comment/5fe9314600a1104122669dad)

Amazing article lalit...

[Dipanshu Sabharwal](https://hashnode.com/@dipanshu-sabharwal)

[Dec 17, 2020](https://hashnode.com/posts/convert-undefined-keys-to-null-using-arrayreduce/5fcbad862e4db7780e4839a9/comment/5fdb20e4b78ac62dff80940c)

This is really some good information. Hope these articles keep coming.

[Manish](https://hashnode.com/@Manish016)

[Dec 6, 2020](https://hashnode.com/posts/convert-undefined-keys-to-null-using-arrayreduce/5fcbad862e4db7780e4839a9/comment/5fccf18ef4006d0b1bedf9d4)

Crisp and clear.

[Lalit Sheoran](https://hashnode.com/@lalitsheoran)

[Dec 9, 2020](https://hashnode.com/posts/convert-undefined-keys-to-null-using-arrayreduce/5fcbad862e4db7780e4839a9/comment/5fccf18ef4006d0b1bedf9d4#reply-5fd0783e8b007b319dde06c7)

Thanks! Much appreciated

[Rahul](https://hashnode.com/@RAHULISM)

[Dec 5, 2020](https://hashnode.com/posts/convert-undefined-keys-to-null-using-arrayreduce/5fcbad862e4db7780e4839a9/comment/5fcbc024685f4f01c470f262)

JS is just amazing like this post.

[Lalit Sheoran](https://hashnode.com/@lalitsheoran)

[Dec 6, 2020](https://hashnode.com/posts/convert-undefined-keys-to-null-using-arrayreduce/5fcbad862e4db7780e4839a9/comment/5fcbc024685f4f01c470f262#reply-5fcc59bfef5f84019de7977f)

You bet it is ! 🤗
