Tutorialsplane

Vue.js check variable is array or object


You can check whether a variable is array or object using native JavaScript typeOf check. Here in this tutorial, we are going to explain how you can use this check in vue.js to decide if variable is array or object.


Vue.js check variable is array or object JavaScript Example

You can check variable is object or array in Vue.js simply as below-

Example:

<div id="app">
	<p>Result 1 = {{result1}}</p>
	<p>Result 2 = {{result2}}</p>
	<button>Click Me</button>
</div>
 

Try it ยป

Output of above example-