SyntaxFix
Write A Post
Hire A Developer
Questions
You can do it by lodash _.head so easily.
_.head
var arr = ['first', 'second', 'third', 'fourth', 'fifth'];_x000D_ console.log(_.head(arr));
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js"></script>