I am looking for a way to extract public key from certificate x509 (PEM format) in javascript like this one:
openssl x509 -in cert.cer -pubkey -noout > pub.txt
You need something that can parse ASN.1 structure. You could use pkijs.
Demo can be found here