Building a fun program (Some possible HTML knowledge is required.)
This program is to just help people make their own code. The outline of this program:
Advantages:
- Functions and other stuff generated by just a few clicks
Disadvantages:
- No semicolons
- Rather hard to click and long-winded if the program made is long.
Procedure:
- Each function is built separately
- When a function is built, a prompt will be initiated to find the name of the function. Note that the word used must be checked.
- Then another prompt will ask for the variables (Input ALL variables, separated by commas)
- Result will be shown on screen in intervals: var thisFunction = function(variable1,variable2,variable3…) {};
- Then we will allow anything that JavaScript can do afterwards.
- Afterwards, the user can copy out the function and use it.
<form> <input type=button value="Start!" onClick="buildFunction()"> </form> <textarea rows="40" cols="80"> </textarea>
One thing to consider is to use other programming languages to create this project. For example, this snippet outlines how to write a menu option in F#.
open System
let goto f = f()
printfn("Welcome to the JavaScript Code Creator. Please select an option.")
printfn("Press 0 to create a function.")
printfn("Press 1 to create an alert.")
printfn("Press 2 for other options.")
let useroption = Console.ReadLine()
if useroption = 0 then
goto functioncreate
else if useroption = 1 then
goto alertcreate
else if useroption = 2 then
goto miscellaneousoptions
else
printfn("Invalid input. Please input either 0, 1, or 2.")
let functioncreate() = printfn("What would you like your function to be called?")
let functionname = Console.ReadLine()
printfn("How many parameters would you like your function to have?")
let parameternumber = Console.ReadLine()