scrimba
Clean Code
Clean Functions: Encapsulating Conditionals (Challenge)
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Clean Functions: Encapsulating Conditionals (Challenge)
AboutCommentsNotes
Clean Functions: Encapsulating Conditionals (Challenge)
Expand for more info
index.js
run
preview
console
// Clean Code: Encapsulating Conditionals Challenge

function getLoadingState(state) {
if(!!state.user && state.loading === false && state.hasError === false) {
return 'Finished Loading';
}

if(state.user === null && state.loading === true && state.hasError === false) {
return 'Loading...';
}

return 'Error occured';
}
Console
/index.html
-2:24