isArray tutorial in JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>isArray JavaScript</title>
<script>
var a = ["Sanjay", "Aman", "Rehman"];
document.write(a + "<br><br>");
var b = Array.isArray(a);
document.write(b + "<br><br>");
var c = 10;
var d = Array.isArray(c);
document.write(d + "<br><br>");
var e = "Rahul";
var f = Array.isArray(e);
document.write(f + "<br><br>");
if (Array.isArray(a) == true) {
document.write("a is an Array<br>");
}
else {
document.write("a is not an Array<br>");
}
if (Array.isArray(c) == true) {
document.write("c is an Array<br>");
}
else {
document.write("c is not an Array<br>");
}
if (Array.isArray(e) == true) {
document.write("e is an Array<br>");
}
else {
document.write("e is not an Array<br>");
}
</script>
</head>
<body>
</body>
.png)
.png)
Comments
Post a Comment