What is the output?
Anonymous Quiz
6%
[]
33%
[[1, 2], [3, 4], [5, 6]]
56%
[1, 2, 3, 4, 5, 6]
5%
[1, [2, 3], 4, [5, 6]]
🔥20👍10❤3
CHALLENGE
const obj = {
valueOf() {
return 42;
}
};
const result = obj + 8;
console.log(result);
👍11❤3🤣3
🤩22👍10❤7
CHALLENGE
function trickyFunction() {
var a = 10;
var b = a;
b = 15;
const obj1 = { x: 1 };
const obj2 = obj1;
obj2.x = 5;
console.log(a + ' ' + b + ' ' + obj1.x);
}
trickyFunction();
🤣10🤔9👍7
👍34🤣19🤔11🔥2🤩1
Awesome Nest Boilerplate architecture element generation based on Angular schematics 🎬
NarHakobyan
Please open Telegram to view this post
VIEW IN TELEGRAM
👍9🔥5❤3
CHALLENGE
function trickyFunction() {
var x = 10;
if (x > 5) {
let y = x * 2;
x = y;
}
return x;
}
console.log(trickyFunction());
👍11❤5
👍31🤣20❤2🤔1
This is an ever-evolving, very opinionated architecture and dev environment for new node projects using NestJS.
NarHakobyan
Please open Telegram to view this post
VIEW IN TELEGRAM
👍9❤3🔥1
CHALLENGE
function trickyFunction() {
var obj = { a: 1 };
var anotherObj = obj;
obj.a = 2;
obj = { a: 3 };
anotherObj.a = 4;
return obj.a + anotherObj.a;
}
console.log(trickyFunction());
❤12🤔6👍2
🔥27👍9❤5🤔2
Please open Telegram to view this post
VIEW IN TELEGRAM
👍8🔥3❤1
CHALLENGE
async function fetchData() {
let data = 'initial';
const promise = new Promise((resolve) => {
setTimeout(() => {
resolve('fetched');
}, 1000);
});
promise.then((result) => {
data = result;
});
return data;
}
fetchData().then(console.log);
👍13❤2
🤔16👍14🤣11❤2🔥2
CHALLENGE
const WM = new WeakMap();
let obj = {};
let anotherObj = {};
WM.set(obj, 'object data');
WM.set(anotherObj, 'another object data');
obj = null;
// Let's check what's logged
console.log(WM.has(obj));
console.log(WM.has(anotherObj));
👍9❤1
❤7👍6🔥4
CHALLENGE
const mySet = new Set();
mySet.add(10);
mySet.add(20);
mySet.add(10);
mySet.add(30);
console.log(mySet.size);
👍13
🤔29🤣22👍15❤10🤩1
CHALLENGE
function* customGenerator() {
yield 'Hello';
yield 'World';
return 'Done';
}
const gen = customGenerator();
console.log(gen.next().value);
console.log(gen.next().value);
console.log(gen.next().value);
👍7❤1