So, taking a look at this snippet of code,
it looks like $(document).click() is taking in some kind of function.
We see function, then a parameter, and
then these curly braces that are passing in, well, some instructions.
This is similar to regular function syntax,
where we declare a function with the keyword function, set some parameters, and
then put code inside curly braces.
But this function doesn't seem to have a name.
And that's kind of curious.
So let's go ahead and open up Google.
I typed in JavaScript function without name and
I'm going to take a look at the results.
We came across an article about JavaScript Anonymous Functions.
This seems really useful.
It looks like an anonymous function is one that's declared without a name.
That sounds like what we've got.
So it looks like $(document).click is taking an anonymous function as
a parameter.
You'll find anonymous functions all over the place in JavaScript.
So I encourage you to check out the resources in the Instructor Notes to learn
more about them.
،حسنًا، بالنظر إلى جزء التعليمة البرمجية المتكررة هذا
.يبدو وكأن $(document).click() يتضمن نوع دالة ما
،نرى دالة، ثم معلمة
.ثم هذين القوسين المعقوصين اللذين يمرران بعض التعليمات
،هذا مشابه لصيغة دالة عادية
،حيث نعلن عن دالة باستخدام الكلمة الأساسية function، ونعين بعض المعلمات
.ثم نضع التعليمة البرمجية داخل قوسين معقوصين
.لكن يبدو أن هذه الدالة لا تحمل اسمًا
.وهذا غريب نوعًا ما
.لذا دعونا نتابع ونفتح Google
قمت بكتابة دالة JavaScript دون اسم
.وسوف ألقي نظرة على النتائج
.وجدنا مقالة عن JavaScript Anonymous Functions
.يبدو هذا مفيدًا حقًا
.يبدو أن الدالة المجهولة هي تلك المعلن عنها دون اسم
.يبدو أن هذا هو ما حصلنا عليه
لذا يبدو أن $(document).click يأخذ دالة مجهولة
.كمعلمة
.ستجدون دوالاً مجهولة في كل مكان في JavaScript
لذا أشجعكم على مراجعة الموارد الموجودة في ملاحظات المدرب لمعرفة
.المزيد عنها
이 코드를 볼까요?
$(document).click()은 어떤 함수를 취하고 있는 것 같군요
함수, 변수, 중괄호, 지시문이 보입니다
일반적인 함수 문법과 비슷하네요
function이라는 키워드로 함수를 선언하고, 몇 개의 변수를 설정하고
중괄호 안에 코드를 입력합니다
그런데 이 함수는 이름이 없는 것 같아요
이상하네요
구글 검색을 해봐야겠어요
‘이름이 없는 자바스크립트 함수’ 검색
결과를 한번 볼까요
자바스크립트 익명 함수라는 글이 있어요
정말 유용한데요?
이름 없이 선언된 함수를 익명함수라고 하는 것 같네요
우리가 원하던 답인 것 같습니다
그러니까 $(document).click()이 익명 함수를
변인으로 가지고 있는 거네요
자바스크립트에서 익명함수는 어디서나 찾을 수 있습니다
instructor’s note에 있는 자료로
더 알아보시기 바랍니다
Observando este trecho de código,
parece que $(document).click() está admitindo algum tipo de função.
Vemos function, um parâmetro e
estas chaves que estão passando algumas instruções.
Isso é parecido com a sintaxe normal das funções,
onde declaramos uma função com a palavra-chave function, definimos parâmetros e
inserimos código entre chaves.
Mas parece que esta função não tem nome.
E isso é curioso.
Então vamos abrir o Google.
Digitei "função JavaScript sem nome" e
vou verificar os resultados.
Apareceu um artigo sobre as funções JavaScript anônimas.
Isso parece muito útil.
Ao que parece, uma função anônima é aquela declarada sem um nome.
Acho que é o que temos aqui.
Então, pelo visto, $(document).click está admitindo uma função anônima
como parâmetro.
Você encontra funções anônimas a toda hora no JavaScript.
Então recomendo que você consulte os recursos das Notas do instrutor para
saber mais sobre elas.