Lodash.js – unzip() function
A simple Lodash.js example of the unzip() function, which creates an array of ungrouped elements by category. It is the opposite of the zip() function.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="Tizen Angular.js example"/>
<title>Tizen lodash.js example</title>
<script src="js/lodash.min.js"></script>
</head>
<body>
<div id="first">
</div>
<br>
<div id="second">
</div>
<script>
var firstDiv = document.getElementById('first');
var secondDiv = document.getElementById('second');
var firstValue = [['Tony', 42, 'passed'], ['Andrew', 19, 'failed'], ['Bart', 31, 'passed']];
firstDiv.innerHTML = "Having the arrays: " + firstValue[0] + " and " + firstValue[1] + " and " + firstValue[2] + " and using the lodash unzip function, we will create an array of ungrouped elements by category and invoke an operation in it in the second parameter...";
var result = _.unzip(firstValue);
secondDiv.innerHTML = "...so we get 3 arrays of grouped values: <br><br>" + result[0] + "<br>" + result[1] + "<br>" + result[2];
</script>
</body>
</html>