---
title: "Comment by Prateek Aher on \"JavaScript: this is easy and what do you need to know about it!\" | Hashnode"
description: "In your code snippet under &#39; apply() method &#39;, shouldn&#39;t hobby1 and hobby2 be replaced by hobbies[0] and hobbies[1] respectively?"
url: "https://hashnode.com/posts/javascript-this-is-easy-and-what-do-you-need-to-know-about-it/5f02b234b0b5c3083fffabac/comment/5f42990b82f012743b26a3ce"
---

[Discussion](https://hashnode.com/posts/javascript-this-is-easy-and-what-do-you-need-to-know-about-it/5f02b234b0b5c3083fffabac)

Comment [JavaScript: this is easy and what do you need to know about it!](https://hashnode.com/posts/javascript-this-is-easy-and-what-do-you-need-to-know-about-it/5f02b234b0b5c3083fffabac)

[Prateek Aher](https://hashnode.com/@prateek_aher)

[Aug 23, 2020](https://hashnode.com/posts/javascript-this-is-easy-and-what-do-you-need-to-know-about-it/5f02b234b0b5c3083fffabac/comment/5f42990b82f012743b26a3ce)

In your code snippet under '**apply() method**', shouldn't `hobby1` and `hobby2` be replaced by `hobbies[0]` and `hobbies[1]` respectively?

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

[Aug 23, 2020](https://hashnode.com/posts/javascript-this-is-easy-and-what-do-you-need-to-know-about-it/5f02b234b0b5c3083fffabac/comment/5f42990b82f012743b26a3ce#reply-5f429e7f82f012743b26a3ea)

[Prateek Aher](https://hashnode.com/@prateek_aher),

Thanks for reading and commenting.

> shouldn't hobby1 and hobby2 be replaced by hobbies\[0\] and hobbies\[1\] respectively?

No, actually. The `apply` method is one step better than the `call` where you can pass the entire array as an argument. The number of parameters passed to the applied function would be mapped to the number of array elements passed to `apply` in the same order.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1598200754669/rN67lxyeR.png)

Another way to visualize it, think about the `arguments` itself. It is available to the function as local variable. See how I can retrieve with the element by element in this case.

```

var getName = function() {
     console.log(this.name + ' likes ' + arguments[0] + ' , ' + arguments[1]);
 }
 var user = {
   name: 'Tapas',
   address: 'Bangalore'  
 };

 var hobbies = ['Swimming', 'Blogging'];
 getName.apply(user, hobbies);
```

Hope I was able to clarify. Please let me know.

[Prateek Aher](https://hashnode.com/@prateek_aher)

[Aug 23, 2020](https://hashnode.com/posts/javascript-this-is-easy-and-what-do-you-need-to-know-about-it/5f02b234b0b5c3083fffabac/comment/5f42990b82f012743b26a3ce#reply-5f42b521b9aefd741aeaf674)

[Tapas Adhikary](https://hashnode.com/@atapas) It is clear to me now. My bad, I mistook the argument-list as parameters.
