LOGO100 logo

Amsterdam CODE100 Quiz and Knowledge rounds

Audience Shout Out Rounds

Shoutout Block 1

How many arrays with how many elements does this console.log() return?

function A() { return [[1,2,3],[4,5,6],[7,8,9]] }
function B() { return [1,2,2,5] }
function C() { return [1,4,4,2,[1,1]] }
console.log( [...new Set( 
    [ B(), C(), A() ].map (
        e => e.flat() 
    ).flat() 
) ] )

Answers:

Solution: One array with 9 elements. Each array gets flattened into a single one and the result is turned into a Set, returning only the unique elements. The last flat() turns it into one array. It is the classic question of “If you have 1 hay stack and you add two haystacks to it, how many do you get?”

Shoutout Block 2

What does the following CSS do?

img:not([alt]){
  border: 2px solid firebrick;
}

Answers:

Solution: the not() selector checks if an image has an alt attribute and if it does not it adds a border around it. You can still provide other ways to give an image alternative text than the alt attribute, hence it’s not the third option.

Shoutout Block 3

How many of the following are not valid named CSS colours:

Powderblue, Papayawhip, Honeydew, Peru, Greysmoke Blanchedalmond, Pistachio, Chocolate, Snow, Bisque Gainsboro, Milkshake, Lavender, Peachpuff, Ivory, Ebony

Answers:

Solution: Greysmoke, Milkshake, Ebony and Pistachio are made up. Amazing if you think about Ivory being a valid one. If you feel like playing a game with named colours, I (made one some time ago](https://codepo8.github.io/css-colour-names/).

Shoutout Block 4

What does the following CSS do?

a[href^=http]::after {
  content: " ↗";
}

Answers:

Solution: The selector matches links with an href attribute that starts with http and adds an arrow after them. Unless you have gopher or ftp links that should match them all.

Back to all puzzles