indexof() and lastindexOf() for arrays in javascript

indexof() and lastindexOf()  for arrays  in javascript



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>array</title>


</head>
<body>
<script>
var numb=[1,2,3,4,5,6,7];
var ver=numb.lastIndexOf(3);
if(ver>-1)
{
console.log("Yes it's present and the position is : " + ver);
}
else
console.log("No it's not present");
</script>
</body>
</html>



Comments

Popular posts from this blog