1Create a bookmark with the following as the url
2javascript: var v = document.querySelector('video'); var t = prompt('Set the playback rate'); v.playbackRate = parseFloat(t)
3
1var numArray = [140000, 104, 99];
2numArray.sort(function(a, b) {
3 return a - b;
4});
5
6console.log(numArray);
1var names = ["Peter", "Emma", "Jack", "Mia", "Eric"];
2names.sort(); // ["Emma", "Eric", "Jack", "Mia", "Peter"]
3
4var objs = [
5 {name: "Peter", age: 35},
6 {name: "Emma", age: 21},
7 {name: "Jack", age: 53}
8];
9
10objs.sort(function(a, b) {
11 return a.age - b.age;
12}); // Sort by age (lowest first)
1//sort an array of strings
2var fruitSalad = ['cherries', 'apples', 'bananas'];
3fruit.sort(); // ['apples', 'bananas', 'cherries']
4
5//sort an array of numbers
6var scores = [1, 10, 2, 21];
7scores.sort(); // [1, 10, 2, 21]
8// Watch out that 10 comes before 2,
9// because '10' comes before '2' in Unicode code point order.
10
11//sorts an array of words
12var randomThings = ['word', 'Word', '1 Word', '2 Words'];
13randomThings.sort(); // ['1 Word', '2 Words', 'Word', 'word']
14// In Unicode, numbers come before upper case letters,
15// which come before lower case letters.