how to get an element by id in javascript

JavaScript
var element = document.getElementById("YourElementId");document.getElementById("YourElementId");document.getElementById("some_id");const element = document.getElementById('id');
//or
const element = document.querySelector('#id');var myElement=document.getElementById("someElementID");document.getElementById("IdGoesHere");
Source

Also in JavaScript: