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 :)
i did a code to this question, using subscript

I created a class collection to manage your question. I believe the friend solution just remove () is more easy and correctly, but i created this class to complement my studies, because this I like enter here to try new solutions.

```
    class QuestionCollection
    {
        struct QuestionItem {
            var categoryName:String;
            var function:()->Void //Here can add return type you need
        }

        private var dicCallbacks:[String:QuestionItem] = [String:QuestionItem]();

        func add(categoryName:String, closure:()->Void  //Here can add return type you need )
        {
            dicCallbacks[categoryName] = QuestionItem(categoryName: categoryName, function: closure);
        }

        subscript(categoryName:String)->()->Void  //Here can add return type you need
        {
            get
            {

                if let callback = self.dicCallbacks[categoryName]
                {
                    return callback.function;
                }

                return error;
            }

            set
            {
                dicCallbacks[categoryName] = QuestionItem(categoryName: categoryName, function: newValue);
            }
        }

        func error()->Void
        {
            println("error try catch closure function")
        }

    }

```

How use this class

```
    func musicTest()
    {
        println("test Music");
    }

    func musicGK()
    {
        println("test Music");
    }

    func musicFilm()
    {
        println("test Music");
    }

    var questionCollection = QuestionCollection();
    questionCollection["Music"] = musicTest
    questionCollection["General Knowledge"] = musicGK
    questionCollection["Film"] = musicFilm

    questionCollection["Music"]();
    questionCollection["General Knowledge"]();
    questionCollection["Film"]();

```