An Array of Challenges #1: Alternating Arrays Alternating Arrays

An alternating array is a list of any length in which two (not necessarily different) values are alternating. That is to say, all even-indexed items are equal, and all odd-indexed items are equal.

Your task is to write a program or function which, when given a list of positive integers, outputs/returns truthy if it is alternating and falsy otherwise.

This is code-golf, so the shortest code (in bytes) wins!

Edge Cases:

[]      -&gt;  True
[1]     -&gt;  True
[1,1]   -&gt;  True
[1,2,1] -&gt;  True


Other Test Cases:

[1,2,1,2]      -&gt; True
[3,4,3]        -&gt; True
[10,5,10,5,10] -&gt; True
[10,11]        -&gt; True
[9,9,9,9,9]    -&gt; True

[5,4,3,5,4,3]   -&gt; False
[3,2,1,2,1,2]   -&gt; False
[1,2,1,2,1,1,2] -&gt; False
[2,2,3,3]       -&gt; False
[2,3,3,2]       -&gt; False


Example

Here is an example you can test your solution against, written in Python 3 (not golfed):

def is_alternating(array):
    for i in range(len(array)):
        if array[i] != array[i%2]:
            return False
    return True
Jelly, 4 bytes

ḣ2ṁ⁼


Try it online!

How it works

ḣ2ṁ⁼  Main link. Argument: A (array)

ḣ2    Head 2; truncate A after its second element. If A has two or less elements,
      this returns A itself.
  ṁ   Mold; cyclically repeat the elements of the previous result to create an
      array that has the same shape/length as A.
   ⁼  Test the result for equality with A.