Quiz

  1. I don't quite understand the localeCompare function

    There are two parts to this answer. First, localeCompare is a method on a string that takes another string as an argument and returns negative (before), zero, or positive (after).

    
        x = "ape";
        y = "cat";
        z = "dog";
        y.localeCompare(z);  // negative: "cat" before "dog"
        y.localeCompare(x);  // positive: "cat" after "ape"
    
    

    It turns out that different languages (English, Swedish, French) sort strings differently, depending on the language. See Using Locales

  2. There is nothing I would like to talk more about, the reading was clear.

    Amazing!