Is it possible to create a variable for field_key?

I am updating a couple of fields in my db based on other field values. I would like to replicate this code across each page in my site with fields for customers (20+ …helping users build a book).

In order to clean up my code, I would like to create a variable where I can inset the field_key I’m targeting for that particular form. Is there a way to do this?

Example below (I only want to update currentPrompt and AnsweredPrompt across pages and let the button6_click function remain unchanged)

import wixData from 'wix-data';
import wixUsers from 'wix-users';
let userId = wixUsers. currentUser. id;
let currentPrompt = "p3HavingYouWasImportantToUsBecause";
let AnsweredPrompt = "p3AnsweredPrompt";

export function button6_click(event) {
    .eq("_owner", userId)
    .then( (results) => {
 let items = results. items;
 let item = items[0];
 let promptField = item. currentPrompt;
 let ansQ = item. AnsweredPrompt;
        console. log(items);
 if(promptField. length > 0) {
 let toUpdate = {
     "_owner": userId,
     "p3AnsweredPrompt": ansQ===undefined?1:ansQ+1,
            console. log(toUpdate);
 // wixData. save("News", toUpdate);
    } );

**It would be even better if I could grab the target of my input or textbox (which are connected to the correct field via dataset on my page) and use those as my variables.