2. The number of intersections of the graph of the function $y=x|x|-\left(4 \cos 30^{\circ}\right) x+2$ with the $x$-axis is ( ).
(A) 4
(B) 3
(C) 2
(D) 0
2. B.

When $x>0$,
$$
y=x^{2}-2 \sqrt{3} x+2=(x-\sqrt{3})^{2}-1
$$

the graph intersects the $x$-axis at two points;
When $x<0$,
$$
y=-x^{2}-2 \sqrt{3} x+2=-(x+\sqrt{3})^{2}+5
$$

the graph intersects the $x$-axis at one point.
There are three intersections in total.