Lodash.js – includes() function
A simple Lodash.js example of the includes() function, we will check if the provided value is present in the collection.
<!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 = [3,2,'Paris',4,'Marseilles',8, true, 'Orange'];
firstDiv.innerHTML = "Having the array: " + firstValue + " with the includes function we will check if the provided value is present in the collection...";
var result = _.includes(firstValue, 'Orange');
secondDiv.innerHTML = "...so, is the value 'Orange' in the collection? --> " + result;
</script>
</body>
</html>