get contents between tags javascript

JavaScript
// Using ES2015+ fat-arrow-function syntax
const getTextOfElement = () => {
  const element = document.getElementById('elementId'); // Get desired HTML element
  console.log(element.textContent); // Get text of element & display in console 
}
Source

Also in JavaScript: