CHALLENGE
const str = " Hello, World! ";
const result = str
.trim()
.split(", ")
.map((word, i) => {
if (i % 2 === 0) return word.toUpperCase();
return word.toLowerCase().replace("!", "@");
})
.reverse()
.join(" | ");
console.log(result);
β€3
What is the output?
Anonymous Quiz
21%
HELLO | world@
27%
HELLO | WORLD!
14%
hello | WORLD@
39%
world@ | HELLO
π₯8β€5π1
Please open Telegram to view this post
VIEW IN TELEGRAM
π5π₯2β€1
CHALLENGE
function Vehicle(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
this.speed = 0;
}
Vehicle.prototype.accelerate = function (amount) {
this.speed += amount;
return this;
};
Vehicle.prototype.describe = function () {
return `${this.year} ${this.make} ${this.model} going ${this.speed}km/h`;
};
function ElectricVehicle(make, model, year, range) {
Vehicle.call(this, make, model, year);
this.range = range;
}
ElectricVehicle.prototype = Object.create(Vehicle.prototype);
ElectricVehicle.prototype.constructor = ElectricVehicle;
ElectricVehicle.prototype.describe = function () {
return Vehicle.prototype.describe.call(this) + ` | Range: ${this.range}km`;
};
const car = new ElectricVehicle("Tesla", "Model 3", 2023, 500);
car.accelerate(60).accelerate(40);
console.log(car.describe());
console.log(car instanceof ElectricVehicle);
console.log(car instanceof Vehicle);
console.log(car.constructor === ElectricVehicle);β€2
What is the output?
Anonymous Quiz
23%
2023 Tesla Model 3 going 100km/h | Range: 500km true true false
29%
2023 Tesla Model 3 going 100km/h | Range: 500km true false true
31%
2023 Tesla Model 3 going 60km/h | Range: 500km true true true
17%
2023 Tesla Model 3 going 100km/h | Range: 500km true true true
β€4π₯1
Google has open sourced a new tool (JSIR) and proposed an industry-standard IR (Intermediate Representation β if an AST tells you what the code looks like, an IR tells you what it does) for JavaScript. Already used at Google for analysis and code transformation, the underlying idea could form a foundation for a new generation of tooling.
Zhixun Tan (Google)
Please open Telegram to view this post
VIEW IN TELEGRAM
β€4π4π₯2
CHALLENGE
function createUser(
name,
role = "viewer",
permissions = [role],
metadata = { createdBy: name, level: permissions.length }
) {
return { name, role, permissions, metadata };
}
const user1 = createUser("Carlos");
const user2 = createUser("Diana", "admin", ["read", "write", "delete"]);
const user3 = createUser("Eve", "editor", undefined, { createdBy: "system", level: 99 });
console.log(user1.role, user1.permissions, user1.metadata.level);
console.log(user2.metadata.createdBy, user2.permissions.length);
console.log(user3.permissions[0], user3.metadata.level);
β€1π1π₯1
What is the output?
Anonymous Quiz
24%
viewer [ 'viewer' ] 1 Carlos 3 editor 99
26%
viewer [ 'role' ] 1 Diana 3 editor 1
40%
viewer [ 'viewer' ] 1 Diana 3 editor 99
10%
viewer [ 'viewer' ] 0 Diana 3 editor 99
β€3π€3π2
In CSS is DOOMed, Niels Leenheer shows off how he implemented a version of 1993's Doom using purely CSS rendering (with the game logic in JavaScript). Play it for yourself or check out the code.
π₯7β€4
CHALLENGE
const name = "Carlos";
const age = 28;
const score = 95;
const player = {
name,
age,
score,
greet() {
return `${this.name} (${this.age}) scored ${this.score}`;
},
get rank() {
return this.score >= 90 ? "Gold" : "Silver";
}
};
const { name: playerName, rank, greet } = player;
console.log(`${playerName} | ${rank} | ${greet.call(player)}`);
π€5β€2π1
Want a search feature tolerant to ambiguous input without a dedicated backend? v7.3 adds per-term fuzzy matching and a static method for single string matching, while v7.4 beta adds worker-based distributed search for tackling huge datasets. A demo shows off the basics.
Kiro Risk
Please open Telegram to view this post
VIEW IN TELEGRAM
β€9π₯1
CHALLENGE
const config = {
host: "localhost",
port: 3000,
db: {
name: "mydb",
retries: 5
}
};
Object.freeze(config);
config.port = 9999;
config.newProp = "injected";
config.db.retries = 99;
delete config.host;
console.log(
config.port,
config.newProp,
config.db.retries,
config.host
);
β€2π₯2π1
What is the output?
Anonymous Quiz
32%
3000 undefined 5 localhost
33%
9999 injected 99 undefined
26%
3000 undefined 99 localhost
9%
3000 injected 5 undefined
β€9π€2π₯1
For the past few years I've been doing pwn challenges - starting from basic stack overflows, progressing through libc heap exploitation, writing a CheatEngine clone in Rust, and prototyping an eBPF-based record-replay tool that required bypassing vDSO. I felt fairly comfortable with systems programming and userspace exploitation.
But challenges like QEMU escape or browser exploitation always seemed like a different league. Something I wasn't "ready for yet." That feeling created an artificial barrier - I kept telling myself I needed more preparation before even attempting them.
....
D4RK7ET (Varik Matevosyan)
Please open Telegram to view this post
VIEW IN TELEGRAM
β€9π7π₯2
CHALLENGE
const memoize = (fn) => {
const cache = new Map();
return (...args) => {
const key = JSON.stringify(args);
if (cache.has(key)) {
return cache.get(key);
}
const result = fn(...args);
cache.set(key, result);
return result;
};
};
let callCount = 0;
const expensiveMultiply = memoize((a, b) => {
callCount++;
return a * b;
});
console.log(expensiveMultiply(3, 4));
console.log(expensiveMultiply(3, 4));
console.log(expensiveMultiply(2, 5));
console.log(expensiveMultiply(3, 4));
console.log(`calls: ${callCount}`);
β€6π₯4π2
What is the output?
Anonymous Quiz
28%
12 12 10 12 calls: 2
31%
12 undefined 10 12 calls: 3
24%
12 12 10 12 calls: 3
17%
12 12 10 12 calls: 4
π₯4β€1
CHALLENGE
const config = {
version: 1,
settings: { theme: "dark", fontSize: 14 },
tags: ["beta", "v1"],
};
Object.seal(config);
Object.freeze(config.settings);
config.version = 99;
config.newProp = "ignored";
delete config.tags;
config.settings.theme = "light";
config.settings.newKey = "ignored";
config.tags.push("v2");
config.tags[0] = "stable";
console.log(
config.version,
config.newProp,
config.settings.theme,
config.tags
);
π₯4π1
CHALLENGE
"use strict";
function createCounter() {
let count = 0;
return {
increment() { count++; },
get value() { return count; },
reset: function() { count = 0; }
};
}
const counter = createCounter();
counter.increment();
counter.increment();
counter.increment();
const { value, reset } = counter;
reset();
console.log(counter.value, value);
β€4π₯2