You're viewing the legacy docs. They are deprecated as of May 18, 2016.
These docs are for version 2.4.2 and below of the Javascript SDK. Go to our current docs, or see our Web migration guide.

Version 2.4.2Changelog

Query.endAt()

Using startAt(), endAt(), and equalTo() allows us to choose arbitrary starting and ending points for our queries. For example, using our sample database of dinosaur facts, we can find all dinosaurs whose names come before Pterodactyl lexicographically by combining orderByKey() and endAt():

var ref = new Firebase("https://dinosaur-facts.firebaseio.com/dinosaurs");
ref.orderByKey().endAt("pterodactyl").on("child_added", function(snapshot) {
  console.log(snapshot.key());
});

The ending point is inclusive, so children with exactly the specified value will be included in the query. The optional key argument can be used to further limit the range of the query. If it is specified, then children that have exactly the specified value must also have a key name less than or equal to the specified key.

You can read more about endAt() in our querying data documentation.