Skip to content

Instantly share code, notes, and snippets.

@raloliver
Forked from anonymous/index.html
Last active February 26, 2017 13:42
Show Gist options
  • Save raloliver/57fb50cefabe9cf009c31605b3eba715 to your computer and use it in GitHub Desktop.
Save raloliver/57fb50cefabe9cf009c31605b3eba715 to your computer and use it in GitHub Desktop.
JS Bin// source http://jsbin.com/qixotiz
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>listViewUsers</title>
</head>
<body>
<ul data-list></ul>
<script id="jsbin-javascript">
const users = [
{
name: 'Fernanda',
id: '1'
},
{
name: 'Israel',
id: '2'
},
{
name: 'Laura',
id: '3'
},
{
name: 'Ben',
id: '4'
}
]
const listUsers = (user) => {
return user.map((item) => {
return (
`
<li>
<span>${ item.id }</span>
<span>${ item.name }</span>
</li>
`
)
}).join('')
}
const listView = document.querySelector('[data-list]');
listView.innerHTML = listUsers(users)
</script>
<script id="jsbin-source-javascript" type="text/javascript">const users = [
{
name: 'Fernanda',
id: '1'
},
{
name: 'Israel',
id: '2'
},
{
name: 'Laura',
id: '3'
},
{
name: 'Ben',
id: '4'
}
]
const listUsers = (user) => {
return user.map((item) => {
return (
`
<li>
<span>${ item.id }</span>
<span>${ item.name }</span>
</li>
`
)
}).join('')
}
const listView = document.querySelector('[data-list]');
listView.innerHTML = listUsers(users)</script></body>
</html>
const users = [
{
name: 'Fernanda',
id: '1'
},
{
name: 'Israel',
id: '2'
},
{
name: 'Laura',
id: '3'
},
{
name: 'Ben',
id: '4'
}
]
const listUsers = (user) => {
return user.map((item) => {
return (
`
<li>
<span>${ item.id }</span>
<span>${ item.name }</span>
</li>
`
)
}).join('')
}
const listView = document.querySelector('[data-list]');
listView.innerHTML = listUsers(users)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment