Answers for "first item in array that"

PHP
6

php get first element of array

$colors = array(2=>"blue",3 =>"green",1=>"red");
$firstValue = reset($colors); //blue
$firstKey = key($colors); //2
Posted by: Guest on October-30-2019
4

javascript get first element of array

let array = [1,2,3] // makes your array
array[0] // returns first element of your array.
Posted by: Guest on June-16-2020

Code answers related to "first item in array that"

Browse Popular Code Answers by Language