freeCodeCampBeta - Use the delete Keyword to Remove Object Properties - bug?

Hello,
link: https://beta.freecodecamp.org/en/challenges/basic-data-structures/check-if-an-object-has-a-property

Ok so i’m having a bug. Code not working:


let users = {
	Alan: {
		age: 27,
		online: true
	},
	Jeff: {
		age: 32,
		online: true
	},
	Sarah: {
		age: 48,
		online: true
	},
	Ryan: {
		age: 19,
		online: true
	}
};

function isEveryoneHere(obj) {
	for( let name in obj ) {
		if( obj[name].online == false ) {
			return false;
		}
	}
	
	return true;
};

console.log(isEveryoneHere(users));

The users object only contains the keys Alan, Jeff, Sarah, and Ryan OK
The function isEveryoneHere returns true if Alan, Jeff, Sarah, and Ryan are properties on the users object OK
The function isEveryoneHere returns false if Alan, Jeff, Sarah, and Ryan are not properties on the users object NOT OK

And some thing is strange in the explanation. It say basicaly “every thing is true at the online key and if it’s not, return false”… But in the text at the end, it speak about “properties” and not the “value of the properties”.

So the property “online” have to exist AND have to be true everywhere at the same time to return true ?
If it is the case, it’s very badly explained.

thx yoo

The question doesn’t ask you to check if each user has an online property or if its value is true, it asks you to check that the object users has a property Alan, a property Jeff, a property Sarah and a property Ryan.

Pfff, yes :slight_smile: Completly missreaded the shit of this exercice. I extrapoled that he spoke about the online property

edit:

So basicaly, i just had to do it like this:


let users = {
	Alan: {
		age: 27,
		online: true
	},
	Jeff: {
		age: 32,
		online: true
	},
	Sarah: {
		age: 48,
		online: true
	},
	Ryan: {
		age: 19,
		online: true
	}
};

function isEveryoneHere(obj) {
	if( obj.hasOwnProperty("Alan", "Jeff", "Sarah", "Ryan") ) {
		return true;
	
	}else {
		return false;
	}
};

console.log(isEveryoneHere(users));