Skip to content

Instantly share code, notes, and snippets.

for (const i of [1, 2, 3, 4]) {
if (i === 3) break;
log(i);
}
abc: {
log('a');
if (location.href.includes('.com')) break abc;
log('b');
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
.test {
width: 100px; height: 100px;background: red;
}
@keyframes spin{
to{transform:rotateY(360deg) rotateZ(360deg) rotateX(720deg)}
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
@keyframes spin{
to{transform:rotateX(360deg);}
}
html, body{height: 100%;}
body{perspective:800px;background:#404040}
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
@keyframes origin{
0%{perspective-origin:0% 50%}
50%{perspective-origin:100% 50%}
100%{perspective-origin:0% 50%}
}
var a = { valueOf() { return null; }, toString() { return null; }};
a + 1 === 1
@shallaa
shallaa / call.js
Created September 20, 2017 07:53
a.call === Function.prototype.call
var a = function(a) { console.log(this.a); return a; };
console.log(a.apply.call(a, { a: 'b' }, ['c']));
console.log(a.call.apply(a, [{ a: 'd' }, 'e']));
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
@keyframes ani {
from { width: 0; }
to { width: 100%; }
}
</style>
<html><head></head><body>
<section id="todo"></section>
<script>
const TaskState = class {
static addState(key, cls) {
const v = new cls();
if (!(v instanceof TaskState)) throw 'invalid cls';
if ((TaskState._subClasses || (TaskState._subClasses = new Map())).has(key)) throw 'exist key';
TaskState._subClasses.set(key, cls);
}
<html><head></head><body>
<section id="todo"></section>
<script>
const TaskState = class {
static addState(key, cls) {
const v = new cls();
if (!(v instanceof TaskState)) throw 'invalid cls';
if ((TaskState._subClasses || (TaskState._subClasses = new Map())).has(key)) throw 'exist key';
TaskState._subClasses.set(key, cls);
}