1 <!DOCTYPE html>
2 <html>
3
4 <!--
5 File: D:\cssd.local\E\Student Resources\Website Development I\CodeSamples\TestMissingParameters.html
6 Copyright (c) 2009-2022 by Jesse M. Heines. All rights reserved. May be freely
7 copied or excerpted for educational purposes with credit to the author.
8 updated by JMH on September 19, 2009 at 7:09 PM
9 updated by JMH on October 4, 2015 at 11:52 AM
10 updated by JMH on April 23, 2022 at 10:12 AM
11 updated by JMH on May 8, 2022 at 8:38 PM
12 -->
13
14 <head>
15 <title>TestMissingParameters.html</title>
16 <script type="text/javascript">
17 // updated by JMH on September 18, 2009 at 11:50 PM
18 // updated by JMH on October 4, 2015 at 11:52 AM
19 function test( a, b, c ) {
20 document.writeln( "<p>" ) ;
21 document.writeln( "Referencing parameter a <em>returns</em> " + a +
22 "<br>Referencing parameter b <em>returns</em> " + b +
23 "<br>Referencing parameter c <em>returns</em> " + c +
24 "<br> " +
25 "<br><code>( c == null )</code> <em>returns</em> <code>" + ( c == null ) + "</code>" +
26 "<br><code>( c === null )</code> <em>returns</em> <code>" + ( c === null ) + "</code>" +
27 "<br><code>( c === undefined )</code> <em>returns</em> <code>" + ( c === undefined ) + "</code>" +
28 "<br><code>typeof( c )</code> <em>returns</em> <code>" + typeof( c ) + "</code>" +
29 "<br><code>( typeof( c ) == \"undefined\" )</code> <em>returns</em> <code>" + ( typeof( c ) == "undefined" ) + "</code>" +
30 "<br><code>( typeof( c ) == undefined )</code> <em>returns</em> <code>" + ( typeof( c ) == undefined ) ) + "</code>" ;
31 document.writeln( "</p>" ) ;
32 }
33 </script>
34 <style>
35 code {
36 font-weight : bold ;
37 }
38 </style>
39 </head>
40
41 <body>
42 <!-- updated by JMH on September 18, 2009 at 11:50 PM -->
43 <h1>Parameter Test</h1>
44 <p>updated by JMH on September 19, 2009 at 7:09 PM<br>
45 updated by JMH on October 4, 2015 at 11:55 AM</p>
46
47 <p><br>
48 <em><strong>Function definition:</strong></em>
49 <blockquote style="margin-top: 0 ; margin-bottom: 0"><code>function test( a, b, c )</code></blockquote>
50 <em>or</em>
51 <blockquote style="margin-top: 0"><code>var test = function( a, b, c )</code></blockquote>
52 </p>
53 <p>
54 <em><strong>Executing JavaScript function call:</strong></em>
55 <blockquote style="margin-top: 0"><code> test( 1, "one" ) ;</code></blockquote>
56 </p>
57 <p>
58 <em><strong>Results:</strong></em>
59 </p>
60 <script type="text/javascript">
61 test( 1, "one" ) ;
62 </script>
63 </body>
64
65 </html>