Cross origin policy for s3 bucket using javascript

Hello,

I want to add cross origin policy for s3 bucket using javasrcipt. But I am not getting any example of code to add cross origin in bucket.

Please guide me how to add cross origin policy for s3 using javascript.

Regards,
Saransh