Skip to main content

Command Palette

Search for a command to run...

Arrays-Static Methods

Updated
•1 min read•View as Markdown
Arrays-Static Methods
M

Hello all,

I am Manasa, I was a Mechanical Engineer for 2 years and embarked on my career in Front-end-web development from 2022. Looking forward to sharing the content that I have grasped through my experience and learnings on this platform.

  • Array.from(): Array.from() returns an array from any iterable object.We can only use it as Array.from() we if use something like below example array will return undefined. So in the below example we have declared a string to a let variable and using Array.from() method we can be able to return an array.

image.png

  • Array.isArray(). It is also one of the static methods helps in finding the given object is Array or not. Array.isArray() returns true if an object is an "Array". Otherwise false. Please see two below examples for clear understanding.

image.png image.png

  • Array.of()

The Array.of() method creates a new Array instance from a variable number of arguments, regardless of number or type of the arguments.

image.png

image.png

More from this blog

All about Front End Development

12 posts