---
title: "Discussion on \"Why do you need to know about the JavaScript Array at() method?\" | Hashnode"
description: "Discussion on \"Why do you need to know about the JavaScript Array at() method?\". JavaScript array provides many methods to deal with the data in it. The proposed at(index) method is going to be a game changer. Here is why."
url: "https://hashnode.com/posts/why-do-you-need-to-know-about-the-javascript-array-at-method/60a25e1e23723215ec2ff42d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why do you need to know about the JavaScript Array at() method?](https://blog.greenroots.info/why-do-you-need-to-know-about-the-javascript-array-at-method?utm_source=hashnode&utm_medium=feed)

JavaScript array provides many methods to deal with the data in it. The proposed at(index) method is going to be a game changer. Here is why.

May 17, 2021 · 3 min read · blog.greenroots.info  
Updated Jul 28, 2021  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#array-methods](https://hashnode.com/tag/array-methods)
-   [#programming-tips](https://hashnode.com/tag/programming-tips)
-   [#codenewbies](https://hashnode.com/tag/codenewbies)

## Written by

[Tapas Adhikary](https://hashnode.com/@atapas)

@atapas · Bangalore

  
[View profile](https://hashnode.com/@atapas)

Educator @tapaScript | Founder CreoWis & ReactPlay - Writer - YouTuber - Open Source

Co-Founder, @CreoWis | Teacher, @tapaScript | Founder, @ReactPlay | YouTuber | Writer | Human

## Responses 4

Markdown supported · ⌘↵ to post

[Siddharaj Suryavanshi](https://hashnode.com/@siddhu95)

[May 17, 2021](https://hashnode.com/posts/why-do-you-need-to-know-about-the-javascript-array-at-method/60a25e1e23723215ec2ff42d/comment/60a2aeb53ef3832fdd0f9eb6)

Thanks [Tapas Adhikary](https://hashnode.com/@atapas) for writing this. It was very helpful to know about this method. I am definitely going to use it instead of the conventional methods of accessing array elements.

[Tapas Adhikary](https://hashnode.com/@atapas)

[May 18, 2021](https://hashnode.com/posts/why-do-you-need-to-know-about-the-javascript-array-at-method/60a25e1e23723215ec2ff42d/comment/60a2aeb53ef3832fdd0f9eb6#reply-60a320d1eeabf031a1a956eb)

[Siddharaj Suryavanshi](https://hashnode.com/@siddhu95), Thanks, and glad that it was helpful.

As you had the follow-up questions on Twitter about it, I thought of answering them here to document everything at the same place. Thanks a lot for asking.

[twitter.com/siddharaj\_rs/status/13943508413650903…](https://twitter.com/siddharaj_rs/status/1394350841365090305)

-   I have an input box to accept the index as a number. In the last two marked lines, I am collecting the number from the input box when someone `keyup`, or `change` in it. It will take care of both when someone types in the input box or use the up-down slider to change the number.
    
    Once the number is collected in a variable, I pass the number to a method called `findAtIndex(index)`.
    
-   Inside the `findAtIndex(index)` method, I am first checking if the input in `NaN`. It can happen when you make the input box empty. If it is `NaN`, I am printing a blank output. Else, I am using the `at(index)` method to access it using the index.
    

The number input box and triggering events to access the element using `at()` was purely for demo purposes.

> [js-array-at-method.netlify.app](https://js-array-at-method.netlify.app/)

I hope it is clear now.

[Tapas Adhikary](https://hashnode.com/@atapas)

[May 18, 2021](https://hashnode.com/posts/why-do-you-need-to-know-about-the-javascript-array-at-method/60a25e1e23723215ec2ff42d/comment/60a2aeb53ef3832fdd0f9eb6#reply-60a32216eeabf031a1a956f5)

To answer this,

[twitter.com/siddharaj\_rs/status/13943510008996249…](https://twitter.com/siddharaj_rs/status/1394351000899624962)

As the `at(index)` method is in the proposal now and not added to the JavaScript language yet, we can only use it with the help of a Polyfill.

As the Polyfil I am using is available as an NPM, I have installed it and imported it for using the `at()` method.

The beauty of it is, if there is support of it in JavaScript language in the future, you can just remove that import from the code along with the polyfill entry from the `package.json` file. That's it.

I have mentioned the polyfill above under the section, "The at(index) method is Brand New".

Thanks a lot for asking and discussing.

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[May 17, 2021](https://hashnode.com/posts/why-do-you-need-to-know-about-the-javascript-array-at-method/60a25e1e23723215ec2ff42d/comment/60a29bd795a5b03004409db1)

Nice addition. Thanks for the information [Tapas Adhikary](https://hashnode.com/@atapas)

[Tapas Adhikary](https://hashnode.com/@atapas)

[May 18, 2021](https://hashnode.com/posts/why-do-you-need-to-know-about-the-javascript-array-at-method/60a25e1e23723215ec2ff42d/comment/60a29bd795a5b03004409db1#reply-60a324a3eeabf031a1a95707)

Thanks [Yogesh Chavan](https://hashnode.com/@myogeshchavan97).

[Favourite Jome](https://hashnode.com/@Favourite)

[May 17, 2021](https://hashnode.com/posts/why-do-you-need-to-know-about-the-javascript-array-at-method/60a25e1e23723215ec2ff42d/comment/60a277e4b36d3a2a89ce4d16)

I hope the method gets added soon, it will save one from typing.

Thanks for sharing!

[Tapas Adhikary](https://hashnode.com/@atapas)

[May 17, 2021](https://hashnode.com/posts/why-do-you-need-to-know-about-the-javascript-array-at-method/60a25e1e23723215ec2ff42d/comment/60a277e4b36d3a2a89ce4d16#reply-60a27a89b36d3a2a89ce4d70)

Absolutely! Welcome, Favourite 🙂.

[Savio Martin](https://hashnode.com/@saviomartin)

[May 17, 2021](https://hashnode.com/posts/why-do-you-need-to-know-about-the-javascript-array-at-method/60a25e1e23723215ec2ff42d/comment/60a26dd6b36d3a2a89ce4bf4)

Great Blog [Tapas Adhikary](https://hashnode.com/@atapas), `at()` was a really new thing to me. Thank you for this amazing blog! Keep up the great work!

[Tapas Adhikary](https://hashnode.com/@atapas)

[May 17, 2021](https://hashnode.com/posts/why-do-you-need-to-know-about-the-javascript-array-at-method/60a25e1e23723215ec2ff42d/comment/60a26dd6b36d3a2a89ce4bf4#reply-60a26e84c9ac202a62291d01)

Thanks a lot [Savio Martin](https://hashnode.com/@saviomartin). Glad you found it helpful.
