Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by rriley

2 days ago

Niiice! I finally understand the origin of this JS syntax used in SQL queries and GraphQL:

sql`SELECT * FROM users WHERE id = ${userId}`

const q = gql` query GetUser { user(id: ${userId}) { name email } } `;

1 comment

rriley

Reply

jazzypants  1 day ago

They're called "tagged template literals". Here's the docs:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities