This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style> | |
| .buy { | |
| margin-bottom: 20px; | |
| } | |
| </style> | |
| <div class='container'> | |
| <div class='mini-basket'> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Check for presence of computing promo blocks (hidden by default) | |
| Check the cookie and search through SKUs to see if any anti-virus or MS office are in basket | |
| If no MS office display add to basket block and initiliase add to basket | |
| or if MS office show added to basket block | |
| If no antivirus display add to basket block and initiliase add to basket |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| var url = '//media.ao.com/cdnbundle/client/4.0.90.0/bundled/BTS/css/MasterStructure.css'; | |
| var ajax = new XMLHttpRequest(); | |
| ajax.onreadystatechange = function() { | |
| if(this.readyState === 4 && this.status === 200) { | |
| console.log(this.responseText); | |
| } | |
| }; | |
| ajax.open('GET', url, true); | |
| ajax.send(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function makeNull(a) { | |
| a = null; | |
| console.log('makeNull?', a); | |
| } | |
| var obj = { a: 1 }; | |
| makeNull(obj); | |
| console.log('null?', obj); | |
| var str = 'mike'; | |
| makeNull(str); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function prop(obj) { | |
| return function(prop) { | |
| return obj[prop]; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Create a Stack constructor that | |
| - creates an object that stores strings within a single string | |
| - that has a way of delimiting strings | |
| - has a push, pop, concat method that works exactly like their array counterparts | |
| - has an indexesOf method that behaves just like Array.prototype.indexOf but will also find all indexes if more than one exist | |
| - does your constructor initialise with a single string or an array of strings? | |
| - does it have to be called as a constructor / class - could it just be an object / function? | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Modify the below to create a new builder constructor pattern | |
| Give Video a static property called `make` - an object - that creates the following API: | |
| Video.make | |
| .setSrc('/videos/video.mpeg') | |
| .setTitle('AO Video') | |
| .setLoop(true); | |
| which returns a new instance of Video |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Array.prototype.fill | |
| Can only modify an array that has a length of at least 1 | |
| It changes ALL the values of an array to a single value. | |
| Make a betterFill method that fills an empty array | |
| And takes a first argument which is the length of the array | |
| And a second which is the values to insert | |
| The second should be either a single value or an array of values |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* without making `counter` a global variable refactor callMe | |
| so the recursion it's attempting works correctly | |
| and it logs 'Finished' when complete | |
| var callMe = function() { | |
| const counter = 0; | |
| if(counter == '10') { | |
| console.log('Finished'); | |
| } | |
| counter++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // choose an attribute style | |
| const AwesomeComponent = ({ onAwesomeHappening }) => ( | |
| <div className={`${styles.awesomeHolder}`}> | |
| <span | |
| data-mode="awesome-mode" | |
| data-tagging="awesome-btn-click" | |
| className={`${styles.awesomeBtn}`} | |
| onClick={ () => onAwesomeHappening('Awesome!') }> | |
| Save | |
| </span> |