Javascript: Lexicographic Sorting

In Javascript, what would you expect the following expression to produce?

[1, 10, 8].sort();

If you thought this would evaluate to [1, 8, 10], you would benefit from a better understanding of the way Javascript deals with arrays. The above expression actually evaluates to:

[1, 10, 8].sort() = [1, 10, 8]

Why is this? The answer:

  • Javascript arrays can contain any valid value type, including null, String, Number, Boolean or another Object;
  • therefore, the Array.prototype.sort() method first applies the toString() method on each element of the array, and then sorts them in lexicographic order — also known as alphabetical sorting — as opposed to numerical order.

Wearable Tech Pioneer Predicts Google Glass Future

Georgia Tech Director of Contextual Computing Group Thad Starner discusses wearable computing and Google Glass technology on Bloomberg Television’s “Bloomberg West.”

In the interview, Thad Starner makes several interesting points:

  • The first version of a “Glass-like” device came to be in 1993, for which they coined the phrase “wearable computing”.
  • Starner sees the next major breakthrough coming: “a lot of it will be intelligence”, “smart assistants listening in on (your side of) conversations.” [..] “a computer that lives your life with you, learns about the human world.”[1]
  • Wearable technology infused and linked with intelligence will provide an “English butler experience for the average person”.
  • Smartphones are too slow to interact with, and don’t have access to your environment, the context in which you live and operate from minute to minute.
  • Google had independently decided to move into wearable computing, two months before hiring Mr. Starner to be one of the tech leads on the Glass project at Google[X].
  • Wearable devices have been around since the 1990s. The first were mp3 players, which are now ubiquitous. “We’ll see a constellation of devices around the body.”

[1] The recent movie “Her” offers an interesting vision of what it might be like to live with an “AI assistant” looking over our shoulder.