Embedded Math functions in JavaScript