<!DOCTYPE html>
<html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<body>
<select>
<option value="0">Value1</option>
<option value="1">Value2</option>
</select>
<script>
let text = 'Value2';
$("select option").filter(function() {
//may want to use $.trim in here
return $(this).text() == text;
}).prop('selected', true);
</script>
</body>
</html>