Another method would be to convert rem into pixels:
function convertRemToPixels(rem) {
return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
}
This can be useful when you must perform some arithmetic in js (such as using the position of the mouse to display a tooltip...)