Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Check if the value exists in Array in Javascript

var army= ["Marcos", "DeltaForce", "Seals", "SWAT", "HeadHunters"];  
  
if(army.indexOf("Marcos") !== -1)  {  
  console.log("Yes, the value exists!")  
}else{  
  console.log("No, the value is absent.")  
}  
Source by www.javatpoint.com #
 
PREVIOUS NEXT
Tagged: #Check #exists #Array #Javascript
ADD COMMENT
Topic
Name
3+3 =