This method checks whether an object or string is array or not. We can use this method same as native JavaScript. Here in this tutorial, we are going to explain how to check an object is array or not. You can use our online editor to edit and run the code online.
Vue.js check if Object is Array Example
You can check that an object is array or not simply as below-
Example:
<div id="app"> <p>item 1 = {{ item1 }}</p> <p>Result = {{result}}</p> <button>Click Me</button> </div> |
The above function returns true if an object is array else it will return false.
Output of above example-