Last active
September 15, 2019 00:55
-
-
Save paigen11/b1bb276b2bfe2bbb5e036def191e17be to your computer and use it in GitHub Desktop.
Creating a configurable string via ES6 nested template strings
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
function isDesktopSize(){ | |
window.innerWidth > 1400 ? true : false; | |
} | |
var navbar = { | |
isOpen: true | |
}; | |
classes = `header ${ isDesktopSize() ? '' : | |
`icon-${navbar.isOpen ? 'collapse' : 'expand'}` }`; | |
console.log(classes); | |
// prints: header icon-collapse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment