Copy the expression to the text layer's "source text" property. Replace "ReferenceLayer" with the name of your reference layer ie. the layer with the rotation animation. Replace "rotationZ" with the rotation axis you wish to reference.
Incidentally the double inverted commas at the start of line 2 let JavaScript know that the result of this statement will be a string. It will then interpret the "+" operators to the right to be string concatination instead of numeric addition.