Modern browsers support the Array.isArray(obj)
method.
See MDN for documentation and a polyfill.
= original answer from 2008 =
you can use the constuctor property of your output:
if(output.constructor == Array){
}
else if(output.constructor == Object){
}
More Related Contents:
- What is the purpose of a self executing function in javascript?
- Can a website detect when you are using Selenium with chromedriver?
- How to distinguish between left and right mouse click with jQuery
- How do I iterate over a JSON structure? [duplicate]
- Difference between setTimeout with and without quotes and parentheses
- How to build PDF file from binary string returned from a web-service using javascript
- JSON datetime between Python and JavaScript
- Is there an equivalent of the __noSuchMethod__ feature for properties, or a way to implement it in JS?
- Completely removing duplicate items from an array
- Export javascript data to CSV file without server interaction
- How to make a browser display a “save as dialog” so the user can save the content of a string to a file on his system?
- replace all occurrences in a string [duplicate]
- How do I split a string into an array of characters? [duplicate]
- What Javascript Template Engines you recommend? [closed]
- How can I make event.srcElement work in Firefox and what does it mean?
- HTML comments in a javascript block?
- Have just one InfoWindow open in Google Maps API v3
- How to move table row in jQuery?
- How do you save an image from a Three.js canvas?
- update cloud firestore document without id
- How to make one Observable sequence wait for another to complete before emitting?
- How can I see the source of built-in JavaScript functions? [closed]
- How to send cookies with node-fetch?
- The most accurate way to check JS object’s type?
- How to create a string or char from an ASCII value in JavaScript?
- How to use Qt WebEngine and QWebChannel?
- Proper way to catch exception from JSON.parse
- Fire oninput event with jQuery
- Phantom JS synchronous AJAX request : NETWORK_ERR: XMLHttpRequest Exception 101
- Want to have an event handler for the browser’s back button with next.js