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
| js | |
| test | |
| jest(test runner, mock library, assertion library) - https://jestjs.io/ | |
| mock library - sinon - https://sinonjs.org/ | |
| assertion library - chai - https://www.chaijs.com/ | |
| test runner - mocha - https://mochajs.org/ | |
| enzyme - render and dom manipulation library | |
| internationalization | |
| i18next - https://www.i18next.com/ | |
| react-intl - https://formatjs.io/docs/react-intl/ |
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 insertionSort(arr){ | |
| for(let i=1; i < arr.length; i++){ | |
| let key = arr[i]; | |
| let j = i - 1; | |
| while (j >= 0 && arr[j] > key){ | |
| arr[j+1] = arr[j]; | |
| j--; | |
| } |
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
| // Merge Sort Implentation (Recursion) | |
| function mergeSort (unsortedArray) { | |
| // No need to sort the array if the array only has one element or empty | |
| if (unsortedArray.length <= 1) { | |
| return unsortedArray; | |
| } | |
| // In order to divide the array in half, we need to figure out the middle | |
| const middle = Math.floor(unsortedArray.length / 2); | |
| // This is where we will be dividing the array into left and right |
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 MergeSort(array){ | |
| if (array.length === 2){ | |
| if(array[0] > array[1]) return [array[1], array[0]]; | |
| return array; | |
| }; | |
| let arrLength1 = Math.floor(array.length/2); | |
| let arr1 = array.slice(0, arrLength1); |
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
| .three-dots { | |
| text-overflow: ellipsis; | |
| white-space: nowrap; | |
| overflow: hidden; | |
| } |
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 fragment(html) { | |
| var elt = document.createElement("div"); // Пустой элемент | |
| var frag = document.createDocumentFragment(); // Пустой фрагмент | |
| elt.innerHTML = html; // Содержимое элемента | |
| while (elt.firstChild) // Переместить все узлы | |
| frag.appendChild(elt.firstChild); // из elt в frag | |
| return frag; // И вернуть frag | |
| } |
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 isDraggable() { | |
| var div = document.createElement('div'); | |
| return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div) | |
| } |
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
| js> 2.3 % 1 | |
| 0.2999999999999998 |
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
| const k = Object.create(Object.prototype); // => {} with Object.prototype | |
| const l = Object.create(null) // without prototype | |
| const m = new Object(); // => {} with Object.prototype | |
| const f = {} // => {} with Object.prototype |
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
| const a = [1, 2]; // => [1,2] | |
| const b = Array(10); // => [empty * 10]; | |
| const k = new Array(10); // => [empty *10]; | |
| const m = Array.prototype.constructor(10, 12, 13); // => [10, 12, 13]; | |
| const l = Array.prototype.constructor(10); // => [empty * 10]; | |
| const f = new Array(10, 12, 13); // => [10, 12, 13]; |
NewerOlder