Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8718017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:26:10+00:00 2026-06-13T06:26:10+00:00

I am reviewing some code in our web site until I came to this

  • 0

I am reviewing some code in our web site until I came to this one

<script>
    (function (a) {
        _q = function () { return a; };
        $ = function (f) { typeof f === 'function' && a.push(arguments); return $; };
        jQuery = $.ready = $;
    }([]));
</script>  

And then followed by bunch of plugins including jQuery.
I just don’t get what it means, I want to know how it works so I would be able to manipulate the code. Can anyone explain the code line by line?

Edit

So sorry for the bad codes. I was also wandering of its use that’s why I ask it here. Anyway this is the whole code inside the head tag.

<head>
    <meta charset="utf-8">
    @foreach (string domain in
    ViewBag.Prefetches is string[] ? ViewBag.Prefetches : new string[] { })
    {
        @Html.Prefetch(domain)    
    }
    <title>
        @{@ViewBag.SiteName
            if (ViewBag.Title != null)
            {  @ViewBag.SiteDelimiter @ViewBag.Title } 
        }
    </title>

    <meta name="description" content="">
    <meta name="author" content="">
    <meta http-equiv="imagetoolbar" content="false">

    <link href="@Url.ContentArea("~/css/global/normalize.css")" rel="stylesheet" />

    @foreach (string stylesheet in
    ViewBag.Stylesheets is string[] ? ViewBag.Stylesheets : new string[] { @"style.css" })
    { 
        <link href="@Url.ContentArea("~/css/" + stylesheet)" rel="stylesheet" />
    }

    @RenderSection("CustomCss", required: false)

    <link href="@Url.ContentArea("~/css/global/helpers.css")" rel="stylesheet" />
    <link href="@Url.ContentArea("~/css/global/media.css")" rel="stylesheet" />

    <script src="@Url.ContentArea("~/js/global/modernizr-2.5.3.min.js")"></script>

    <script>
        (function (a) {
            _q = function () { return a; };
            $ = function (f) { typeof f === 'function' && a.push(arguments); return $; };
            jQuery = $.ready = $;
        }([]));
    </script>

    @RenderSection("OverrideJs", required: false)
</head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="@Url.ContentArea("~/js/global/jquery-1.7.2.min.js")"><\/script>');</script>
@foreach (string script in
    ViewBag.Scripts is string[] ? ViewBag.Scripts : new string[] { })
{ 
    <script src="@script"></script>
}
<script>
    Modernizr.load({
        test: window.JSON,
        nope: '@Url.Content("~/Scripts/Polyfills/json.polyfill.js")'
    });

    (function (i, s, q, l) {
        for (q = window._q(), l = q.length; i < l;) {
            $.apply(this, s.call(q[i++]));
        }
    }(0, Array.prototype.slice));

</script>
<!--[if lt IE 7 ]>
  <script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js"></script>
  <script>window.attachEvent("onload",function(){CFInstall.check({mode:"overlay"})})</script>
<![endif]-->

I can’t provide a link because these codes were used in specific pages where you have to be logged in.
Anyway thanks for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:26:11+00:00Added an answer on June 13, 2026 at 6:26 am

    Short answer: It logs if jQuery’s been loaded

    Long answer: It looks like all it does is add a variable “jQuery” if it’s loaded, after adding to it a function _q that returns an array of arguments (which is an array-like variable that exist in all functions’ execution contexts, thanks Fabrício Matté). As far as I can tell since no arguments are sent into the function, all it’ll do is log the scope it’s been called from.

    It looks like the “jQuery” variable is accessed a bit further down, and if not set it loads jQuery. But I don’t think it could be accessed down there anyways since I don’t see the variable globally declared anywhere.

    What it’s used for is that it first tries to load jQuery from Google’s hosting. If that fails it loads jQuery locally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reviewing some code from one of our contractors: if (userLists != null) {
I was reviewing some code and I came across this: public static doSomething(String myString,
I was reviewing some of my old code and came across this syntax: extractDir=${downloadFileName%.*}-tmp
I was reviewing some code for log4net and I came across this. private static
Whilst reviewing some Qt C++ code I came across this: class Foo { Q_OBJECT
I'm reviewing some old python code and came accross this 'pattern' frequently: class Foo(object):
I'm reviewing some code from my job from another employee and came across a
I am reviewing some code at work and came across an inconsistency in how
New to C#, and I'm reviewing some code that has the following return statement:
I'm reviewing some team code and I found something like this : MyObj obj

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.