A php and js test that was completed for a job. I got an offer because of this. Read the requirements first to understand why some things aren't best practice e.g. scripts.js file.
Your goal is to generate a PHP script that utilizes an object oriented approach to do the following:
- Create a base animal class that contains a serial number property
- Create the following child classes "goat" and "sheep"
- Generate 100 unique and random prime numbers from 0 to 10,000. Attribute each "serial" prime number to a baby goat, and store in file goat.txt.
- Generate serial numbers using the same method for sheep, and save in sheep.txt.
- Find all instances where the serial numbers assigned to goat and sheep are equal and save these serials to a new file called soulmates.txt.
- Output to screen: interesting facts about each set of serial numbers generated (ie. average sum, mean, . get creative)
Build a mini address book to showcase your JavaScript and DOM talents. Objectives:
- The app will consist of a 'select multiple' html element to list contacts
- Create input elements so that the user can add a valid 'name' and a 'telephone' value for a new contact and an 'add' button which adds contact to list
- Contact information in each select 'option' tag can be displayed in anyway you like
- Once contacts exist in the multi - select element, the user should be able to select and press a 'delete' button to remove multiple at a time
- Add buttons to sort contacts by name and telephone number
Bonus:
- Use additional fields aside from name and telephone and allow sorting on them, ie: last name, email, etc...
- Use native JavaScript to generate all DOM elements
- Minimize/eliminate use of JQuery - this test is meant to evaluate your core JavaScript skills without relying on frameworks such as jQuery
- Write your app in an object - oriented approach - define object properties and use them, ie: prototype or function - object pattern
Restrictions:
- The application is to be written in a single index.html file
- Optionally, include a single style.css, scripts.js, and just jQuery (if you really need it) * no other libraries/frameworks are permitted
- Evaluation Criteria:
- Use of 'select multiple' html tag/element for displaying contacts
- Use of objects, ie: some sort of contact object (prototype/function)
- Code efficiency/effectiveness - no duplicate code, fast code
- Quality of code comments and code/syntax structure
- Field validation, ie: telephone, emails, or not filled
- Use of jQuery - or lack thereof - preferred
- Respect of JavaScript language, ie: avoid hoisting