User Tools

Site Tools


eg-259:lecture6

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
eg-259:lecture6 [2013/02/07 20:48] – [Another Example] eechriseg-259:lecture6 [2013/02/07 21:09] (current) – [Exercises] eechris
Line 693: Line 693:
     myPlane = new Plane("Cessna", "Centurian", "1970");      myPlane = new Plane("Cessna", "Centurian", "1970"); 
 </code> </code>
 +
 +[[http://jsfiddle.net/cpjobling/s8kFw/6/|Fiddle with constructors]].
  
 ---- ----
  
 Note by convention, constructors use upper case names to distinguish them from ordinary functions. Think //proper noun//. Note by convention, constructors use upper case names to distinguish them from ordinary functions. Think //proper noun//.
- 
  
 ===== Method Properties ===== ===== Method Properties =====
Line 772: Line 773:
 ===== Exercises ===== ===== Exercises =====
  
-Write, test and debug (if necessary) XHTML files that include JavaScript scripts for the following problems. When required to write functions, you must include a script to test the function with at least two different data sets.+Use jsFiddle or some other method to write, test and debug (if necessary) HTML files that include JavaScript scripts for the following problems. When required to write functions, you must include a script to test the function with at least two different data sets.
  
   - //Output//: A table of numbers from 5 to 15 and their squares and cubes, using alert.   - //Output//: A table of numbers from 5 to 15 and their squares and cubes, using alert.
-  - //Output//: The first 20 Fibonacci numbers, which are defined as in the following sequence 1, 1, 2, 3, … where each number in the sequence is the sum of the two previous numbers. Use ''document.write'' to produce the output.+  - //Output//: The first 20 Fibonacci numbers, which are defined as in the following sequence 1, 1, 2, 3, … where each number in the sequence is the sum of the two previous numbers. Use ''console.log'' to produce the output.
   - Modify the script of Exercise 2 to input a number, //n//, using ''prompt'', which is the number of the Fibonacci number required as output.   - Modify the script of Exercise 2 to input a number, //n//, using ''prompt'', which is the number of the Fibonacci number required as output.
   - //Function//: ''no_zeros''; //Parameter//: An array of numbers; //Result//: The array must be modified to remove all zero values. //Returns//: ''true'' if the given array included zeros; ''false'' otherwise.   - //Function//: ''no_zeros''; //Parameter//: An array of numbers; //Result//: The array must be modified to remove all zero values. //Returns//: ''true'' if the given array included zeros; ''false'' otherwise.
eg-259/lecture6.1360270122.txt.gz · Last modified: 2013/02/07 20:48 by eechris