Introductory Mobile Application Development

Case 3: Data, Control Structures, and Simple Objects

Think-Design-Write Test-Code

5 Days

  • Description

Having conquered variables, operations,  functions,  and their use you now move on to creating and using collections of variables.  The two main ways to group data in JavaScript are arrays and associative arrays.

You decide to create three applications.  The first allows you to build two arrays of numbers in the code, display all of the values of both arrays, then merge and sort them.  The second application is similar but uses two arrays of strings instead of numbers.

The third application creates an associative array, and then pulls values from it displaying the associated keys and values.

  • Deliverables
    1. Test matrices that show the expected inputs and outputs for each application.
    2. An application that builds two arrays of numbers in the code, displays all of the values of each array, then merges, sorts, and displays the resulting sorted array.  It should then reverse the array and display the result.  Lastly it should replace 4 of the elements of the array and then display all of the results again.
    3. An application that builds two arrays of strings in the code, displays all of the values of each array, then merges, sorts, and displays the resulting sorted array.  It should then reverse the array and display the result.  Lastly it should replace 4 of the elements of the array and then display all of the results again.
    4. An application that builds an associative array where the keys are the 12 names of the months and the values are the month numbers.  It should display the key and value.  It should then replace the values associated with each key with an appropriate string chosen from ’spring’, ’summer’, ‘fall’, or ‘winter’.  The new key value pairs should then be displayed.
  • Resources
    1. JavaScript Arrays
    2. JavaScript Associative Arrays
    3. for loop
    4. while loop
    5. for – in loop
    6. exiting a loop early

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.