<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.numerusinc.com/index.php?action=history&amp;feed=atom&amp;title=Javascript_Light</id>
	<title>Javascript Light - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.numerusinc.com/index.php?action=history&amp;feed=atom&amp;title=Javascript_Light"/>
	<link rel="alternate" type="text/html" href="https://wiki.numerusinc.com/index.php?title=Javascript_Light&amp;action=history"/>
	<updated>2026-05-29T18:10:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.2</generator>
	<entry>
		<id>https://wiki.numerusinc.com/index.php?title=Javascript_Light&amp;diff=1032&amp;oldid=prev</id>
		<title>Rsalter at 18:40, 11 October 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.numerusinc.com/index.php?title=Javascript_Light&amp;diff=1032&amp;oldid=prev"/>
		<updated>2019-10-11T18:40:48Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:40, 11 October 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== NovaScript and JavaScript==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== NovaScript and JavaScript==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;NovaScript is an extension of a well-known and widely used language called JavaScript. This means that NovaScript uses JavaScript syntax for all of its code; moreover, any legal JavaScript program is also a NovaScript program. This includes the code used for initial Stock values, Flows and Terms. Fortunately, there are many good sources for learning to program in JavaScript. We will review a few important ideas about programming as it applies to building &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Nova &lt;/del&gt;models below.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;NovaScript is an extension of a well-known and widely used language called JavaScript. This means that NovaScript uses JavaScript syntax for all of its code; moreover, any legal JavaScript program is also a NovaScript program. This includes the code used for initial Stock values, Flows and Terms. Fortunately, there are many good sources for learning to program in JavaScript. We will review a few important ideas about programming as it applies to building &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Numerus &lt;/ins&gt;models below.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Statements, Commands, Expressions==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Statements, Commands, Expressions==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l10&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==JavaScript Highlights==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==JavaScript Highlights==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;JavaScript has become a prominent language if for no other reason than its role as the standard for programming the behavior of Web browsers. Here is a brief list of JavaScript highlights which will be of particular use in NovaScript. While this review is not enough to teach you how to program, it will help you to understand much of the JavaScript that appears in &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Nova&lt;/del&gt;. Click [https://developer.mozilla.org/en-US/docs/Web/JavaScript here] for a complete JavaScript reference.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;JavaScript has become a prominent language if for no other reason than its role as the standard for programming the behavior of Web browsers. Here is a brief list of JavaScript highlights which will be of particular use in NovaScript. While this review is not enough to teach you how to program, it will help you to understand much of the JavaScript that appears in &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Numerus&lt;/ins&gt;. Click [https://developer.mozilla.org/en-US/docs/Web/JavaScript here] for a complete JavaScript reference.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Variables===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Variables===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l24&quot;&gt;Line 24:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 24:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Datatypes===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Datatypes===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; '''&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;floating point&lt;/del&gt;''': (i.e. real) numbers: 1, 3.14, 2.78e01&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; '''&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Floating Point&lt;/ins&gt;''': (i.e. real) numbers: 1, 3.14, 2.78e01&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; '''&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;character &lt;/del&gt;Strings''': &amp;quot;This is a character string&amp;quot;, &amp;quot;So is this&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; '''&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Character &lt;/ins&gt;Strings''': &amp;quot;This is a character string&amp;quot;, &amp;quot;So is this&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; '''Arrays''': In JavaScript arrays are lists, or sequences, of values indexed by an integer argument. An empty array is created using the new keyword as follows:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; '''Arrays''': In JavaScript arrays are lists, or sequences, of values indexed by an integer argument. An empty array is created using the new keyword as follows:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l42&quot;&gt;Line 42:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 42:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                  }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                  }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;;Functions: Functions are unique in that they are both a datatype and contain actual executable code. JavaScript is one of a small number of computer languages that allow you to treat functions this way (sometimes called '''first class''' treatment). Consequently you can create a function, store it in an object or array, and pass it as data to another function where it can subsequently be executed. This kind of expressiveness turns out to be very useful for constructing complex &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Nova &lt;/del&gt;models.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;;Functions: Functions are unique in that they are both a datatype and contain actual executable code. JavaScript is one of a small number of computer languages that allow you to treat functions this way (sometimes called '''first class''' treatment). Consequently you can create a function, store it in an object or array, and pass it as data to another function where it can subsequently be executed. This kind of expressiveness turns out to be very useful for constructing complex &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Numerus &lt;/ins&gt;models.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:Functions are defined using one of two similar syntaxes:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:Functions are defined using one of two similar syntaxes:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l77&quot;&gt;Line 77:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 77:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   z = (x &amp;gt; y) ? x : y;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   z = (x &amp;gt; y) ? x : y;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The right hand side expression produces one of a pair of values again depending on the outcome of the conditional test. This form is particularly useful in creating the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Nova &lt;/del&gt;expressions that appear in component definitions.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The right hand side expression produces one of a pair of values again depending on the outcome of the conditional test. This form is particularly useful in creating the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Numerus &lt;/ins&gt;expressions that appear in component definitions.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Primitive operators===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Primitive operators===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Actual computation (i.e., combining and manipulating data to create new values) is performed by JavaScript's '''primitive operators''', or '''primops'''. The most familiar primops to most people are the standard arithmetic operators (+, -,* , =). JavaScript provides additional mathematical operators via the '''Math''' object. This is a special object whose properties are bound to various mathematical functions. For example, &amp;lt;tt&amp;gt;Math.sin(x)&amp;lt;/tt&amp;gt; computes the trigonometric sine of the value of x. A reference to the complete listing of available Math primops is provided [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math here]. A second large set of primops is provided by the underscore.js library. These functions are all properties of a special object denoted by the underscore character, _, and are documented on the library's [http://underscorejs.org Web page]. For example, &amp;lt;tt&amp;gt;_.last(a)&amp;lt;/tt&amp;gt; will return the last element of the array a.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Actual computation (i.e., combining and manipulating data to create new values) is performed by JavaScript's '''primitive operators''', or '''primops'''. The most familiar primops to most people are the standard arithmetic operators (+, -,* , =). JavaScript provides additional mathematical operators via the '''Math''' object. This is a special object whose properties are bound to various mathematical functions. For example, &amp;lt;tt&amp;gt;Math.sin(x)&amp;lt;/tt&amp;gt; computes the trigonometric sine of the value of x. A reference to the complete listing of available Math primops is provided [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math here]. A second large set of primops is provided by the underscore.js library. These functions are all properties of a special object denoted by the underscore character, _, and are documented on the library's [http://underscorejs.org Web page]. For example, &amp;lt;tt&amp;gt;_.last(a)&amp;lt;/tt&amp;gt; will return the last element of the array a.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rsalter</name></author>
	</entry>
	<entry>
		<id>https://wiki.numerusinc.com/index.php?title=Javascript_Light&amp;diff=1031&amp;oldid=prev</id>
		<title>Rsalter: Created page with &quot;== NovaScript and JavaScript== NovaScript is an extension of a well-known and widely used language called JavaScript. This means that NovaScript uses JavaScript syntax for all...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.numerusinc.com/index.php?title=Javascript_Light&amp;diff=1031&amp;oldid=prev"/>
		<updated>2019-10-11T18:32:06Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== NovaScript and JavaScript== NovaScript is an extension of a well-known and widely used language called JavaScript. This means that NovaScript uses JavaScript syntax for all...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== NovaScript and JavaScript==&lt;br /&gt;
NovaScript is an extension of a well-known and widely used language called JavaScript. This means that NovaScript uses JavaScript syntax for all of its code; moreover, any legal JavaScript program is also a NovaScript program. This includes the code used for initial Stock values, Flows and Terms. Fortunately, there are many good sources for learning to program in JavaScript. We will review a few important ideas about programming as it applies to building Nova models below.&lt;br /&gt;
&lt;br /&gt;
==Statements, Commands, Expressions==&lt;br /&gt;
&lt;br /&gt;
Programs consist of one or more '''statements''' that operate on data values. The latter are expressed either as constants or variables. Statements are divided between '''expressions''', which compute a value using operators of various sorts (e.g., the arithmetic operators +, -, * and =); and '''commands''', which change the state of the program by assigning values to variables, or by performing some side-effecting operation (e.g. “print”).&lt;br /&gt;
&lt;br /&gt;
The values used in a program are categorized according to their datatype. Virtually all programming languages include one or more numerical types (e.g., '''integer''' and '''reals''', also called floating point). Another common datatype consists of textual data, which are called character '''strings''', or just strings. Finally, languages generally provide some means of combining multiple values into a single entity. These include '''arrays''', which are sequences of values indexed by integers; and structures or '''objects''', in which the components, or fields, are labeled by a string '''property names'''.&lt;br /&gt;
&lt;br /&gt;
==JavaScript Highlights==&lt;br /&gt;
&lt;br /&gt;
JavaScript has become a prominent language if for no other reason than its role as the standard for programming the behavior of Web browsers. Here is a brief list of JavaScript highlights which will be of particular use in NovaScript. While this review is not enough to teach you how to program, it will help you to understand much of the JavaScript that appears in Nova. Click [https://developer.mozilla.org/en-US/docs/Web/JavaScript here] for a complete JavaScript reference.&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Variables are declared using the var keyword:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var x = 17, y = &amp;quot;hello&amp;quot;; &lt;br /&gt;
var y;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the latter case &amp;lt;tt&amp;gt;y&amp;lt;/tt&amp;gt; is initialize to &amp;lt;tt&amp;gt;undefined&amp;lt;/tt&amp;gt;. Variables are not restricted by datatype and can be assigned a value of any JavaScript type.&lt;br /&gt;
&lt;br /&gt;
===Datatypes===&lt;br /&gt;
&lt;br /&gt;
; '''floating point''': (i.e. real) numbers: 1, 3.14, 2.78e01&lt;br /&gt;
; '''character Strings''': &amp;quot;This is a character string&amp;quot;, &amp;quot;So is this&amp;quot;.&lt;br /&gt;
; '''Arrays''': In JavaScript arrays are lists, or sequences, of values indexed by an integer argument. An empty array is created using the new keyword as follows:&lt;br /&gt;
&lt;br /&gt;
  var a = new Array();&lt;br /&gt;
&lt;br /&gt;
:Array constants are denoted using square brackets; e.g., &amp;lt;tt&amp;gt;var b = [1,2,3,4]&amp;lt;/tt&amp;gt;. Similarly, array components use square brackets to denote the index for assignment and access; e.g., &amp;lt;tt&amp;gt;b[0], b[1]&amp;lt;/tt&amp;gt;. Unlike most languages, however, the index set may contain holes; e.g., &amp;lt;tt&amp;gt;b[0], b[1]&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;b[7]&amp;lt;/tt&amp;gt; may be defined while &amp;lt;tt&amp;gt;b[2]&amp;lt;/tt&amp;gt; through &amp;lt;tt&amp;gt;b[6]&amp;lt;/tt&amp;gt; are not.&lt;br /&gt;
&lt;br /&gt;
;Objects: Every other datatype in JavaScript is an object. The simplest of these is the '''Object''' type, which consists of a list of fields. Each field contains a '''property name''' labeling a '''property value'''. A property name must be a string, but the corresponding value can be of any type. When an object field value is a function (see below) we call that function a '''method'''. The '''new''' keyword can be used to construct an empty object, to which name-value pairs can be added:&lt;br /&gt;
&lt;br /&gt;
  var c = new Object();&lt;br /&gt;
&lt;br /&gt;
:Object constants are denoted using curly brackets enclosing the name-value pairs, and may included embedded object constants as values:&lt;br /&gt;
&lt;br /&gt;
  var a_person = {name: &amp;quot;Steve&amp;quot;,&lt;br /&gt;
                  date_of_birth: {month: 1, day: 28, year: 1980}&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
;Functions: Functions are unique in that they are both a datatype and contain actual executable code. JavaScript is one of a small number of computer languages that allow you to treat functions this way (sometimes called '''first class''' treatment). Consequently you can create a function, store it in an object or array, and pass it as data to another function where it can subsequently be executed. This kind of expressiveness turns out to be very useful for constructing complex Nova models.&lt;br /&gt;
&lt;br /&gt;
:Functions are defined using one of two similar syntaxes:&lt;br /&gt;
&lt;br /&gt;
  var double = function(x){return 2 * x;} &lt;br /&gt;
  function triple(y){return double(y) + y;}&lt;br /&gt;
&lt;br /&gt;
:The first case allows you to create a function without the necessity of providing a name. For example, if&lt;br /&gt;
&lt;br /&gt;
  var apply_to_two = function(f){return f(2);}&lt;br /&gt;
&lt;br /&gt;
:Then invoking &amp;lt;tt&amp;gt;apply_to_two(function(z){return z * z;})&amp;lt;/tt&amp;gt; will result in 4. This also shows that functions may be passed as parameters to other functions.&lt;br /&gt;
&lt;br /&gt;
===Program structures===&lt;br /&gt;
&lt;br /&gt;
JavaScript adapts the structure of the C and C++ languages for its code. Common control structures (i.e. coding structures that direct the flow of the program) include '''conditionals''', '''for-loops''' and '''while loops'''. One particularly useful version of the for-loop specific to JavaScript has the following form, assuming variable '''a''' refers to either an array or object:&lt;br /&gt;
&lt;br /&gt;
  for (var i in a) {&lt;br /&gt;
    print(a[i]);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The index variable &amp;lt;tt&amp;gt;i&amp;lt;/tt&amp;gt; will cycle through all defined indices in &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt;. Another important feature involves the conditional, or “if” statement. Suppose we want to assign the maximum of &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;y&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;z&amp;lt;/tt&amp;gt;. One way would be&lt;br /&gt;
&lt;br /&gt;
  if (x &amp;gt; y) {&lt;br /&gt;
    z = x;&lt;br /&gt;
  } else {&lt;br /&gt;
    z = y;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This familiar statement is called a '''conditional command''' because it provides a pair of alternative commands, only 1 of which is actually executed, depending on the outcome of the conditional test.&lt;br /&gt;
&lt;br /&gt;
An alternate way of doing the same thing uses the conditional expression:&lt;br /&gt;
&lt;br /&gt;
  z = (x &amp;gt; y) ? x : y;&lt;br /&gt;
&lt;br /&gt;
The right hand side expression produces one of a pair of values again depending on the outcome of the conditional test. This form is particularly useful in creating the Nova expressions that appear in component definitions.&lt;br /&gt;
&lt;br /&gt;
===Primitive operators===&lt;br /&gt;
&lt;br /&gt;
Actual computation (i.e., combining and manipulating data to create new values) is performed by JavaScript's '''primitive operators''', or '''primops'''. The most familiar primops to most people are the standard arithmetic operators (+, -,* , =). JavaScript provides additional mathematical operators via the '''Math''' object. This is a special object whose properties are bound to various mathematical functions. For example, &amp;lt;tt&amp;gt;Math.sin(x)&amp;lt;/tt&amp;gt; computes the trigonometric sine of the value of x. A reference to the complete listing of available Math primops is provided [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math here]. A second large set of primops is provided by the underscore.js library. These functions are all properties of a special object denoted by the underscore character, _, and are documented on the library's [http://underscorejs.org Web page]. For example, &amp;lt;tt&amp;gt;_.last(a)&amp;lt;/tt&amp;gt; will return the last element of the array a.&lt;/div&gt;</summary>
		<author><name>Rsalter</name></author>
	</entry>
</feed>