Table-2 Exercises

< CS101

These exercises use the startsWith and endsWith functions on the baby name data. The baby fields are "name", "rank", "gender", "year". As a reminder, here is the key line from the lecture example -- testing if the name field in a row begins with "Ab":

  ...
  if (row.getField("name").startsWith("Ab")) {
  ...

1.

Write code to print all the rows where the name starts with "X".


table-2-ex1

 

2.

Write code to print all the rows where the name starts with "Xz".


table-2-ex2

 

3.

Write code to print all the rows where the name ends with "x".


table-2-ex3

 


Each click of a Run button saves that code on the computer running the browser. The button below retrieves the all code exercises listed to the right of the button.

count 3 : table-2-ex1 table-2-ex2 table-2-ex3

(code appears here)