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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:42:57+00:00 2026-06-13T01:42:57+00:00

Consider the following example: var $_dfd = $.Deferred(), $_x = {}; $_x = {

  • 0

Consider the following example:

var $_dfd = $.Deferred(),
    $_x = {};

$_x = {
    a: 1,
    b: 2
};

console.log($_x); // Gives {a: 1, b: 2, more: {c: 3, d: 4}} <== Weirdness here
console.log($_x.a); // Gives 1
console.log($_x.more); // Gives undefined

$_dfd.pipe(function($_x) {
    $_x.more = {
        c: 3,
        d: 4                    
    };

    return $_x;
});

$_dfd.resolve($_x).done(function($_x) {
    console.log($_x); // Gives {a: 1, b: 2, more: {c: 3, d: 4}}
});

​
I am really totally baffled by console.log output #1. There are two questions that need to be answered:

  1. What’s the real state of the variable $_x at the first console.log output?

  2. If console.log is not a safe way to understand the state of variables when working with deferred, what are other better alternatives?

Thanks!

  • 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-13T01:42:59+00:00Added an answer on June 13, 2026 at 1:42 am

    Have to use JSON.stringify(), as detailed in the following post:

    Bug in console.log?

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

Sidebar

Related Questions

Consider the following example: var http = require('http'); var server = http.createServer(function(request, response) {
Consider the following example: HTML: <div id=cool-div></div> JS/jQuery: var ComplexObject = function() { this.Append
Consider the following example. var obj = function(){}; function apply(target, obj) { if (target
Consider the following example: var features = []; $.getJSON(annotations_url, function(data) { $.each(data, function(key, val)
Consider the following example: var funcToCall = function() {...}.bind(importantScope); // some time later var
Consider the following example: ( live demo here ) HTML: <div class=board> <div class=row>
Consider the following example: <html> <body> <script type=text/javascript> var str=filename.jpg; var pattOne = new
Consider the following example: function async_callback(array1, array2, array3) { // All arrays are equal
Consider the following example (also available here: http://jsfiddle.net/hq8Fg/1/ ). It works fine in IE9,
Consider the following example where Student inherits from Person : function Person(name) { this.name

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.