Code Input Values

I am trying to create an if statement that will allow to input values to equal each other and pull data from the dataset. For example, if there is an if statement that has the trigger as image onviewport with the event if input 1 = input 1 it would trigger input value 1 to equal a specific box in the dataset, such as input value 1 would equal title from column 1 in dataset. This is the code I have done so far and the page accepts but does not run it. Can anyone assist?

export function button1_click ( event ) {
if ( $w ( “#input1” ). value === “Test” )
wixData . query ( ‘DeskTest’ )
. contains ( ‘title’ , ‘$w(“#input1”).value’ )
. contains ( “subject” , “Test” )
. find ()
. then (( results ) => {
if ( results . totalCount > 0 ) {
$w ( “#image1” ). src = results . items [ 0 ]. image ;
}
})
}

Hello friend, your mistake seems to be at the last if, it should be:

if (results.length > 0) {
        $w("#image1").src = results.items[0].image
}