Happy New Year! ๐ ๐พ
Wishing you fewer meetings, more merges, and no Friday deploys.๐
@JavaScript Telegram Newsletter Team
Wishing you fewer meetings, more merges, and no Friday deploys.
@JavaScript Telegram Newsletter Team
Please open Telegram to view this post
VIEW IN TELEGRAM
โค33๐6๐ฅ4
CHALLENGE
class Vehicle {
#engine = 'V6';
static count = 0;
constructor(type) {
this.type = type;
Vehicle.count++;
}
static getCount() {
return this.count;
}
get info() {
return `${this.type} with ${this.#engine}`;
}
}
class Car extends Vehicle {
static count = 0;
constructor(brand) {
super('car');
this.brand = brand;
Car.count++;
}
}
const tesla = new Car('Tesla');
const ford = new Car('Ford');
console.log(Vehicle.getCount());
console.log(Car.getCount());
console.log(tesla.info);โค3๐2๐ฅ1
What is the output?
Anonymous Quiz
19%
2 0 car with V6
40%
2 2 Tesla with V6
22%
0 2 car with V6
19%
2 2 car with V6
โค8๐2
CHALLENGE
async function fetchData() {
return Promise.resolve('data');
}
async function processData() {
console.log('start');
const result = fetchData();
console.log(typeof result);
const data = await fetchData();
console.log(typeof data);
console.log('end');
}
processData();โค8
What is the output?
Anonymous Quiz
43%
start object string end
32%
start object data end
15%
start string object end
11%
start function string end
โค6๐ค3๐คฃ2
CHALLENGE
function* fibonacci() {
let a = 0, b = 1;
yield a;
yield b;
while (true) {
let next = a + b;
yield next;
a = b;
b = next;
}
}
const gen = fibonacci();
const results = [];
for (let i = 0; i < 6; i++) {
results.push(gen.next().value);
}
console.log(results.join(','));โค4๐1๐ค1
โค3๐ค3๐1๐ฅ1
CHALLENGE
const user = {
name: 'Sarah',
age: 28,
getName() {
return this.name;
}
};
const { getName } = user;
const boundGetName = user.getName.bind(user);
console.log(getName());
console.log(boundGetName());
console.log(user.getName());โค5๐ค2
What is the output?
Anonymous Quiz
23%
undefined undefined Sarah
39%
undefined Sarah Sarah
12%
TypeError Sarah Sarah
26%
Sarah Sarah Sarah
๐8โค1๐ค1
CHALLENGE
function* outer() {
yield 1;
yield* inner();
yield 4;
}
function* inner() {
yield 2;
yield 3;
}
const gen = outer();
console.log(gen.next().value);
console.log(gen.next().value);
console.log(gen.next().value);
console.log(gen.next().value);๐ฅ3โค1๐1
What is the output?
Anonymous Quiz
23%
1 undefined undefined 4
46%
1 2 3 4
21%
1 [object Generator] 4 undefined
10%
1 2 3 undefined
โค3๐ค3๐คฉ1
CHALLENGE
const obj = { a: 1, b: 2, c: 3 };
const entries = Object.entries(obj);
const keys = Object.keys(obj);
const values = Object.values(obj);
const result = {
entriesLength: entries.length,
keysJoined: keys.join('-'),
valuesSum: values.reduce((sum, val) => sum + val, 0),
firstEntry: entries[0]
};
console.log(result.entriesLength);
console.log(result.keysJoined);
console.log(result.valuesSum);
console.log(result.firstEntry);โค1๐ฅ1
What is the output?
Anonymous Quiz
18%
3 a,b,c 6 [ 'a', 1 ]
35%
3 a-b-c 6 [ 'a', 1 ]
37%
3 'a-b-c' 6 [ 'a', 1 ]
10%
3 a-b-c 6 ['a', 1]
๐8๐ค4โค3๐คฃ2๐ฅ1
At the start of each year, Michael rounds up the projects in the JavaScript ecosystem that gained the most popularity on GitHub in the prior year. After a two-year run of topping the chart, shadcn/ui has been pushed down to #3 by n8n and React Bits. This is a fantastic roundup, now in its tenth(!) year, and features commentary from a few industry experts too.
Michael Rambeau et al.
Please open Telegram to view this post
VIEW IN TELEGRAM
โค6๐3๐ฅ3
CHALLENGE
const config = { api: 'v1', timeout: 5000 };
Object.seal(config);
const settings = { theme: 'dark', lang: 'en' };
Object.freeze(settings);
config.api = 'v2';
config.retries = 3;
settings.theme = 'light';
settings.debug = true;
console.log(config.api);
console.log(config.retries);
console.log(settings.theme);
console.log(settings.debug);๐4๐ฅ2
What is the output?
Anonymous Quiz
39%
v2 undefined dark undefined
29%
v1 undefined light true
22%
v2 3 dark undefined
10%
v1 3 light true
๐5๐ฅ3โค2
Available in the form of React/Preact, Vue, Svelte, Angular, or plain JS components. Open source but with a premium version with extra features. GitHub repo.
Tom รsterlund
Please open Telegram to view this post
VIEW IN TELEGRAM
โค8๐ฅ3๐1
CHALLENGE
console.log(typeof myVar);
console.log(typeof myFunc);
console.log(typeof myArrow);
var myVar = 'initialized';
function myFunc() {
return 'function declaration';
}
var myArrow = () => 'arrow function';
console.log(typeof myVar);
console.log(typeof myFunc);
console.log(typeof myArrow);
โค3๐2๐ฅ1
Please open Telegram to view this post
VIEW IN TELEGRAM
โค5๐3๐ฅ3