Skip to content

Instantly share code, notes, and snippets.

@jefsnare
Last active October 17, 2019 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jefsnare/46c82d20eaa9abeb40ff2aae92b20438 to your computer and use it in GitHub Desktop.
Save jefsnare/46c82d20eaa9abeb40ff2aae92b20438 to your computer and use it in GitHub Desktop.
//DO NOT USE FRAMEWORKS
/**
* 1. Below discount rule should have dynamic data
* - Create a function to fill this dynamic data
* - Append to a HTML element with class .container
*/
var discountRule = 'Add two more 2 products and receive 5 euro discount!';
/**
* 2. Expand above code to have unlimited amount of dynamic arguments
* - Use a regulare expression to replace the dynamic arguments
* - Append to a HTML element with class .container
*/
var discountRule = 'Add two more 2 products, receive 5 euro discount and 10 euro shipping discount!';
/**
* 3. Create a prototype public function for above function
* - Use below String.prototype example
* - Define function and execute function, append result to a HTML element with class .container
*/
String.prototype.functionName = function () {}
/**
* 4. Above code should be executed after every AJAX call
* - Create an EventListener and apply the event listener on the correct element
* - When the event is executed, execute the correct function
* - Show how the event should be triggered
*/
element.addEventListener("event", function () { /* Code */ });
@mvhoute
Copy link

mvhoute commented Jan 25, 2017

Add two more 2 products

Moet dit niet

Add two more products

zijn?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment