How effective is using JavaScript to obfuscate email addresses on a website in terms of preventing crawlers from accessing them?

Email addresses on websites are often targeted by web crawlers looking to harvest them for spam purposes. One way to prevent this is by obfuscating the email addresses using JavaScript. This involves encoding the email address in a way that is still readable by humans but difficult for crawlers to extract.

<script type="text/javascript">
    var email = "example@example.com";
    var encodedEmail = "";
    for (var i = 0; i < email.length; i++) {
        encodedEmail += "&#" + email.charCodeAt(i) + ";";
    }
    document.write("<a href='mailto:" + email + "'>" + encodedEmail + "</a>");
</script>