Get the App
SLTechnology News&Howtos  ›  Development  › 

How JavaScript uses the Array.isArray () method

Shulou Source: shulou.com Published: 2022-06-01 02:09:34 10月04日 Update

Editor to share with you how JavaScript uses the Array.isArray () method, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Use the Array.isArray () method

As the name implies, this method can be used to identify whether a given parameter is an array, and it returns a Boolean value (true/false) and the result.

For example, the Array.isArray () method can correctly determine whether it is an array using the following variables:

Let result = {subject: "Science", marks: 97}; / / Objectlet numbers = [1,2,3,4,5]; / Arraylet name = "Mark"; / / Stringlet names = new Array ("Jill", "Jane", "Jacqueline"); console.log (Array.isArray (result)); / / falseconsole.log (Array.isArray (numbers)); / / trueconsole.log (Array.isArray (name)); / / falseconsole.log (Array.isArray (names)) / / true above is all the content of the article "how JavaScript uses the Array.isArray () method". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Methods articles content arrays as the name implies not much parameters variables most Boolean more this method knowledge results industry information information channels channels Siyi Gu name Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Apple vpn Linux Microsoft