JavaScript Template Literal and Function Self Invoked
ztl2
Self Invoked Function
Function Invocation
and Self Invoked
Resources
Codepen Demo 2 |
* Wes Bos Teplate Strings * |
JavaScript Code
(function () {
let user = {
'name': 'Robert L. Gorman',
'url': 'http://robertlgorman.com',
'role': 'web developer',
'birthMonth': 'September'
}
const {
name,
url,
role,
birthMonth
} = user;
const html = `
- Name: ${name}
- URL: ${url}
- Role: ${role}
- Birth month: ${birthMonth}
`;
let navigation = document.getElementById('nav');
navigation.innerHTML = html;
})();
JSON Example
JSON Simple
Example