This file contains 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
'use strict'; | |
/** | |
* Shape class. | |
* | |
* @constructor | |
* @param {String} id - The id. | |
* @param {Number} x - The x coordinate. | |
* @param {Number} y - The y coordinate. | |
*/ |
This file contains 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
// Functional JS to flatten an array... | |
const flatten = (array) => { | |
return array.reduce((flat, toFlatten) => { | |
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten); | |
}, []); | |
} | |
console.log(flatten([[1,2,[3]],4])); |
This file contains 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
//SET UP | |
const users = [{ | |
id: 1, | |
name: 'Bob', | |
schoolId: 101 | |
}, { | |
id: 2, | |
name: 'Jane', | |
schoolId: 999 |
NewerOlder