• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 495
  • Last Modified:

optional parameter syntax in JavaScript

In JScript/JavaScript, what is the official way of not passing (ignoring) an optional parameter to a function?

I'm am using one of the ADO functions, which takes three optional parameters:

In VBScript it is easy:
ObjCommand.Execute , , adCmdText

here, the first two parameters are ignored, and only the third is passed.

But in JavaScript:

ObjCommand.Execute( , , adCmdText);

This (obviously) creates compilation errors.  So what value do I give for parameters 1 and 2 above when I don't want to pass in a value?

Thanks,
Glen
0
gmazza
Asked:
gmazza
  • 3
1 Solution
 
gmazzaAuthor Commented:
Edited text of question.
0
 
gmazzaAuthor Commented:
Adjusted points to 50
0
 
mblaseCommented:
Probably you'd want to pass in an empty string "" or null, depending on what the variable is intended for. The function accepting the variables must have default values built into it, of course.
0
 
gmazzaAuthor Commented:
Apparently, null works. I was looking several places for an official answer for what the optional value is--can't seem to find one--the Microsoft ADO /JScript examples don't appear to give and answer.

Thanks.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now