isConnected

Returns true if node is connected and false otherwise.

MDN Reference