I hereby claim:
- I am fortunee on github.
- I am fortunee (https://keybase.io/fortunee) on keybase.
- I have a public key ASC3YsJqVSRn-c0Zmf-EIWfNmRbamUvNhllvnUNdZeuh2wo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| // Rule #6 example (arrow functions) | |
| function RuleSix() { | |
| this.value = 'Some value for rule #6'; | |
| this.printValue = () => { | |
| console.log('Rule six value >>>>', this.value); | |
| } | |
| } | |
| const ruleSix = new RuleSix(); | |
| const printRuleSixVal = ruleSix.printValue; |
| // Rule #5 example | |
| function RuleFive() { | |
| this.value = 'Some value for rule #5'; | |
| this.printValue = function() { | |
| console.log('Rule five value >>>>', this.value); | |
| } | |
| } | |
| const ruleFiveInstance = new RuleFive(); |
| // Rule #4 example | |
| this.value = 'Some value'; | |
| function ruleFour() { | |
| console.log('Rule four value >>>>', this.value); | |
| } | |
| // Refers to the global "this" value | |
| ruleFour(); |
| // Rule #3 example | |
| function RuleThree() { | |
| this.value = 'Some value for rule #3'; | |
| this.printValue = function() { | |
| console.log('Rule three value >>>>', this.value); | |
| } | |
| } | |
| const ruleThreeInstance = new RuleThree(); | |
| const ruleThreePrintValue = ruleThreeInstance.printValue; |
| // Rule #2 example | |
| function RuleTwo() { | |
| this.value = 'Some value for rule #2'; | |
| this.printValue = function() { | |
| console.log('Rule two value >>>>', this.value); | |
| } | |
| } | |
| const ruleTwoInstance = new RuleTwo(); |
| // Rule #1 example | |
| function RuleOne() { | |
| this.value = 'Some value for rule #1'; | |
| this.printValue = function() { | |
| console.log('Rule one value >>>>', this.value); | |
| } | |
| } | |
| // using the new keyword here creates a brand new object for "this" | |
| const ruleOneInstance = new RuleOne() |
| class Node { | |
| constructor(data) { | |
| this.data = data; | |
| this.children = []; | |
| } | |
| } | |
| class Graph { | |
| constructor(root) { | |
| this.root = root; |
| const selectionSort = function(array) { | |
| let temp; | |
| for(let i = 0; i < array.length; i++) { | |
| let minIndexVal = i; | |
| for(let j = i + 1; j<array.length; j++) { | |
| if(array[j] < array[minIndexVal]) { | |
| minIndexVal = j; | |
| } |
| /** | |
| * Insertion sort: | |
| * Big O notation of O(n^2) due to the double loop | |
| */ | |
| const insertionSort = (items) => { | |
| /** | |
| * 1. Loop through array of unsorted items | |
| * 2. Grab the value of the current iteration index | |
| * 3. Initialize j index for a second loop back through the sorted section | |
| * 4. Loop back and compare the last item in the sorted section with the |