practicing Javascript, encode then decode a message