今天我第一次接触到JS语法。在 Microsoft MSSQL client for nodeJS有这个例子:
const sql = require('mssql')
async () => {
try {
// make sure that any items are correctly URL encoded in the connection string
await sql.connect('mssql://username:password@localhost/database')
const result = await sql.query`select * from mytable where id = ${value}`
console.dir(result)
} catch (err) {
// ... error checks
}
}
这行的含义是什么:
await sql.query`select * from mytable where id = ${value}`
看起来像query
是 sql
上的一个方法对象,但如何才能这样调用它呢?这个附加的内插字符串是否作为参数传递?这个 JS 功能的名称是什么?
最佳答案
关于javascript - 不带括号调用JS函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63154843/