9 months ago • Web Crafters

React useFetch Hook 

A clean example of a reusable useFetch custom hook in React. Handles loading, error, and data with ease.

1 year ago • Web Crafters

What is the output of the following code?



var status = "😎 Global";

function showStatus() {
  console.log("1:", status);

  setTimeout(() => {
    console.log("2:", status);
  }, 0);

  if (false) {
    var status = "❌ Block";
  }

  console.log("3:", status);
}

showStatus();

1: 😎 Global 3: 😎 Global 2: 😎 Global

1: undefined 3: undefined 2: undefined

1: undefined 3: 😎 Global 2: 😎 Global

2 votes

1 year ago • Web Crafters

1 year ago • Web Crafters

What is the output of the following code?


class Calculator {

  static add(a, b) {
    return a + b;
  }
}

console.log(Calculator.add(2, 3));

5

undefined

TypeError

null

7 answered

1 year ago • Web Crafters

Smooth scroll

1 year ago • Web Crafters

3 Powerful CSS Functions You Need to Know

1 year ago • Web Crafters

Custom hover Effect

1 year ago • Web Crafters

Smarter layouts with display : contents

1 year ago • Web Crafters

What is the output of the following code?

class Counter {
  constructor() {
    this.count = 0;
  }
  increment() {
    this.count++;
  }
}

const counter1 = new Counter();
const counter2 = new Counter();
counter1.increment();
console.log(counter1.count, counter2.count);

1 0

1 1

0 0

TypeError

2 votes

1 year ago • Web Crafters

What is the output of the following code?

class Animal {
  constructor(name) {
    this.name = name;
  }
  speak() {
    console.log(`${this.name} makes a noise.`);
  }
}

class Dog extends Animal {
  speak() {
    console.log(`${this.name} barks.`);
  }
}

const dog = new Dog("Rex");
dog.speak();

Rex makes a noise.

Rex barks.

undefined

TypeError

3 answered