I am trying to do something like this;
var fieldName = 'name';
if ((await db.friends.where({ ${fieldName}: 'Josephine'}).count()) === 0) {
        const id = await db.friends.add({name: "Josephine", age: 21});
        alert (`Addded friend with id ${id}`);
    }
Is the any way to do this thing in Javascript? Thanks
 
    