Custom script to preview the user data in a custom code block

Place this in your custom code block and preview

<div id="user-data"></div>
<script>
window.addEventListener('DOMContentLoaded', () => {
        if(window.logged_in_user) {
            let userData = document.createElement('span').innerTex = window.logged_in_user;
            let container = document.getElementById('user-data');
            let ul = document.createElement('ul');
            for (let key in userData) {
                  if (userData.hasOwnProperty(key)) {
                    var li = document.createElement('li');
                    li.innerHTML = '<strong>' + key + ':</strong> ' + userData[key];
                    ul.appendChild(li);
                  }
                }
            container.appendChild(ul);
        }   
});
</script>