How to use jquery to add selected to the corresponding option? Option is selected by default based on the current date

<select name="year" id="year">
    <option value="2017" >2017</option>
    <option value="2018" >2018</option>
    <option value="2019" >2019</option>
</select>
var datetime = new Date();
datetime.setTime(time);
var year = datetime.getFullYear();
var y = document.getElementById("year").value;

now that I have the current year, how can I automatically add selected to the above option based on the current value?
to learn the vue, now to set up a separate page, to let jquery write, only contact yesterday, many of the writing can not, please teach me, thank you

Jun.20,2022

use val () method

$(function (){
    var datetime = new Date();
    var year = datetime.getFullYear();

    // id=yearselectjQuery
    var $year = $("-sharpyear");
    // selectval()inputselecttextarea
    $year.val(year);
});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ffc5-4151a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ffc5-4151a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?