Question: In this [FIDDLE](https://jsfiddle.net/uLr6o99e/2/) how can I select the first child if I have other child?

```
<div class="root">
  <div>5</div>
  <div class="child">1</div> // i want this one

</div>
<div class="root">

  <div class="child">2</div> 

</div>
<div class="root">

  <div class="child">3</div> 

</div>

```

I try this css below but it doesn't work

```
.root:first-of-type  .child:first-of-type {
   color: red;
}

```

Answer: 
Sorry for slow reply. I changed my code as this works instead and I am happy with how it works.
The questions in the future will be populated via the internet via a loop.

```
struct Question {
    var categoryName  : String
    var questionTitle : String
    var answerA       : String
    var answerB       : String
    var answerC       : String
    var answerD       : String
    var correct       : String
}

public struct QuestionLibrary {
  var questions: [Question]
}

let QuizQuestions =

QuestionLibrary(
    questions: [

    Question(
        categoryName: "General Knowledge",
        questionTitle: "Question 1",
        answerA: "A", answerB: "B", answerC: "C", answerD: "D", correct: "D"),
    Question(
        categoryName: "Music",
        questionTitle: "Question 2",
        answerA: "A", answerB: "B", answerC: "C", answerD: "D", correct: "A"),
    Question(
        categoryName: "Film",
        questionTitle: "Question 3",
        answerA: "A", answerB: "B", answerC: "C", answerD: "D", correct: "B")

])

```

My code then to retrieve questions based on the category is:

```
let questionLibrary = QuizQuestions.questions
var questionPack: Array<Question>?

questionPack = questionLibrary.filter({c in c.categoryName == "Music" })

```

I then select a random question

```
let question = questionPack![randomNumber]

```

And to display the question text is

```
question.questionTitle

```

So, my earlier question was about running functions in an array which I learnt I didn't need to do. But least I've answered so it might have others who need similar code :)
You are looking up a 'library' based on its name; use a `Dictionary`. Your 'library' is going to hold some stuff (as libraries are wont to do) and allow some behaviors - so capture it as an abstraction.

```
class Library {             // maybe this is a 'questionPack'
  // stuff in a library     //   that is okay, change the name
}

var libraryMap : [String:Library] = 
  ["Music": Library(/*...*/),
   "Film" : Library(/*...*/),
   "General Knowledge" : Library(/*...*/)
   // ....
   ]

if let library = libraryMap[playQuestionLibraryText] {
  // do something with the library
}

```