Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//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

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.