How to Replace Object With Named Parameters in ES6 ( Error handing of undefined in JavaScript )

function loadProfiles(userNames = [],  {profilesClass, reverseSort} = {}) {
   profilesClass = profilesClass || ".user-profile";
   reverseSort   = reverseSort   || false;

  if (reverseSort) {
    userNames = _reverse(userNames);
  }

  _loadProfilesToSideBar(userNames, profilesClass);
}

No comments:

Post a Comment