'hide element id with CSS and JavaScript based on data in console.log

I am trying to use an entry in console.log to determine if an element is to be hidden based on whether the console shows it as null/undefined or if it has data.

I want this to happen as the page loads

I thought what I had would work as similar code worked elsewhere to grab the data and display it on a page. not sure what I am missing, appreciate the help.

document.getElementById("learner") 
if (.window.loggedInUser.tiUserId == null) {
  style.display = 'none';
} else {
  style.display = 'block';
}
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source