What is the output?
Anonymous Quiz
30%
ReferenceError undefined
30%
TypeError undefined
26%
undefined undefined
15%
TypeError object
❤4
CHALLENGE
console.log(
typeof typeof 1,
1 + typeof 1,
2 ** 3 ** 2,
1 + 2 + '3',
1 < 2 < 3,
3 > 2 > 1
);
🔥2
What is the output?
Anonymous Quiz
29%
string 1number 512 33 true true
26%
string number1 512 33 true false
28%
string 1number 512 33 true false
16%
number number 512 33 true true
❤3
CHALLENGE
function Foo(x) {
this.x = x;
return { x: x * 2 };
}
function Bar(x) {
this.x = x;
return 42;
}
const f = new Foo(5);
const b = new Bar(5);
console.log(f.x, b.x, f instanceof Foo, b instanceof Bar);❤4
What is the output?
Anonymous Quiz
16%
5 5 false true
38%
10 5 true true
28%
10 5 false true
18%
10 42 false true
CHALLENGE
function* inner() {
yield 1;
yield 2;
return 100;
}
function* outer() {
const result = yield* inner();
yield result;
yield 3;
}
const it = outer();
console.log(it.next().value, it.next().value, it.next().value, it.next().value);❤5👍2🤔1
What is the output?
Anonymous Quiz
22%
1 2 100 3
51%
1 2 100 undefined
19%
1 2 3 undefined
8%
1 2 undefined 3
❤1
I built an app with this and was impressed. You get a txiki.js-powered backend with full system access (including FFI!), native webview rendering, and tiny macOS, Linux, and Windows builds. It even makes it easy to sign/notarize the final app.
Tarwin Stroh-Spijer
Please open Telegram to view this post
VIEW IN TELEGRAM
❤6👍2
CHALLENGE
class Base {
static count = 0;
static increment() {
this.count++;
return this.count;
}
}
class Derived extends Base {
static count = 10;
}
console.log(Base.increment(), Derived.increment(), Base.count, Derived.count);❤1
❤2🔥2👍1
CHALLENGE
let counter = 0;
const mod = {
get counter() { return counter; },
increment() { counter++; }
};
const { counter: snapshotCounter } = mod;
mod.increment();
mod.increment();
console.log(snapshotCounter, mod.counter, counter);
🔥2❤1
❤1🔥1🤣1
CHALLENGE
const obj = {
value: 42,
getValue() { return this?.value; },
getValueArrow: () => this?.value
};
const { getValue, getValueArrow } = obj;
console.log(obj.getValue(), getValue(), obj.getValueArrow(), getValueArrow());❤1
What is the output?
Anonymous Quiz
21%
42 42 undefined undefined
35%
42 undefined 42 42
15%
42 42 42 42
29%
42 undefined undefined undefined
❤1
CHALLENGE
class Base {
value = 10;
getValue = () => this.value;
constructor() {
this.value = 20;
}
}
class Derived extends Base {
value = 30;
}
const d = new Derived();
console.log(d.getValue(), d.value);❤3🔥1
CHALLENGE
let order = [];
function a() {
try {
return 'try';
} finally {
order.push('a-finally');
return 'a-final-return';
}
}
function b() {
try {
throw new Error('x');
} catch (e) {
order.push('b-catch');
return 'b-catch-return';
} finally {
order.push('b-finally');
}
}
console.log(a(), b(), order.join(','));
🔥1
CHALLENGE
const order = [];
order.push('start');
setTimeout(() => { order.push('timeout'); console.log(order.join(',')); }, 0);
Promise.resolve().then(() => order.push('promise1'));
async function foo() {
order.push('foo start');
await null;
order.push('foo end');
}
foo();
Promise.resolve().then(() => order.push('promise2'));
order.push('end');
❤2🔥1