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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:09:40+00:00 2026-05-15T23:09:40+00:00

var mC = function(map){ var init = function(iMap){ alert(Init + this + with); }

  • 0
var mC = function(map){
    var init = function(iMap){
        alert("Init " + this + " with");
    }
    init(map);
};
var m = new mC({});

why i am getting value of this as [object window]? Is it a window object??

  • 1 1 Answer
  • 1 View
  • 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-15T23:09:40+00:00Added an answer on May 15, 2026 at 11:09 pm

    Yes! Because init is a variable of mC, it will share its scope (which currently is the global scope, which is also the window object).

    However. If you changed to the following:

    var mC = function(map){
        this.init = function(iMap){
            alert("Init " + this + " with");
        }
        this.init(map);
    };
    var m = new mC({});
    

    Then this inside init would be a reference to your instance.

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

Sidebar

Related Questions

This is my object: var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { map:
This works in jQuery 1.3.2, but not in 1.4 $(#container).children().map(function() { var child =
I have a function in jquery: $('#map').click(function(e) { var posX = $(this).offset().left, posY =
$('a').live('click',function(e){ e.preventDefault(); var id = $(this).attr('id'); infowindow2.open(map, marker2); // I need instead of 2
For example: (function() { var proxied = window.eval; window.eval = function() { return proxied.apply(this,
// begin signals this.loginSignal this.init = function(){ // init signals this.loginSignal = new t.store.helpers.Signal;
Following is the javascript code var text; var name; window.onload = init; function init()
So i have a V3 map which is initialised like this: function init() {
var Dog = function() { var _instance = 'hello world'; return function() { console.log(this._instance);
$(function(){ $('.page').click(function() { var paging = $(this).attr(name); var dataString = 'page='+paging; $.ajax({ type: POST,

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.