Challenge Bonfire: Everything Be True has an issue.
User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.
Issue:The description states that we have to check if the property in the second argument is present for each object in the collection.However,this isn't sufficient.What you also require is that the values should match.
The following code checks if the property in second arg is existing for each of the objects but not their values.As a result,it doesnt pass.
My code:
function every(collection, pre) {
// Does everyone have one of these?
var pre_prop;
var obj1=1;
if (typeof(pre) == 'object')
{
pre_prop=Object.getOwnPropertyNames(pre);
}
else
{
pre_prop=[];
pre_prop.push(pre);
obj1=0;
}
for (var i=0;i<collection.length;i++)
{
for (var j=0;j<pre_prop.length;j++)
{
if (!collection[i].hasOwnProperty(pre_prop[j]))
{
return false;
}
}
}
return true;
}
every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}],{'sex': 'female'});
Challenge Bonfire: Everything Be True has an issue.
User Agent is:
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36.Please describe how to reproduce this issue, and include links to screenshots if possible.
Issue:The description states that we have to check if the property in the second argument is present for each object in the collection.However,this isn't sufficient.What you also require is that the values should match.
The following code checks if the property in second arg is existing for each of the objects but not their values.As a result,it doesnt pass.
My code: