jQuery isArray() examples

jQuery isArray() function is used to determine whether the argument is an array.


jQuery.isArray( obj )
obj - Object to test whether or not it is an array.


<!doctype html>
<html lang="en">

    <meta charset="utf-8">
    <title>jQuery.isArray demo</title>
    <script src="https://code.jquery.com/jquery-3.4.1.js"></script>


    Is [] an Array? <b id="b1"></b> <br> fruits an Array? <b id="b2"></b><br> obj an Array <b id="b3"></b>

        $("#b1").append("" + $.isArray([]));

        var fruits = ["Banana", "Orange", "Apple", "Mango"];
        $("#b2").append("" + $.isArray(fruits));

        var obj = {};
        $("#b3").append("" + $.isArray(obj));


Is [] an Array? true 
fruits an Array? true
obj an Array false


Free Spring Boot Tutorial - 5 Hours Full Course

Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course