Question: I want to change my css style by JavaScript like i change `transform: rotateZ(120deg)`; 

```
<script>
    var Rotate = ['90deg','120deg','150deg','180deg','210deg','240deg','90deg','120deg','150deg','180deg','210deg','240deg'];
     function Time() {
         var marg, d, hour; 
         marg = document.getElementById("hand");  
         d = new Date(); 
         hour = d.getHours();
         for(i = 0; i < 12; i++) {
             if(hour == i) { 
                 var x=Rotate[i]; 
                 alert(x); 
                 marg.style.transform= "rotateZ(x)";
             }
         }
    }
</script>

```

`alert(x)` is working but `transform` is not working. Is there any way to use array list to change `transform` value?

Answer: 
You are using "rotateZ(x)". Here `x` is not a variable for this script because you are writing it like string. Variables must be written outside `"`.

Use it like this

```
var Rotate = ['90deg', '120deg', '150deg', '180deg', '210deg', '240deg', '90deg', '120deg', '150deg', '180deg', '210deg', '240deg'];

function Time() {
    var marg, d, hour;
    marg = document.getElementById("hand");
    d = new Date();
    hour = d.getHours();
    for (i = 0; i < 12; i++) {
      if (hour == i) {
        var x = Rotate[i];
        alert(x);
        marg.style.transform = "rotateZ("+x+")";
      }
    }

```
I know that is beyond your question, but I think the best possible solution to solve the problem is using different css classes and only change the class name in js.

Fiddling with css properties in js seems really unneccessary to me :(