Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
How does jquery ready function allow it's first parameter to become jquery object?

Today I stumbled upon this:

jQuery(document).ready(function($$){
    console.log($$);
});

Apparently, $$ is considered as the jQuery object itself. Usually to do such a thing, we need to pass the jQuery variable:

(function($$){
    console.log($$);
}(jQuery))

But in case of ready function how does it know $$ is the jQuery object? I think jquery defines the ready function under the hood in a way that passes it's first parameter as jQuery.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This is described in the docs.

In this situation:

jQuery(document).ready(function($$){
    console.log($$);
});
  • When the jQuery script tag runs, window.jQuery has jQuery assigned to it
  • jQuery(document) references that global identifier
  • jQuery.ready`'s callback, as designed, calls its callback with the jQuery object

This functionality doesn't have much use unless you're using jQuery.noConflict, but for another example of something similar:

theLibrary().ready(function($$){
    console.log($$.libraryProp);
});
<script>
// library example
window.theLibrary = Object.assign(
  // the library is both a function
  () => ({
    ready: (callback) => {
      callback(window.theLibrary);
    }
  }),
  // and an object with properties
  {
    libraryProp: 'libraryProp'
  }
);
</script>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda