Home > Article > Web Front-end > How to determine if an object is empty in vue.js
vue.js method to determine if an object is empty: 1. Convert the object to JSON. If it is an empty collection [{}], then it is an empty object; 2. Determine the length of the object. If it is zero, then it is Empty object.
The operating environment of this tutorial: windows10 system, vue2.9, this article is applicable to all brands of computers.
【Recommended related articles: vue.js】
vue.js method to determine if an object is empty:
Method 1: Convert the object to JSON. If it is an empty collection {}, then it is an empty object.
JSON.stringify(object)=='{}'
Method 2: Determine the length of the object. If it is zero, it is an empty object.
Object.keys(object).length==0
Related free learning recommendations: JavaScript (video)
The above is the detailed content of How to determine if an object is empty in vue.js. For more information, please follow other related articles on the PHP Chinese website!