hasContact() function
cjuhong opened this issue · comments
cjuhong commented
var hasContact = function(account, contactId) {
if ( null == account.contacts ) return false;
account.contacts.forEach(function(contact) {
if ( contact.accountId == contactId ) {
return true;
}
});
return false;
};
in chapter08, the hasContact function would never return true!!!
cjuhong commented
the forEach method is not suitable for this situation.