DEV Community

fangwei
fangwei

Posted on

Answer: How can I check if an object contains at least one key whose value contains a substring in JavaScript?

You can do this with a recursive function to traverse the entire object. Just make sure that the object doesn't have any circular references...

const user = {
    id: '123abc',
    info: {
        age: 12,
        bio: 'This is my bio' 
    },
    social: {
        chatName: 'Chris',
        friends: ['friend1', 'other

Top comments (0)