I tend to have a lot of these in my code
if(shouldElementBeVisible)
$element.show()
else
$element.hide()
Is there any more elegant way packaged with javascript, jquery, or underscore? Ideally I want something that looks like this
$element.showOrHideDependingOn(shouldElementBeVisible)
Apparently you can just pass a boolean to the toggle
function
$element.toggle(shouldElementBeVisible)