Jquery taught by codeacademy


Why is the jquery taught at codecademy different from other sources on the internet?
for example, the anonymous function declaration is different and declaring jquery objects.


We need some context, here. Please post the URL of the lesson you are on, as well as your own code.


This is how anonymous functions are declared in the jquery exercise on codecademy.
$(document).ready(() => {

This is how anonymous functions are declared elsewhere
$(document).ready(function() {

Can you please explain why is it like that?


Would appreciate that link, please.

Both forms are valid. The arrow function syntax was introduced in ES6 and behaves like any function with a couple of exceptions…

  1. no this object
  2. no arguments object

JavaScript Arrow Functions

If you use an arrow function inside another function, it accesses that function’s this object, and that function’s arguments object.



Thanks for the explanation.
I have watched a few videos to learn jquery and people did not use the arrow function which is why I got confused.

Here is the link to the codecademy lesson: