Tech Junkie Blog - Real World Tutorials, Happy Coding!: JavaScript Array Methods: Array.isArray() Method

Monday, December 27, 2021

JavaScript Array Methods: Array.isArray() Method

The Array.isArray() method is a useful method to determine object is of type array.  Let's demonstrate with some code.

    <script>
        var oilPrices = [70.15, 69.50, 71.23, 74.32, 69.50, 76.99];
        var iamObject = new Object();

        console.log(Array.isArray(oilPrices));
        console.log(Array.isArray(iamObject));
    </script>

The code above tests to see if the oilPrices array is of type array which it is, and then it tests to see iamObject is an array.  The console.log out put should return true, and the second console.log should return false.












5 comments:

  1. Evernote (for iOS and Android), Netflix (for iOS and Android).

    ReplyDelete
  2. There is always need of Essay writing services across the globe being the sociology student I was assigned Essay Assignment which had a very short deadline so I needed someone to Do my Essay in order to do the same I needed Essay help from the experts I tried for Greatassignmenthelper.com they are great in their high quality content and on time submission.

    ReplyDelete
  3. Good concept https://bismillahlogistics.com/

    ReplyDelete
  4. Hello! Thank you so much for sharing this useful info about "JavaScript Array Methods: Array.isArray() Method"! But are you really in need of help from writing agency and asking a question like: Who can help me with medical case study? So, there are smart writers working at this super company. I have always used their services for writing my essays. It is very nicely and one of the most cheapest agencies I have ever found for all types of my articles!!

    ReplyDelete

Search This Blog