Classifying connectivity status based on online and connected status of multiple nodes I need to determine the status of a parent object based on 2 variables of each of its children. I came up with a working solution, but this includes a nested "if-else if-else". Needless to say, it doesn't look very elegant. 

I was wondering if there is a way to simplify this. I have muddled around with some map/reduce code, but did not get to anything that is more elegant than the code below. 



const parent = {
  children: [{
      connected: true,
      online: true

    },
    {
      connected: true,
      online: true
    }
  ]
}


// all online &amp; all connected  =&gt; connected
// all online &amp; some connected =&gt; partially disconnected
// all online &amp; none connected =&gt; disconnected
// some online =&gt; partially offline
// none online =&gt; offline

const onlineArr = parent.children.map(c =&gt; c.online);
const connectedArr = parent.children.map(c =&gt; c.connected);
let status;

if (!onlineArr.includes(true)) {
  status = 'Offline';
} else if (!onlineArr.includes(false)) {
  if (!connectedArr.includes(true)) {
    status = 'Disconnected';
  } else if (!connectedArr.includes(false)) {
    status = 'Connected';
  } else {
    status = 'Partially disconnected';
  }
} else {
  status = 'Partially offline';
}

console.log(status);
As a function
When you write code, even as an example, always write it as a function. A function is returnable, and thus can be written differently than non returnable flat execution.
Comment code mismatch

&quot;Comments are just lies in waiting.&quot;
...by unknown guru.

Your comments do not match the code. The comments specify lowercase status, your code capitalists the status. Which is correct is anyone's guess. I will assume the comments are correct and that the status is formatted upon display. (It makes the solution simpler) Changed my mind and will assume the code has been tested and is correct.
Inefficiency === Inelegance
The nested statements are not inelegant (in a function it would not need any else statements), its the two Array.map and three Array.includes that are very inefficient for the task at hand, which to me is ugly inelegance.
Solution
It is the number of online, connected children that you need to know.
If the number of online children

is the same as the number of children then all are online.
is the less than as the number of children and not zero then some are online.
is zero then none are online

The same applies for connected children.
Thus count the two types and use the counts to return the status, as follows
function connectionStatus(clients) {
    const count = clients.length;
    var onC = 0, conC = 0;   
    for (const {connected, online} of clients) {
        conC += connected;
        onC += online;
    }
    if (onC === count) {
        if (conC === count) { return &quot;Connected&quot; }
        return conC ? &quot;Partially disconnected&quot; : &quot;Disconnected&quot;;
    }
    return onC ? &quot;Partially offline&quot; : &quot;Offline&quot;;
}

connectionStatus(parent.children);