Native javascript does not have a toRad function. Or
1) toRad was defined by google-maps somewhere, and brng just points to the wrong object (maybe null ?)
or
2) You need to determine the method yourself
function toRad(degrees){ return degrees * Math.PI / 180; } toRad(180);
source share