How to check all properties of an object whether null or empty?

后端 未结 9 1316
星月不相逢
星月不相逢 2020-11-28 06:41

I have an object lets call it ObjectA

and that object has 10 properties and those are all strings.

 var myObject = new {Property1=\"\",P         


        
9条回答
  •  粉色の甜心
    2020-11-28 07:07

    No, I don't think there is a method to do exactly that.

    You'd be best writing a simple method that takes your object and returns true or false.

    Alternatively, if the properties are all the same, and you just want to parse through them and find a single null or empty, perhaps some sort of collection of strings would work for you?

提交回复
热议问题