Skip to content

Instantly share code, notes, and snippets.

@tripdog
Last active June 12, 2021 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripdog/1176b0a853589139eeaf2f16eea90318 to your computer and use it in GitHub Desktop.
Save tripdog/1176b0a853589139eeaf2f16eea90318 to your computer and use it in GitHub Desktop.
Template Literals (parameters)

Passing Parameters To Fields In Template Literals

function dog_years(name, age) {
    return `${name} you are ${age*7} years old`
}
console.log(dog_years("lola", 16))

//passing names into fields (Bond, James Bond)
function introduction(first, last) {
    return `${last}, ${first} ${last}`
}
console.log(introduction("James", "Bond"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment