Jscript can group a group of variables into a type definition.
I created this simple program. It adds 3 numbers.
// create a type
function AddTheseNumbers(first,second,third) {
this.One = first;
this.Two = second;
this.Three = third;
}
function OnComputeOutputs(params)
{
var First = params.ConValue('First');
var Second = params.ConValue('Second');
var Third = params.ConValue('Third');
var NewList = new AddTheseNumbers(First, Second, Third);
var NewAdd = AddNumbers(NewList);
params.ConValue('AddResult') = NewAdd;
}
function AddNumbers(ListofNumbers)
{
return (ListofNumbers.One + ListofNumbers.Two + ListofNumbers.Three);
}
Define a Type
Define a Type
- Attachments
-
- Type Example.zip
- (3.31 KiB) Downloaded 337 times
Re: Define a Type
Interesting, Shell1850.
I have not looked at the jscript spec, so I'd like to know...
is the word 'this' a keyword in jscript? And if so, is it significant
in relation to how the data structure is instantiated?
In other words, can we use the word: 'that' in place of 'this'?
Or any other variable name for that matter, in your sample code?
Thanks
Froo
I have not looked at the jscript spec, so I'd like to know...
is the word 'this' a keyword in jscript? And if so, is it significant
in relation to how the data structure is instantiated?
In other words, can we use the word: 'that' in place of 'this'?
Or any other variable name for that matter, in your sample code?
Thanks
Froo
- clintonman
- Captain
- Posts: 5428
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
Re: Define a Type
Here's a link to a similar topic.
http://www.webbasedprogramming.com/Spec ... pt/ch4.htm" onclick="window.open(this.href);return false;
http://www.webbasedprogramming.com/Spec ... pt/ch4.htm" onclick="window.open(this.href);return false;
- clintonman
- Captain
- Posts: 5428
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
Re: Define a Type
Nope, "this" is a special keyword. From JScript docs, "Refers to the current object""The this keyword is typically used in object constructors to refer to the current object"froo wrote:Interesting, Shell1850.
I have not looked at the jscript spec, so I'd like to know...
is the word 'this' a keyword in jscript? And if so, is it significant
in relation to how the data structure is instantiated?
In other words, can we use the word: 'that' in place of 'this'?
Or any other variable name for that matter, in your sample code?
Thanks
Froo
I think c or c++ has something similar and I know python also uses it.
Re: Define a Type
Thanks clinton.
That's what I was suspecting. C++ uses it.
That's what I was suspecting. C++ uses it.