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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:36:50+00:00 2026-05-23T18:36:50+00:00

I have object like this: var example = { test1: 10, test2: 20, test3:

  • 0

I have object like this:

var example = {
    test1: 10,
    test2: 20,
    test3: 30
}

For some reason, I wanted to use test# variables without example, so I extended window object like this(using jQuery):

$.extend(window, window, example)

But, whenever this function has called, page was refreshed.

And one more question, if I try to extend document in the same way, some error occurs like this:(in Chrome)

Error: NAMESPACE_ERR: DOM Exception 14

Why is that? And is there any way to use variables without object(namespace) name?

  • 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-23T18:36:50+00:00Added an answer on May 23, 2026 at 6:36 pm

    Your $.extend call does the equivalent of this:

    window.location = window.location;
    

    And that will refresh the page.

    The $.extend function essentially copies all the properties (using simple assignments) from the second through last arguments to the first argument and returns the (updated) first argument. In your second argument, window, there will be location property and when you assign something to window.location, you change the page and if the new and old location values are the same, you’ll refresh the current page.

    If you want to add all the properties in example to window, just do this:

    $.extend(window, example);
    

    As far as “And is there any way to use variables without object(namespace) name?” goes, just add your variables as properties of window and you’ll be able to access them without a prefix:

    window.where_is = "pancakes house?";
    alert(where_is);
    

    For example: http://jsfiddle.net/ambiguous/T7cNx/

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

Sidebar

Related Questions

I have a LINQ query that returns some object like this... var query =
Let's say that I have a object that looks like this var object =
I'm just wondering .. I have and object like this public class Entry{ public
if I have an XML object like this: <a> <u date=2009-04-10 value=543/> <u date=2009-04-11
I have a script which creates a user-defined object like this: obj = new
I have a data object that looks like this: { 'node-16': { 'tags': ['cuda'],
I have converted an array to object data like this: <?php $myobject->data = (object)Array('zero','one','two');
I have an array like this: object[] args and need to insert those args
Suppose I have a design like this: Object GUI has two objects: object aManager
I have a JPA object which has a many-to-many relationship like this: @Entity public

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.