Open kartamyshev opened 4 years ago
const student = {
name : "David Rayy",
sclass : "VI",
rollno : 12
};
function checkTheProp (obj, prop) {
let key = prop;
return (key in obj);
}
describe ("CheckTheProp ", function() {
it("should return true if the object contains given property", function() {
assert.equal(checkTheProp(student, "name"), true);
});
it("should return false if the object does not contain the property", function() {
assert.equal(checkTheProp(student, "adress"), false);
});
});
Example: