Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

catch the last item in a array js

function(code){
 	let lastItemArray = ''
  	console.log(code)
  	for(let i = 0; i < code.length; i++){
      if(i == code.length - 1)
      {
        lastItemArray = code[i]
      }
	}
  	return lastItemArray
}
console.log([1,2,3,4,5])
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #catch #item #array #js
ADD COMMENT
Topic
Name
8+5 =