Skip to content

Instantly share code, notes, and snippets.

@onproton
Created June 12, 2015 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onproton/67df527099c00e36636c to your computer and use it in GitHub Desktop.
Save onproton/67df527099c00e36636c to your computer and use it in GitHub Desktop.
Programming task:
Implement a JavaScript function that looks for certain types of input in a text
Background:
Our system is handling offers and request between users, an offer can be an item that someone wants to sell and a request can be someone looking for a certain item. 
The system requires users to pay a fee before they can access each other’s contact data, but they can communicate through text messages before they pay this fee to be able to ask questions about items before deciding if they are willing to buy/sell (and pay the fee to access a contact). 

We need to control those messages so that contact data is not entered.
Task:
Investigate the issue, search and find discussions on this topic, try to find out what the possibilities are. Take into account that sometimes editing away part of text by “mistake” can be just as bad as letting contact data slip through. Write a short description of what you have come up with.
Make a list of contact data formats (for example “aaa@aaa.com”, “aaa aaa.com”, “777 444 777”) that you think are possible to capture, and a list of formats that we probably won’t be able to capture.
Create an HTML-page with just a form containing a text-area and a button, and some elements for output (or use console output if you prefer).
Write a JavaScript function that on button click takes the text entered in the text area and processes the text according to the above with the help of other functions.
Display output as for example “captured ‘here is what is captured’ by function ‘name of function’”. This is for testing purposes

Details:
Make sure each function is doing a separate task. The “onClick”-function will call for example the “emailCheck”-function, “phoneCheck”-function etc. Those functions in turn can use other help functions if needed. Comment your code.
Ask for help whenever needed, no questions are stupid! And it’s ok to ask more times if things are still not clear.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment