@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).
Here we go with the explanations:
(function(x, f = () => x) {
export function createDefaultLoadable() { | |
loading: false, | |
success: false, | |
error: null, | |
} | |
export function onLoadableLoad(loadable) { | |
return { | |
...loadable, | |
loading: true, | |
success: false, |
export interface Loadable { | |
loading: boolean; | |
success: boolean; | |
error: any; | |
} |
export interface News { | |
loading: boolean; | |
entities: string[]; | |
} |
{ | |
"name": "ws-proxy", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", |
const { | |
getChange | |
} = require('./getChange'); | |
const assert = require('assert'); | |
const TESTS = [{ | |
dealDetails: [1, 1], | |
change: [0, 0, 0, 0, 0, 0] | |
}, | |
{ |
const { | |
buildSquareStr | |
} = require('./buildSquareStr'); | |
const assert = require('assert'); | |
const SQUARES = { | |
1: `■`, | |
3: [`□□□`, `□■□`, `□□□`].join('\n'), | |
5: [`■■■■■`, `■□□□■`, `■□■□■`, `■□□□■`, `■■■■■`].join('\n'), | |
7: ['□□□□□□□', '□■■■■■□', '□■□□□■□', '□■□■□■□', '□■□□□■□', '□■■■■■□', '□□□□□□□'].join('\n'), |
@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).
Here we go with the explanations:
(function(x, f = () => x) {
// что возвращает эта функция? | |
(function fun(Infinity, length, __proto__) | |
{ | |
return [,,~0.[0|0]][fun.__proto__.length && Infinity, -~String(this).length >> __proto__] << (0. === .0) + Infinity; | |
}).apply(typeof fun, [,,2]); | |
// рассмотрим массив с аргументами: | |
// "0" in [,,2] => false | |
// "1" in [,,2] => false |
// In global NS to make debug more easier | |
var PAGES_DELAY = 3000; | |
var profiles = []; | |
function step1() { | |
console.log(`Process page: ${window.location}`); | |
$('a[href*="/profile"]').toArray().forEach((a) => profiles.push(a.getAttribute('href'))); | |
console.log(profiles.length, $('a[href*="/profile"]').length); | |
if(!$('a.page-link.next').length) { | |
return; |
var DIRECTION_DOWN = -1 | |
var DIRECTION_NONE = 0 | |
var DIRECTION_UP = 1 | |
function HardwareElevator(){}; | |
HardwareElevator.prototype = { | |
moveUp:function(){console.log('moving up');}, | |
moveDown:function(){console.log('moving down');}, | |
stopAndOpenDoors:function(){console.log('stopping and opening doors');}, | |
getCurrentFloor:function(){console.log('getting current floor');}, |