Skip to content

Instantly share code, notes, and snippets.

@paigen11
Last active September 14, 2019 23:26
Show Gist options
  • Save paigen11/a6ddf1e20e558768b4931a68336ac630 to your computer and use it in GitHub Desktop.
Save paigen11/a6ddf1e20e558768b4931a68336ac630 to your computer and use it in GitHub Desktop.
Template expression placeholder example
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