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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:42:32+00:00 2026-06-03T10:42:32+00:00

Can someone explain why the console acts this way? I posted this question once,

  • 0

Can someone explain why the console acts this way?

I posted this question once, but I could not quite formulate it correctly so I closed it again. The initial question did not mention that the problem could be console related, I just questioned the strange behavior of the variables. I basically only posted the following screenshot:

enter image description here

Note here that I log $s.page on line 20 and $s.page.navi is there, and on line 21 when I log again it’s gone.

Reopening the question

There was nobody who could give an answer, although @zerkms suggested it could have something to do with the console itself. After I closed the question he contacted me via this post: Have require.js load my files only when I actually need them to maybe reopen the question.

The Problem

Enough intro, back to the issue. So where did the variable go. From the other question I posted you can see I use require.js to load my files. I am kinda new to this all so my problem was related to it.

In the code of $s.page I do the following (simplified):

require(['nav'], $.proxy(function(Nav){

    this.navi = new Nav.Views.Main();

}, this));

nav is a module that require.js has to load. I the script would block until the file is there, and looking at the console it confirmed that.

Let me log in more detail:

console.log('x');

require(['nav'], $.proxy(function(Nav){

    console.log('y');

    this.navi = new Nav.Views.Main();

}, this));

I left the other logs in place aswel, and here is the output:

enter image description here

Notice that x is logged first. When I then log $s.page it shows me what $s.page will look like in the future, i guess. Really odd.

When I then log $s.page.navi on the next line it is not there, which is correct.

Then at the very end, without even being called anymore, y joins the party.

  • 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-03T10:42:35+00:00Added an answer on June 3, 2026 at 10:42 am

    See on line 22 of router.js I call $s.page.navi.start(), that was the whole point of this problem. It could not be fired. I solved it with the following code:

    require(['nav'], function(Nav){
    
        $s.page.navi.start();
    
    });
    

    It will just wait for it’s dependencies.

    Conclusion

    When working with JavaScript, and libraries such as backbone.js and require.js you should really keep track of what you are doing and keep in mind that the script does not easily block.

    Just logging at certain points in the application will not always help you solve your problem, you have to really log from the root of your application to the tip of the leaf to see what is actually happening. And the best approach is always the build in debugger.

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

Sidebar

Related Questions

Could someone explain to me how can I run my py2exe program, a console
Can someone explain why this code halts at startFileHTTP()? The jetty server starts but
Can someone explain this? IE8 ( function(){ window.foo = function foo(){}; console.log( window.foo ===
This is my script, but it only prints spaces in the console. Can someone
Can someone explain to me this odd thing: When in python shell I type
Can someone explain why this doesn't work? int main() { float* x; float a,
Can someone explain why this script throws an exception? $byteArray = @(1,2,3) write-Output (
Can someone explain how New works with the With keyword in this example from
Can someone explain the reason/importance of why javascriptlint (not jslint) gives the warning inc_dec_within_stmt
Can someone explain the following two outputs? Code 1: console.log(itemsAry); //loadNextItem(); function loadNextItem(){ var

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.