Hi,
Could it be correct that the following code does *not* work because i'm not
using the var arr = new Array("a","b"," c"); methodology??
Read through http://devedge.netscape.com/library/...y.html#1194827
but there was no mention of particular constructors having to be used.
And if so how does one resolve it (if resolvable)?
TIA
Fermin DCG
=============== ===========
var famname = new Array();
famname[0] = "Jan 0 Egil";
famname[1] = "To1ve";
famname[2] = "He2ge";
famname[3] = "Sta3le";
famname[4] = "Kai 4Jim";
famname[5] = "Bor5ge";
var famname2 = new Array(6);
famname2[0] = "Jan Egil2";
famname2[1] = "Tove2";
famname2[2] = "Hege2";
famname2[3] = "Stale2";
famname2[4] = "Kai Jim2";
famname2[5] = "Borge2";
famname = famname.concat( famname2); *Does not produce the concatenation!*
for (var i=0; i<6; i++) {
document.write( famname[i] + "<br />");
}
for (var i=0; i<6; i++) {
document.write( famname2[i] + "<br />");
} 5 1839
"F. Da Costa" <da*****@xs4all .nl> wrote in message
news:40******** *************@n ews.xs4all.nl.. . Hi,
Could it be correct that the following code does *not* work because i'm
not using the var arr = new Array("a","b"," c"); methodology??
Read through http://devedge.netscape.com/library/...5/reference/ar
ray.html#119482 7 but there was no mention of particular constructors having to be used.
And if so how does one resolve it (if resolvable)?
TIA Fermin DCG
=============== =========== var famname = new Array(); famname[0] = "Jan 0 Egil"; famname[1] = "To1ve"; famname[2] = "He2ge"; famname[3] = "Sta3le"; famname[4] = "Kai 4Jim"; famname[5] = "Bor5ge";
var famname2 = new Array(6); famname2[0] = "Jan Egil2"; famname2[1] = "Tove2"; famname2[2] = "Hege2"; famname2[3] = "Stale2"; famname2[4] = "Kai Jim2"; famname2[5] = "Borge2";
famname = famname.concat( famname2); *Does not produce the concatenation!*
Your using "famname" as an array and as a string. Try:
var famname3 = famname.concat( famname2);
McKirahan wrote: "F. Da Costa" <da*****@xs4all .nl> wrote in message news:40******** *************@n ews.xs4all.nl.. .
Hi,
Could it be correct that the following code does *not* work because i'm not
using the var arr = new Array("a","b"," c"); methodology??
Read through
http://devedge.netscape.com/library/...5/reference/ar ray.html#119482 7
but there was no mention of particular constructors having to be used.
And if so how does one resolve it (if resolvable)?
TIA Fermin DCG
============= ============= var famname = new Array(); famname[0] = "Jan 0 Egil"; famname[1] = "To1ve"; famname[2] = "He2ge"; famname[3] = "Sta3le"; famname[4] = "Kai 4Jim"; famname[5] = "Bor5ge";
var famname2 = new Array(6); famname2[0] = "Jan Egil2"; famname2[1] = "Tove2"; famname2[2] = "Hege2"; famname2[3] = "Stale2"; famname2[4] = "Kai Jim2"; famname2[5] = "Borge2";
famname = famname.concat( famname2); *Does not produce the concatenation!* Your using "famname" as an array and as a string. Try:
var famname3 = famname.concat( famname2);
That did the trick indeed.
Makes me wonder from time 2 time.
Thx a lot
Cheers
"F. Da Costa" wrote: Hi,
Could it be correct that the following code does *not* work because i'm not using the var arr = new Array("a","b"," c"); methodology??
Read through http://devedge.netscape.com/library/...y.html#1194827 but there was no mention of particular constructors having to be used.
And if so how does one resolve it (if resolvable)?
TIA Fermin DCG
=============== =========== var famname = new Array(); famname[0] = "Jan 0 Egil"; famname[1] = "To1ve"; famname[2] = "He2ge"; famname[3] = "Sta3le"; famname[4] = "Kai 4Jim"; famname[5] = "Bor5ge";
var famname2 = new Array(6); famname2[0] = "Jan Egil2"; famname2[1] = "Tove2"; famname2[2] = "Hege2"; famname2[3] = "Stale2"; famname2[4] = "Kai Jim2"; famname2[5] = "Borge2";
famname = famname.concat( famname2); *Does not produce the concatenation!*
for (var i=0; i<6; i++) { document.write( famname[i] + "<br />"); }
for (var i=0; i<6; i++) { document.write( famname2[i] + "<br />"); }
Of COURSE it concatenates the arrays, but if you look at your "test code" you are simply looping
through 6 elements of the first array and 6 elements of the second array and outputting them.
If you modify your test code to actually output all of the array values, you'll see that famname
contains all the entries from both famname and famname2:
document.write( "Contents of famname<br />");
for (var i=0; i<famname.lengt h; i++) {
document.write( famname[i] + "<br />");
}
document.write( "Contents of famname2<br />"):
for (var i=0; i<famname2; i++) {
document.write( famname2[i] + "<br />");
}
Better yet:
document.write( "<p>Content s of famname<br />" + famname.join("< br />") + "</p>");
document.write( "<p>Content s of famname2<br />" + famname2.join(" <br />") + "</p>");
--
| Grant Wagner <gw*****@agrico reunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
McKirahan wrote: "F. Da Costa" <da*****@xs4all .nl> wrote in message news:40******** *************@n ews.xs4all.nl.. . Hi,
Could it be correct that the following code does *not* work because i'm not using the var arr = new Array("a","b"," c"); methodology??
Read through http://devedge.netscape.com/library/...5/reference/ar ray.html#119482 7 but there was no mention of particular constructors having to be used.
And if so how does one resolve it (if resolvable)?
TIA Fermin DCG
=============== =========== var famname = new Array(); famname[0] = "Jan 0 Egil"; famname[1] = "To1ve"; famname[2] = "He2ge"; famname[3] = "Sta3le"; famname[4] = "Kai 4Jim"; famname[5] = "Bor5ge";
var famname2 = new Array(6); famname2[0] = "Jan Egil2"; famname2[1] = "Tove2"; famname2[2] = "Hege2"; famname2[3] = "Stale2"; famname2[4] = "Kai Jim2"; famname2[5] = "Borge2";
famname = famname.concat( famname2); *Does not produce the concatenation!*
Your using "famname" as an array and as a string. Try:
No, he really isn't. Array.concat(Ar ray) returns an Array, so
famname = famname.concat( famname2); concatenates famnam2 to famname, returns the
result, and assigns it to famname. Even *if* this were the case, JavaScript
wouldn't care, it will accept all sorts of new type assignments:
var a = [ "a", "b", "c" ];
a = a.join("<br />");
document.write( a);
a starts life as an Array, a join() is performed on the contents of that Array
and a String is returned, which is assigned to the same variable a. That
variable is then output.
And it works just fine.
I could provide numerous other examples of assigning different variable types to
the same variable name, but the one above is on point for your concern with his
original code.
var famname3 = famname.concat( famname2);
His problem has nothing to do with the assignment, it had to do with his test
output. If you look, he outputs only the first 6 elements of the Array pointed
to by famname. It contains 12 elements (6 from famname, 6 from famname2), but
you never see the 2nd set of 6 elements, because he simply doesn't output them.
He should be using:
famname = [ "a", "b", "c" ];
famname2 = [ "d", "e", "f" ];
famname = famname.concat( famname2);
document.write( '<p>famname contains:<br />' + famname.join('< br />') + '</p>');
--
| Grant Wagner <gw*****@agrico reunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Grant Wagner wrote: "F. Da Costa" wrote:
Hi,
Could it be correct that the following code does *not* work because i'm not using the var arr = new Array("a","b"," c"); methodology??
Read through http://devedge.netscape.com/library/...y.html#1194827 but there was no mention of particular constructors having to be used.
And if so how does one resolve it (if resolvable)?
TIA Fermin DCG
============= ============= var famname = new Array(); famname[0] = "Jan 0 Egil"; famname[1] = "To1ve"; famname[2] = "He2ge"; famname[3] = "Sta3le"; famname[4] = "Kai 4Jim"; famname[5] = "Bor5ge";
var famname2 = new Array(6); famname2[0] = "Jan Egil2"; famname2[1] = "Tove2"; famname2[2] = "Hege2"; famname2[3] = "Stale2"; famname2[4] = "Kai Jim2"; famname2[5] = "Borge2";
famname = famname.concat( famname2); *Does not produce the concatenation!*
for (var i=0; i<6; i++) { document.writ e(famname[i] + "<br />"); }
for (var i=0; i<6; i++) { document.writ e(famname2[i] + "<br />"); }
Of COURSE it concatenates the arrays, but if you look at your "test code" you are simply looping through 6 elements of the first array and 6 elements of the second array and outputting them.
:) The infamous middle of the night error.
Yep you are very correct. Obviously resolved this whole thing and knee-high
in other muck again.
Thx for the reaction anyway. If you modify your test code to actually output all of the array values, you'll see that famname contains all the entries from both famname and famname2:
document.write( "Contents of famname<br />"); for (var i=0; i<famname.lengt h; i++) { document.write( famname[i] + "<br />"); }
document.write( "Contents of famname2<br />"): for (var i=0; i<famname2; i++) { document.write( famname2[i] + "<br />"); }
Better yet:
document.write( "<p>Content s of famname<br />" + famname.join("< br />") + "</p>"); document.write( "<p>Content s of famname2<br />" + famname2.join(" <br />") + "</p>");
-- | Grant Wagner <gw*****@agrico reunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available at: * http://devedge.netscape.com/library/...ce/frames.html * Internet Explorer DOM Reference available at: * http://msdn.microsoft.com/workshop/a...ence_entry.asp * Netscape 6/7 DOM Reference available at: * http://www.mozilla.org/docs/dom/domref/ * Tips for upgrading JavaScript for Netscape 7 / Mozilla * http://www.mozilla.org/docs/web-deve...upgrade_2.html
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: rl |
last post by:
Hi out there,
I'd like to know sth about the costs of a function call in php
and the handling of character arrays (init size, enlargement steps of
allocated memory, technique on enlargement -> full copy or virtual
array spread in chunks over mem).
The reason of my question is the following:
// many function calls with smaller char arrays and less concats
echo('wkjksdbjvsdnklvsDVL'.$a.'vfaadf');
|
by: F. Da Costa |
last post by:
Hi,
I was wondering whether someone could enlighten me as to the reason why the
slice does not work in IE when the arr is passed in properly.
Checked the values in the srcArr and they are correct so no problems there.
Gecko works as expected.
Prior to entering the function I can slice the array being entered so I
wouldn't expect an "Unexpected call to method or property access" (in IE 6).
I guess its something silly but as of yet i'm...
|
by: Andrew Poulos |
last post by:
If I'm searching for an occurance of a value in a multi-dimensional
array how can I get it's index returned as an array, if found? For
example, if:
foo = new Array();
foo = , 5, , 9, 10];
Array.prototype.findValue = function(val) {
// blah
}
|
by: vvenk |
last post by:
Hello:
I have the following code:
Dim lsFilter As String = Nothing
Select Case rblStatus.SelectedItem.Value
Case "S"
lsFilter = String.Concat("D_STAT_CD_C = '", "N'")
Case "R"
lsFilter = String.Concat("D_STAT_CD_C <> '", "N'")
|
by: Mythran |
last post by:
Out of curiosity, only, which is recommended for SHORT concatenation...or
concatenating two or three strings that are relatively small in size?
Dim a As String = "bah"
Dim b As String = "bah2"
Dim c As String = a & b
Dim d As String = String.Concat(a, b)
string a = "bah";
string b = "bah2";
| |
by: Leonel Gayard |
last post by:
Hi all,
I had to write a small script, and I did it in python instead of
shell-script. My script takes some arguments from the command line,
like this.
import sys
args = sys.argv
if args == :
print """Concat: concatenates the arguments with a colon (:) between them
|
by: Jeff Gardner |
last post by:
Greetings:
I am attempting to get conditional output based on POSTed form data.
If the posted value is either the key or value of an array, $x=key and
$q=foo. elseif it is neither key nor value(I tried || too) , $q=bar.
Even though $x is properly assigned the new value, $q always ends up
being bar. Abstractions aside, here's the code: (note ## comments
added to this post)
<snip>
|
by: anon.asdf |
last post by:
Hello!
In the following code-snippet, is it possible to initialize each
element of arr, with STRUCT_INIT?
struct mystruct {
int a;
char b;
};
|
by: agendum97 |
last post by:
MSDN says splice has the following arguments:
arrayObj.splice(start, deleteCount, ]]])
Thus I can insert items into an array using splice. But how do I
insert an entire array? For example:
var arr1 = ;
arr1 = "a";
arr2 = "d";
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |