I want to check if an object has only one property or only two properties and no other property in javascript.
Suppose I have an object like this.
const obj1 = {
a : 'something'
}
OR
const obj2 = {
a : 'somthing',
b : 'somthing else'
}
Now how do I check if obj1 has only a and no other property? Also, how do check if obj2 has only a and b and no other property? Thanks for your time