hi everybody
suppose I have a function in a DLL
function F1(var1, var2, var3)
where var2 and var3 are optional parameter with default value (for
exsample "-1")
I create a new instance of my class and then I call F1.
In VBS I can call function in 4 ways:
1. F1(1)
2. F1(1,2)
3. F1(1,2,3)
4. F1(1, ,3)
but in js the #4 generate error.
Can I call 4th way?
tnx Daniele 7 14186
"(-: Dan :-)" <nn*****@tiscal inet.it> wrote in message
news:3F******** *******@tiscali net.it... hi everybody
suppose I have a function in a DLL
function F1(var1, var2, var3)
where var2 and var3 are optional parameter with default value (for exsample "-1")
I create a new instance of my class and then I call F1. In VBS I can call function in 4 ways: 1. F1(1) 2. F1(1,2) 3. F1(1,2,3) 4. F1(1, ,3)
but in js the #4 generate error.
Can I call 4th way?
No.
Optional means from here on. You can not omit a parameter.
Cheers
Richard.
"(-: Dan :-)" <nn*****@tiscal inet.it> writes: 4. F1(1, ,3)
Can I call 4th way?
Try
F1(1,undefined, 3)
In Javascript, you can only omit arguments from a point. The effect
is that the parameter gets the value "undefined" , just as if you had
passed it as a value.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Lasse Reichstein Nielsen said: "(-: Dan :-)" <nn*****@tiscal inet.it> writes:
4. F1(1, ,3)
Can I call 4th way?
Try F1(1,undefined, 3)
It would seem to be cleaner to supply the default value
as found in the documentation for that function:
F1(1,-1,3);
JRS: In article <bm*********@dr n.newsguy.com>, seen in
news:comp.lang. javascript, Lee <RE************ **@cox.net> posted at Fri,
10 Oct 2003 08:23:59 :- Lasse Reichstein Nielsen said:"(-: Dan :-)" <nn*****@tiscal inet.it> writes:
4. F1(1, ,3)
Can I call 4th way?
Try F1(1,undefined, 3)
It would seem to be cleaner to supply the default value as found in the documentation for that function:
F1(1,-1,3);
Since F1 may be variable, perhaps supplied as a function parameter, the
actual value used for an undefined parameter may vary. Moreover, I have
a case where undefined actually means leaving out a bit of processing.
Zero would have the same effect, but waste time.
If an undefined value is needed, then define one. I believe that var U
does this in a satisfactory manner, though a longer name might be
preferred.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
> Since F1 may be variable, perhaps supplied as a function parameter, the actual value used for an undefined parameter may vary. Moreover, I have a case where undefined actually means leaving out a bit of processing. Zero would have the same effect, but waste time.
If an undefined value is needed, then define one. I believe that var U does this in a satisfactory manner, though a longer name might be preferred.
I can't traslate correctly...... ... :-((
Lee <RE************ **@cox.net> writes: It would seem to be cleaner to supply the default value as found in the documentation for that function:
F1(1,-1,3);
If you know the default value, and if there is one.
The default value for any omitted argument in Javascript *is*
undefined. However, you can only omit at the end of the argument list,
not in the middle.
A function can distinguish between
F1(1)
and
F1(1,undefined)
only by looking at arguments.lengt h, or by checking
'1' in arguments
(although it seems to be bugged in Opera)
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Dr John Stockton <sp**@merlyn.de mon.co.uk> writes: If an undefined value is needed, then define one. I believe that var U does this in a satisfactory manner, though a longer name might be preferred.
In ECMAScript, "undefined" is a global variable holding the undefined
value.
If you target non-ECMAScript browsers, you can ensure that it is defined
with a sigle, otherwise harmless, line:
window.undefine d = window.undefine d;
It has the advantage of working in any scope. If you know you are at
the root scope, you can just use
var undefined;
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.' This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: William Ryan |
last post by:
I just picked up a copy of John Robbins' debugging book and started to look
at disassembled code. Anyway, I hate optional Parameters in VB, but I was
checking them out to see what IL is created. I've done this before with
Modules, and saw that <gasp> they behave just like sealed classes with only
static members.
Anyway, it looks like Optional Parameters are nothing but a way to tell the
compiler to write some overloads for you. So, in...
|
by: ad |
last post by:
Does C#2.0 support optional parameters like VB.NET:
Function MyFunction(Optional ByVal isCenter As Boolean = False)
|
by: Jeff |
last post by:
Help!!
I'm trying to convert a visual basic stand alone program
into a Web Program using C#. There are a lot of Oracle
packages already written that I am trying to use
(unsuccessfully). Can someone point me in the right
direction on how to call an Oracle package into a
datagrid??
something like:
|
by: Do |
last post by:
Hi:
What's the syntax for an optional parameter in my function? I've done so
many ASP 3.0 Web Classes that
I haven't experienced the "Optional" parameter.
Eg. Public function adduser(ByVal firstname as String, ByVal Lastname as
String)
End Function
|
by: John Morgan |
last post by:
Does anyone know what parameter should be used instead of Date = 0 for the
optional parameter in the following function?
Public Function dhAge(ByVal dtmBD As Date, Optional ByVal dtmDate As Date =
0) As Short
| |
by: deko |
last post by:
In VB, I could do this:
MyFuncrion(this As String, that As Integer, Optional otherThing As Boolean)
do stuff here
End Function
In C#, I can use "out" to return multiple values from a method, and "params"
to send in an array, but is it possible to have optional parameters? How do
I do this in C#?
|
by: Memphis Steve |
last post by:
Is it possible to combine multiple javascipts into one file and then call that file from a linked URL in the head section of an XHTML file?
Here are the two scripts I want to use with the instructions on where to normally place them in an XHTML document:
SCRIPT #1:
Step 1: Insert the below anywhere into the <body> section of your page where you wish the clock to be displayed:<script>
/*
Live Date Script-
|
by: dhtml |
last post by:
Array.splice({})
What should it do?
I think it should return a new Array with length 0.
Array.splice(arr, start, deleteCount ]])
http://bclary.com/2004/11/07/#a-15.4.4.12
Example:
|
by: amitpatel66 |
last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations:
Concurrent programs can be executed programatically either from UNIX or Oracle PLSQL. In this Section, I will be explaining about calling a Concurrent program from UNIX using the CONCSUB Command.
Pre-requisite:
1. Concurrent Program should be registered in oracle Applications...
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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: 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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |