Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to get first element of an array in javascript

var items = ["Item 1", "Item 2", "Item 3"];
var firstItem = typeof items[0] !== "undefined" ? items[0] : null;

console.log(firstItem);
 
PREVIOUS NEXT
Tagged: #How #element #array #javascript
ADD COMMENT
Topic
Name
1+2 =