CHALLENGE
const obj1 = {
a: 1,
method() {
return this.a;
}
};
const obj2 = Object.create(obj1);
obj2.a = 2;
console.log(obj2.method());
π₯7π1π€©1
π₯8π€7π4β€3
Raycasting is a somewhat old fashioned technique to render 3D environments (you may have seen it in 1992βs Wolfenstein 3D) but itβs easy to understand and worth implementing at least once.
Tsoding Daily
Please open Telegram to view this post
VIEW IN TELEGRAM
π9β€3π₯3
CHALLENGE
async function asyncFunc() {
return 'async function';
}
function* generator() {
yield 'generator';
yield asyncFunc();
yield 'done';
}
const gen = generator();
(async function() {
console.log(gen.next().value);
console.log(await gen.next().value);
console.log(gen.next().value);
})();
π9β€3π₯3
What is the output?
Anonymous Quiz
54%
generator, async function, done
24%
generator, Promise, done
12%
generator, undefined, done
9%
generator, async function, undefined
π4π₯2β€1
It feels odd including something about 2023 in June 2024, but the results of the major annual JavaScript developer survey are now out. Itβs interesting to see what features JS devs do and donβt use, changes in library popularity over time, what build tools people are using, the divide between JavaScript and TypeScript usage, and much more besides.
Devographics
Please open Telegram to view this post
VIEW IN TELEGRAM
π7β€2π₯2
CHALLENGE
const obj1 = { a: 1 };
const obj2 = Object.create(obj1);
obj2.b = 2;
console.log(obj2.a, obj2.b);
console.log(obj2.hasOwnProperty('a'));
console.log(Object.getPrototypeOf(obj2) === obj1);
π9β€2
What is the output?
Anonymous Quiz
17%
undefined, 2, true, false
44%
1, 2, true, false
32%
1, 2, false, true
7%
undefined, 2, false, true
β€4π4π€©1π€£1
Please open Telegram to view this post
VIEW IN TELEGRAM
π€£88π€6π5β€3π₯2π€©1
CHALLENGE
const array = [1, 2, 3, 4, 5];
const result = array.filter(n => n % 2).map(n => n * 2);
console.log(result);
β€13π₯3π€©1
β€23π9π€©3
Please open Telegram to view this post
VIEW IN TELEGRAM
β€4π3π₯1
CHALLENGE
const arr = [1, 2, 3, 4, 5];
const [first, , third, ...rest] = arr;
console.log(first, third, rest);
π₯8β€4π1
β€10π9π€7
Give it two images, itβll highlight the differences. Now distributed as a ES module.
Mapbox
Please open Telegram to view this post
VIEW IN TELEGRAM
π9β€3π₯3
CHALLENGE
const obj = {};
let value = 0;
Object.defineProperty(obj, 'prop', {
get() {
return value;
},
set(newValue) {
value = newValue + 1;
},
configurable: true,
enumerable: true
});
obj.prop = 10;
console.log(obj.prop);
π4π€©3β€2
β€11π€7π₯3π1
Finding the intersection, union, and difference between sets, among other set-related tasks, is now a piece of cake. Available in Node 22+, Chrome/Edge 122+, Firefox 127+, Safari 17+, and now considered a 'baseline' feature.
Brian Smith (MDN)
Please open Telegram to view this post
VIEW IN TELEGRAM
π11π₯3β€2π€©1
CHALLENGE
class Parent {
static greet() {
return 'Hello from Parent';
}
}
class Child extends Parent {
static greet() {
return super.greet() + ' and Child';
}
}
const childInstance = new Child();
console.log(childInstance.greet);
π3π€2β€1
What is the output?
Anonymous Quiz
11%
Hello from Parent
71%
Hello from Parent and Child
12%
undefined
7%
TypeError
π₯17π€£12β€6π5π€4
Queens is a puzzle game that combines elements of Minesweeper, chess, and Sudoku.
Fotis Adamakis
Please open Telegram to view this post
VIEW IN TELEGRAM
β€5π3π₯2