Last active
July 18, 2019 17:46
-
-
Save joshnabbott/07745a2ed7e3d744c529f9ad695ded3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Nested ternary | |
const sortConnectorsFunc = (a, b) => | |
// eslint-disable-next-line no-nested-ternary | |
a.connectorName < b.connectorName ? -1 : a.connectorName > b.connectorName ? 1 : 0; | |
// Vs if statement | |
const sortConnectorsFunc = (a, b) => { | |
if (a.connectorName < b.connectorName) return -1; | |
if (a.connectorName > b.connectorName) return 1; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment