Quick Start

One page summary of how to use JPigLatin

Installation

  1. Via CDN

Replace version with current version, i.e 1.0.3

<script src="https://unpkg.com/jpiglatin@VERSION/index.js"></script>

  1. Via NPM

npm i jPigLatin -save

Use

  1. Include jPigLatin in page source

<script src="https://unpkg.com/jpiglatin@1.0.0/index.js"></script>

  1. Create two fields, one for user input and one for output
<span id="input">This is a test</span>
<span id="output"></span>
  1. Use javascript to get pass input to jPigLatin encode() function. Set input and output ElementID’s with local variables.
<script>
    function displayPigLatin(){
        var input = "input";
        var output = "output";
        document.getElementById(output).innerHTML = encode(input,output);
    }
</script>
  1. Use an event loader to execute function
<button onclick="displayPigLatin()">Translate</button>

Code Pen Example

See the Pen JPigLatin | JavaScript Pig-Latin Encoder by Tyler Butler (@tcbutler320) on CodePen.

Edit this page on GitHub