.ready()


#1

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-jquery-introduction/lessons/jquery-setup/exercises/ready

This is the format we are using in the course:

$(document).ready(() => {

});

I recall this format:

$(document).ready(function() {

});

What is the difference? The latter would be an anonymous function. The former makes no immediate sense to me. What does the arrow (=>) achieve?


#2

This course has been upgraded to ES6+ which permits the use of what is called, arrow function syntax.

ES5

var bar = function () {

};

ES6

const foo = () => {

};

#3

I shall Google that. Thanks for the guidance!

By the way, given we place the code before the closing tag, shouldn’t the remainder have been loaded already anyway, for which we would not have to check using .ready()?


#4

In a sense, you are correct, but humor the course author.