News for hackers. Stuff that matters.
Re:Ask HN: Is web programming a series of hacks on hacks? by tonyarkles on Monday September 12, 2016 @10:12PM (#12485180)
Very cool! In that example though... where's the array? And don't backticks do string interpolation?
Re:Ask HN: Is web programming a series of hacks on hacks? by sime2009 on Tuesday September 13, 2016 @03:37AM (#12486236)
Backticks by themselves will do string interpolation. But backticks with a function name in front will do something a bit different. In this case 'sql.query' is a function and the JS will pass it an array which represents the contents of the backtick string. There the function can do what it likes and return a result. 'sql.query' builds a proper (and safe!) SQL query and executes it.

The backtick feature in ES2015 is really cool and allows for some great DSL type features.

Re:Ask HN: Is web programming a series of hacks on hacks? by alxndr on Tuesday September 13, 2016 @11:47AM (#12489331)
This feature is apparently called "tagged template strings"; more on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re:Ask HN: Is web programming a series of hacks on hacks? by tonyarkles on Friday September 16, 2016 @08:42PM (#12518470)
Neat! Thanks for the awesome explanation!