How to remove "integer" array from object in JavaScript

toretto24

I got this input

    var input=[ "Axel",
                4,
                4.21,
                { name : 'Bob', age : 16 },
                { type : 'fish', model : 'golden fish' },
                [1,2,3],
                "John",
                { name : 'Peter', height: 1.90}          ];

and the Result must be this one

    [ { name : 'Bob', age : 16 },
      { type : 'fish', model : 'golden fish' },        
      { name : 'Peter', height: 1.90}            ];
Paul S.

Using Array.prototype.filter, only keep Objects which are not Arrays

var input = ["Axel",
    4,
    4.21,
    {name: 'Bob', age: 16},
    {type: 'fish', model: 'golden fish'},
    [1, 2, 3],
    "John",
    {name: 'Peter', height: 1.90}
];

input = input.filter(function (e) {
    return (typeof e === 'object') && !Array.isArray(e);
}); /*
[
    {"name": "Bob", "age": 16},
    {"type": "fish", "model": "golden fish"},
    {"name": "Peter", "height": 1.9}
]
*/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to remove duplicate object based on condition from an array of object in javascript

From Dev

Remove array from javascript object

From Dev

remove an object from an object array in javascript

From Dev

how to remove duplicated object (string)from an array in JavaScript

From Javascript

How do I remove an object from an array with JavaScript?

From Dev

How can i remove nested or parent object from array in javascript

From Dev

How to remove specific key and value from array object in javascript?

From Dev

How to remove a default generated object from an array of objects in javascript

From Dev

How do I remove properties from JavaScript object in array?

From Dev

How to Remove a specific items attributes from nested array of object in javascript

From Dev

Remove entire object from a json array javascript

From Dev

Javascript fastest way to remove Object from Array

From Dev

Remove empty object from an array javascript

From Dev

Remove multiple object from array Javascript

From Javascript

Remove Object from Array using JavaScript

From Dev

remove and replace item from object in array javascript

From Dev

In Javascript remove keys from object not in an Array

From Dev

Javascript Remove object from array not removing the selected

From Dev

How to remove object from object of objects in javascript

From Dev

how to remove array from another array in javascript

From Dev

How to remove array from array using Javascript?

From Dev

How to remove duplicates from the array of array in javascript?

From Dev

Javascript - How do i remove a covering/wrapper object from an array of object

From Dev

How to Remove Duplicate Value From Array of object And Update Object Property Using JavaScript

From Dev

How to remove elements from nested object array?

From Dev

How to remove an empty object from an array?

From Dev

How to remove properties from an object array?

From Dev

How to remove a object from an array in react hook

From Javascript

How to remove an object from an array in Immutable?

Related Related

  1. 1

    How to remove duplicate object based on condition from an array of object in javascript

  2. 2

    Remove array from javascript object

  3. 3

    remove an object from an object array in javascript

  4. 4

    how to remove duplicated object (string)from an array in JavaScript

  5. 5

    How do I remove an object from an array with JavaScript?

  6. 6

    How can i remove nested or parent object from array in javascript

  7. 7

    How to remove specific key and value from array object in javascript?

  8. 8

    How to remove a default generated object from an array of objects in javascript

  9. 9

    How do I remove properties from JavaScript object in array?

  10. 10

    How to Remove a specific items attributes from nested array of object in javascript

  11. 11

    Remove entire object from a json array javascript

  12. 12

    Javascript fastest way to remove Object from Array

  13. 13

    Remove empty object from an array javascript

  14. 14

    Remove multiple object from array Javascript

  15. 15

    Remove Object from Array using JavaScript

  16. 16

    remove and replace item from object in array javascript

  17. 17

    In Javascript remove keys from object not in an Array

  18. 18

    Javascript Remove object from array not removing the selected

  19. 19

    How to remove object from object of objects in javascript

  20. 20

    how to remove array from another array in javascript

  21. 21

    How to remove array from array using Javascript?

  22. 22

    How to remove duplicates from the array of array in javascript?

  23. 23

    Javascript - How do i remove a covering/wrapper object from an array of object

  24. 24

    How to Remove Duplicate Value From Array of object And Update Object Property Using JavaScript

  25. 25

    How to remove elements from nested object array?

  26. 26

    How to remove an empty object from an array?

  27. 27

    How to remove properties from an object array?

  28. 28

    How to remove a object from an array in react hook

  29. 29

    How to remove an object from an array in Immutable?

HotTag

Archive