learning happened, rewritten to Ecmascript 6