head
is a function in the Underscore library that returns the first element of an array. Here's how to use it:
index.tsx362 chars12 lines
In this example, we created an array called myArray
, and passed it to the head
function. The function returned the first element of myArray
(which is 1
), and we stored it in the firstElement
variable.
Finally, we logged the result to the console using console.log()
.
gistlibby LogSnag