Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
Вобщем прикинул: у вас картинка весит 753 байта, а кода в ней на 1059 (хотя я думал там будет 1059*4 байт ибо RGBA, почему вы брали каждый 4-й элемент, храните ещё что-то в RGB?)Я вообще хотел класть во все четыре компоненты, но сжимается лучше всего выбранный вариант.
var a='lineTo';c[a](150,150);c[a](150,200);c[a](150,250);c[a](250,350);c[a](450,350);c[a='lineTo'](150,150);c[a](150,200);c[a](150,250);c[a](250,350);c[a](450,350);
c[a='lineTo'](150,150);c[a](150,200);c[a](150,250);c[a](250,350);c[a](450,350);
var a=z.lineTo.bind(z);a(150,150); ;)9. Замените циклы for на while, избавьтесь от оптимизаций счетчиков c = smth.lengthПотом замените while на for и получите ещё N байт ;)
i=smth.length;while(i--)do(i);
for(i=smth.length;i--;)do(i);
13. Удалите двойные и одинарные кавычки из атрибутов вашего HTML кода <div id=«aaa»> — <div a=aaa>
14. Замените строки в id элементов на числа <div id=aaa> — <div a=1>
<r>. Вроде бы и html короче и путь в querySelectorAll. Конечно, с канвасом так не выйдет.__fillStyle__ = 'fillStyle',
__fillRect__ = 'fillRect',
// =>
__fill__ = 'fill',
__fillStyle__ = __fill__ + 'Style',
__fillRect__ = __fill__ + 'Rect'
__fillStyle__ = 'fillStyle',
__fillRect__ = 'fillRect',
// =>
__fill__ = 'fill',
__stroke__ = 'stroke',
__Style__ = 'Style',
__Rect__ = 'Rect',
__fillStyle__ = __fill__ + __Style__,
__fillRect__ = __fill__ + __Rect__,
__strokeStyle__ = __stroke__ + __Style__,
__strokeRect__ = __stroke__ + __Rect__,
__getElement__ = 'getElement',
__getElementById__ = __getElement__ + 'ById',
__getElementsByTagName__ = __getElement__ + 'sByTagName',
__getElementsByClassName__ = __getElement__ + 'sByClassName',
function foo () {
// foo code
}
function bar () {
// bar code
}
function qux () {
// qux code
}
// =>
function g (fn) {
if (fn == 'foo') {
// foo code
}
if (fn == 'bar') {
// bar code
}
if (fn == 'qux') {
// qux code
}
}
JS1k — пишем отличное веб приложение в 1024 байт