Last active
September 14, 2019 23:26
-
-
Save paigen11/a6ddf1e20e558768b4931a68336ac630 to your computer and use it in GitHub Desktop.
Template expression placeholder example
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 authorize(user, action) { | |
if (!user.hasPermission(action)) { | |
throw new Error( | |
`User ${user.name} is not allowed to ${action}.` | |
); | |
} | |
} | |
const person = { | |
name: "Sean" | |
}; | |
const activity = "bake"; | |
console.log(authorize(person, activity)); // "User Sean is not allowed to bake." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment