get body element javascript code example
Example 1: reference body js
var body = document.getElementsByTagName("BODY")[0]; //bad way
document.body //good way
Example 2: javascript find document body
const body = document.body;
var body = document.getElementsByTagName("BODY")[0]; //bad way
document.body //good way
const body = document.body;