What is the output?
  Anonymous Quiz
    20%
    ReferenceError: Animal is not defined
      
    18%
    false
      
    24%
    TypeError: Animal.call is not a function
      
    39%
    true
      
    π6β€2π₯2
  CHALLENGE
const company = {
  name: 'TechCorp',
  departments: {
    engineering: {
      head: { name: 'Alice', contact: null },
      staff: 50
    },
    marketing: null
  }
};
const engineeringContact = company.departments.engineering.head.contact;
const marketingHead = company.departments.marketing?.head?.name;
const financeStaff = company?.departments?.finance?.staff ?? 'Not available';
console.log(`${engineeringContact} - ${marketingHead} - ${financeStaff}`);π10π€©2β€1
  What is the output?
  Anonymous Quiz
    25%
    null - undefined - undefined
      
    46%
    null - undefined - Not available
      
    21%
    TypeError: Cannot read property 'contact' of null
      
    8%
    TypeError: Cannot read properties of null (reading 'head')
      
    π₯7π4β€3
  CHALLENGE
const userMap = new WeakMap();
const user1 = { name: 'Alice' };
const user2 = { name: 'Bob' };
userMap.set(user1, { visits: 10 });
userMap.set(user2, { visits: 5 });
// Later in the code...
const entries = [];
for (const obj of [user1, null, user2]) {
if (obj !== null && userMap.has(obj)) {
entries.push(userMap.get(obj).visits);
}
}
console.log(entries.reduce((sum, visits) => sum + visits, 0));
β€4π₯3π2
  What is the output?
  Anonymous Quiz
    22%
    Error: Cannot use 'null' as a key in WeakMap
      
    13%
    10
      
    44%
    15
      
    21%
    [10, 5]
      
    π4β€2π₯2
  PGlite packages a WASM build of Postgres into a TypeScript library that can be run directly from Node.js (or Bun, Deno, and even the browser) and itβs only a few megabytes in size.
ElectricSQL / Neon
Please open Telegram to view this post
    VIEW IN TELEGRAM
  π5β€3π₯2
  CHALLENGE
function outer() {
  let x = 10;
  
  function inner() {
    console.log(x);
    
    if(true) {
      let x = 20;
      console.log(x);
    }
    
    console.log(x);
  }
  
  inner();
}
outer();π7β€1
  What is the output?
  Anonymous Quiz
    15%
    undefined, 20, 10
      
    16%
    10, 20, undefined
      
    55%
    10, 20, 10
      
    14%
    10, 20, 20
      
    π11β€3π₯1
  A tool that runs pnpm inside your browser, βinstallsβ a package, then analyzes its dependencies. This can be useful for analyzing packages you already use, but also for simplifying your own projects, as 11tyβs Zach Leatherman did here.
Anthony Fu
Please open Telegram to view this post
    VIEW IN TELEGRAM
  β€10π6π₯1
  CHALLENGE
const ws = new WeakSet();
const obj1 = { id: 1 };
const obj2 = { id: 2 };
ws.add(obj1);
ws.add(obj2);
ws.delete(obj1);
const obj3 = { id: 2 };
console.log([
ws.has(obj2),
ws.has(obj1),
ws.has(obj3),
ws.has({ id: 2 })
]);
π8π₯2
  What is the output?
  Anonymous Quiz
    16%
    [false, false, false, false]
      
    38%
    [true, false, false, false]
      
    14%
    [true, true, true, false]
      
    32%
    [true, false, true, true]
      
    π8π₯3π€3β€2π€£1
  Please open Telegram to view this post
    VIEW IN TELEGRAM
  β€4π2π₯2
  CHALLENGE
class Task {
  constructor(name) {
    this.name = name;
  }
  async execute() {
    const result = await Promise.resolve(this.name);
    return { result };
  }
}
const task = new Task('test');
task.execute().then(console.log);π₯7π2
  What is the output?
  Anonymous Quiz
    39%
    test
      
    18%
    { result: undefined }
      
    15%
    Promise { <pending> }
      
    28%
    { result: 'test' }
      
    π8β€4π₯2
  It looks deceptively simple β just 14 characters of JavaScript β but after working with JavaScript for 29 years, I got it wrong. A clue: it goes back to a browser-related quirk from 30 years ago..
Hillel Wayne
Please open Telegram to view this post
    VIEW IN TELEGRAM
  π3β€2π₯1
  CHALLENGE
const users = [
{ id: 1, name: 'Alice', age: 25 },
{ id: 2, name: 'Bob', age: 30 },
{ id: 3, name: 'Charlie', age: 35 }
];
const result = users
.filter(user => user.age > 25)
.map(user => user.name.toUpperCase())
.reduce((acc, name) => acc + name[0], '');
console.log(result);
π4π₯3β€2
  π16π€£12π₯5β€3π€2
  Please open Telegram to view this post
    VIEW IN TELEGRAM
  π€£109π9β€2