Web Programming

Codings Web Page

The objective of this exercise is to provide a web page that allows a text to be encoded with various codings.

Tasks

  1. In the script codings.js rewrite the Coding constructor function as class with the methods encodeChar and encode, and export the coding objects as an ES6 module.
  2. Write a web page codings.html that imports a JavaScript module main.js and contains an input field, a selection list of codings, and a button.
  3. Implement the JavaScript module main.js which imports the coding objects and uses them to encode the text of the input field when the button is clicked.
  4. (Optional) If the Morse coding is selected, display an additional button for playing the generated Morse code using the script morse.js.

Solution