Converting a state from hash into a JavaScript object This code gets a state from a query string hash part, converts the hash part to a JavaScript object and then tries to get a view, dashboard or a mode value. If those keys are not present in object, it returns $.pulse.qs.views.home.

Does this JavaScript code with ternary operator follow common best practices? It looks like ternary operator abuse and it is not readable. Or is it just me?

var state = $.query.getState();
var screen = state[$.pulse.qs.view]
    ? state[$.pulse.qs.view]
    : state[$.pulse.qs.dashboard] || state[$.pulse.qs.mode]
        ? $.pulse.qs.views.dashboard
        : $.pulse.qs.views.home;
I think a good practice is to name what you mean, cause that makes the code more readable. So I would create a var for each state and grap a good name: stateOfViewAvailable ...