You can search any Java FFT algorithm and port it to javascript easy.
A example, here :
This implementation require two classes
+ FFT java code (princeton)
+ Complex dependency
This could be easier and direct to apply:
+ FFT Java Code (columbia)
This code it's easy to port to Javascript, only remember that JavaScript functions Math.sin and Math.cos work on radians and not on degrees.