Select specific variant option value of a specific option inside product page

Dawn v9

I have two line line item property fields on a product page (buy-buttons-custom.liquid).


  

  

  

  

I created this function (global.js):

function changeoptionvalue(){
    var length = +(document.getElementById("length").value);
    var width = +(document.getElementById("width").value);
    var total = length + width;
    
    if (total<20) {
      selector.selectVariant("44380039577868", selector); //not working
       //here i want to select option value x of option z 
    } else {
      //here i want to select option value y of option z 
    } 
}

How can i code to select a specific option value of a specific option inside a product page?