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 6876975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:32:40+00:00 2026-05-27T04:32:40+00:00

Ok so as I understand my code, I created a promoSlides object, I a

  • 0

Ok so as I understand my code, I created a promoSlides object, I a private function called init and in the return of a js closure (which I am not too familiar with) I returned init so I can use it outside globally kind of. When I run the file I get promoSlides is undefined, says error console of FF. I am not sure where I went wrong. I am new to this so probably something is wrong. Oh and slides was defined in my original doc but I took it out for simplicity sake

var Slider = (function (name) {return name;}(Slider || {}));

Slider.promoSlides = ( function()
{
var slides;

var init = function(s)
{
    slides = s;
    sortSlides();
    startTimer();
    addListeners();
};
return 
{
    init : function a(s)
    {
        init(s);
    }
};

})();

$(document).ready(function(){
    Slider.promoSlides.init(slides);
});
  • 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-05-27T04:32:41+00:00Added an answer on May 27, 2026 at 4:32 am

    Semicolon insertion strikes again!

    return 
    {
        init : function a(s)
        {
            init(s);
        }
    };
    

    needs to be

    return {
        init : function a(s)
        {
            init(s);
        }
    };
    

    This is a result of a “feature” in JavaScript that looks at your line with just return on it, and says: “oh, you forgot your semicolon, I’ll add it for you.”

    It changes return to return; so your function now returns undefined, and then you have some naked JSON sitting below it, which is the source of your error. Douglas Crockford actually describes this as one of the “awful parts” of JavaScript.

    So the moral of the story is: always put your opening brace on the same line when you’re coding in JavaScript.

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

Sidebar

Related Questions

I don't understand why code first does not add a new item to the
I've created this simple and pointless assembly (Y86) code to see if I understand
I cannot understand why the block of code below is not passing even though
I have created some Python code which is really complicated but it basically asks
I'm trying to understand code that I bought so I can modify it. In
I've been using xdebug to debug and understand code in php projects for a
I understand this code calculates the sum of the args of a variable, however,
I want to understand if code snippets are what I am looking for here.
I am trying to understand a code, what exactly &(ipA[iLower + 1] stands for
I am now trying to understand some code and I have found a pattern,

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.