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

  • Home
  • SEARCH
  • 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 8681891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:37:36+00:00 2026-06-12T21:37:36+00:00

I tried debugging but no luck as of yet! This Works: function slider(direction){ this.direction

  • 0

I tried debugging but no luck as of yet!
This Works:

function slider(direction){
this.direction = direction;
}

slider.prototype.move = function(){
console.log('moving');
};

var slider1 = new slider('backward');
console.log(slider1.direction);

var slider2 = new slider('forward');
console.log(slider2.direction);

This doesn’t work:

var slider = new slider('backward');
console.log(slider.direction);

var slider2 = new slider('forward');
console.log(slider2.direction);

I know this would have something to do with the semicolon and I’d searched some other articles on this but couldn’t find an answer to my problem

  • 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-12T21:37:38+00:00Added an answer on June 12, 2026 at 9:37 pm

    When you run

    var slider = new slider('backward');
    console.log(slider.direction);
    

    you now have 2 variables called slider – one is a function and one is an instance of the object that function generates. When you ask the second slider to generate:

    var slider2 = new slider('forward');
    console.log(slider2.direction);
    

    you’re actually asking it to use the instance of the object as a variable… this feels really clunky to explain because they have the same names.

    What you’re doing in the second example, which causes it to fail, is the same as trying to do this in the first example:

    var slider2 = new slider1('forward');
    console.log(slider2.direction);
    

    because the function name is the same as a variable containing an instance of it.

    If this hasn’t been explained massively clearly (which wouldn’t surprise me) let me know and I’ll try to make it make more sense.

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

Sidebar

Related Questions

I tried debugging my code for like a few hour but I got nothing
Since a few days I'm unable to start resque I have tried debugging this
I have been staring at this code for few hours, tried walkthrough,debugging with autos
tried uncommenting pam_limits.so from the pam.d directory but no luck. Basic PAM seems to
Tried this: $('.link').click(function(e) { $.getScript('http://www.google.com/uds/api?file=uds.js&amp;v=1.0', function() { $('body').append('<p>GOOGLE API (UDS) is loaded</p>'); }); return
EDIT I tried debugging this with xdebug and netbeans. It's weird that the exports
I've tried looking at other answers for this but I can't seem to figure
(Note, this question has been marked answered in Debugging Sharepoint timer jobs but I'm
I've been trying this for hours, but haven't had any luck. Every tutorial I
So been fiddling around with this for a while now but still no luck.

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.