Javascript equivalent for PHP openssl_encrypt

I have PHP code to encrypt plain string.

base64_encode is used to make the AES-256 encrypted string url-safe.

<?php
echo base64_encode(openssl_encrypt($messageToEncrypt, "AES-256-CBC", $key, true, str_repeat(chr(0), 16)));
?>

I need javascript version of this encrypt code which yields the same result.

Any help will be appriciated.

Thank you!!