We are updating/inserting on multiple tables that each has the same basic fields with a prefix.
We want to use variables to change the column names.
e.g. db.friends.update(2, {name: "Number 2"})
we would like to use the column "name" as a variable
would this please be possible
thanx
In modern javascript dynamic property names can be specified around brackets as the following example:
async function updateField(id, fieldName, fieldValue) {
await db.friends.update(id, {[fieldName]: fieldValue});
}