Javascript examples for Object:Reflection
Get number of arrays from an object
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// w ww. java 2s . com var data = { Name:['a','b'], Na:['cd','ef'], Age:{a: 12}, Address:{a: 'asdf'} } var numberOfArrays = Object.keys(data).filter(function(key) { return data[key] instanceof Array; }).length; console.log(numberOfArrays); } </script> </head> <body> </body> </html>