JavaScript Examples 

This page is just a little space for me to share some JavaScript coding examples with others.

REMEMBER: To view the source code for each example, be sure to right-click page and then select "View page source" from your web browser's popup menu.

  • Dependent Drop-down Selectors - This page illustrates how to code dependent drop-down selectors. That is, this example shows how the value of a "parent" selector element determines how the values of its child (or dependent) drop-down selector element gets populated.
  • Matrix Swap - This was an interview question I was asked once ==> Write code to swap a 2-dimensional square array across the diagonal: [0,0], [1,1], etc. I have since modified the example slightly to include code to populate and display the matrix as well as to accept input to determine how big the square matrix should be. I think it's a pretty good interview question and I have had the opportunity to ask it to about a half of dozen developers while I worked for SketchUp.
  • Functional Programming Examples - Here are some examples I've worked through in trying to get a better understanding of functional programming using JavaScript.
  • Array and String Problems #1 - Here is a little example that finds the first non-repeated character of a string.
  • Array and String Problems #2 - This example removes characters from a string.
  • Mortgage Calculations - This example computes a fixed monthly mortgage payment.