Last active
September 15, 2019 00:41
-
-
Save paigen11/068547ee78d032c281f1ecbed58cb549 to your computer and use it in GitHub Desktop.
Creating nested template strings in ES5 without template literal assistance.
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
var classes = 'header'; | |
function isDesktopSize(){ | |
window.innerWidth > 1400 ? true : false; | |
}; | |
var navbar = { | |
isOpen: false | |
}; | |
classes += (isDesktopSize() ? | |
'' : navbar.isOpen ? | |
' collapse-navbar' : ' expand-navbar'); | |
console.log(classes); | |
// prints: header expand-navbar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment