.DS_Store
# understand-javascript-arrays
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Plunker</title>
</head>
<body>
<div id="output"></div>
<script src="script.js"></script>
</body>
</html>
// Array.prototype.sort();
var lessons = [
{
title: 'Javascript Array methods in depth - concat',
views: 1000
},
{
title: 'Javascript Array methods in depth - slice',
views: 1050
},
{
title: 'Javascript Array methods in depth - join',
views: 1025
}
];
var list = lessons
.sort((a, b) => b.views - a.views)
.map(x => ` <li>${x.title} (${x.views})</li>`)
.join('\n');
var output = `<ul>\n${list}\n</ul>`;
var container = document.querySelector('#output');
container.innerHTML = output