Have a look at my code snippet .... -
function test(){
-
var obj = new Object();
-
obj.test = "Debasis Jana";
-
alert(obj.test);
-
var obj1 = obj;
-
obj1.test = "DMJPRO";
-
alert(obj.test);
-
}
-
Here assignment operates to copy the reference only. So changes to obj1 object makes changes to obj object.
But what i saw ...that if i copy the reference of a variable of child window to parent window variable ..after closing the child window how the parent variable exists ...?
i think after closing the window gets closed not the variables which bound to that window ... :-)
Debasis Jana
14 1386
You have been here long enough to know that Java != Javascript.
<Moved>
You have been here long enough to know that Java != Javascript.
<Moved>
Sorry here i mistyped.... :-)
gits 5,390
Expert Mod 4TB
yes ... objects and arrays are passed by reference (simple types like boolean, strings, numbers and even functions are passed by value) ... and the reference points to the memory address ... all is 'bound' to the 'base-parent' window (not really but that is your current runtime environment if you like to see it that way), so if you store/pass a reference to something to this window then the garbage collector just knows that you have a reference to it and ignores that reference instead of throwing it ;)
kind regards
yes ... objects and arrays are passed by reference (simple types like boolean, strings, numbers and even functions are passed by value) ... and the reference points to the memory address ... all is 'bound' to the 'base-parent' window (not really but that is your current runtime environment if you like to see it that way), so if you store/pass a reference to something to this window then the garbage collector just knows that you have a reference to it and ignores that reference instead of throwing it ;)
kind regards
How functions and strings are passed by value ..can you give me some examples ?
gits 5,390
Expert Mod 4TB
for example with the assignment-operator (=) you pass a value or in case of javascript's arrays and objects a reference to those objects ... you might have a look here ... for getting an idea of it. it is even good to know when you use AJAX-callbacks where you may closure the reference to an object and easyly load data in the background to a js-business-object/component that you might have implemented.
kind regards
yes ... objects and arrays are passed by reference (simple types like boolean, strings, numbers and even functions are passed by value) ... and the reference points to the memory address ... all is 'bound' to the 'base-parent' window (not really but that is your current runtime environment if you like to see it that way), so if you store/pass a reference to something to this window then the garbage collector just knows that you have a reference to it and ignores that reference instead of throwing it ;)
kind regards
If i pass a reference (bound to child window) to parent window and in the mean time i dereference the child window by set null to it then what would happen to that reference as child window reference set to null?
it is even good to know when you use AJAX-callbacks where you may closure the reference to an object and easyly load data in the background to a js-business-object/component that you might have implemented.
kind regards
The fundamentals of closure makes a function to be passed as value not by reference? Actually the reference of function passed and the copy of local variables of the called function gets copied with the closure to work the inner function properly. Please explain here.
Gits ... Tell me how functions & Strings are passed by Value ..please give me an example.
Gits ... Tell me how functions & Strings are passed by Value ..please give me an example.
Recently I tested one thing .... -
var str = "Debasis Jana";
-
str[0] = 'S';
-
alert(str[0]); //It still prints D
-
Could you explain ?
Recently I went through a Site i found two links ....
The first one i think it's right ...
See these two links ..
[Removed link to competing forum] Link 2
Please experts have a look ..And throw some comments.
gits 5,390
Expert Mod 4TB
Gits ... Tell me how functions & Strings are passed by Value ..please give me an example.
??? there is enough example in the article link i showed you ... ? what do you exactly want to know? the links you showed in your last post seem to be quite outdated ... currently it is like i already told you ...
kind regards
PS: a better discussion is to be found here
Recently I tested one thing .... -
var str = "Debasis Jana";
-
str[0] = 'S';
-
alert(str[0]); //It still prints D
-
Could you explain ?
How it works ..please tell me.
gits 5,390
Expert Mod 4TB
with the array-like notation you could just read the character at the specified position - as you could do with charAt() ... have a look here for more information - you cannot set somethig that way. you could use other methods to alter specific characters of a string like replace() or explode the string to a real! array and then rejoin the characters with join() ... etc.
kind regards
with the array-like notation you could just read the character at the specified position - as you could do with charAt() ... have a look here for more information - you cannot set somethig that way. you could use other methods to alter specific characters of a string like replace() or explode the string to a real! array and then rejoin the characters with join() ... etc.
kind regards
So String(char array) is immutable :-)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dean Mitchell |
last post by:
Hi,
I have a simple STL map container that maps a stl string to a structure as
follows.
typedef std::map<std::string,TASKLIST> PCLIST;
In a class I have a member variable that is defined as...
|
by: netclectic |
last post by:
Hi folks, i've searched and searched and can't find any example of
what i'm trying to do. Essentially (i think) i need to add a new
operator to Number.
I'm using eval to evaluate expressions...
|
by: yopwojtek |
last post by:
Hello All,
i know from some tutorials, that copy constructor and assigment
operator is not inherited from base to derived class. i think it make
sense but i wrote a little example:
class Base {...
|
by: Alexandru Taeaha |
last post by:
i am trying to make a program that opens diferent programs from th numpad
key. my question is :can i make those keys have more the one assigment like
for example standard if i press it opens...
|
by: Luke Matuszewski |
last post by:
We all know that feature detection technique works from very beggining
of user-agents supporting JavaScript. We can alway check if eg.
document has a write property or smth else:
...
|
by: Nathan Sokalski |
last post by:
I have a VB.NET function that I am using in an ASP.NET page. The code
creates a String, which contains && (the JavaScript Logical AND operator)
and is used as part of the JavaScript sent to the...
|
by: Adrian |
last post by:
Below is an example of the problem I am having. I don't understand how
I can get the compiler to see deriv &operator=(const T &rhs).
I am sure this is a common problem - any suggestions?
...
|
by: viscroad |
last post by:
I have a confusion when I do some practice, the code and output are as
following,
print 'In fun()....'
In fun()....
None
<function fun at 0x00CC1270>
In fun()....
|
by: Lorenzo Di Gregorio |
last post by:
Hello,
I've been using Python for some DES simulations because we don't need
full C speed and it's so much faster for writing models. During
coding I find it handy to assign a variable *unless...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |