javascript | Unsorted

Telegram-канал javascript - JavaScript

31615

A resourceful newsletter featuring the latest and most important news, articles, books and updates in the world of #javascript 🚀 Don't miss our Quizzes! Let's chat: @nairihar

Subscribe to a channel

JavaScript

CHALLENGE


function Shape() {}
function Circle(radius) {}
Circle.prototype = Object.create(Shape.prototype);
const shape = new Shape();
console.log(shape instanceof Circle);

Читать полностью…

JavaScript

CHALLENGE


function Animal() {}
function Dog() {}
Dog.prototype = Object.create(Animal.prototype);
const rover = new Dog();
console.log(rover.hasOwnProperty('constructor'));

Читать полностью…

JavaScript

CHALLENGE


function Shape() {}

function Circle(radius) {
this.radius = radius;
}

Circle.prototype = Object.create(Shape.prototype);
Circle.prototype.constructor = Circle;

const shape = new Shape();
const circle = new Circle(5);

console.log(circle instanceof Circle);
console.log(circle instanceof Shape);
console.log(shape instanceof Circle);
console.log(shape instanceof Shape);

Читать полностью…

JavaScript

CHALLENGE


function Animal() {}

function Dog() {}

Dog.prototype = Object.create(Animal.prototype);

const rover = new Dog();

console.log(rover.constructor === Animal);
console.log(rover.constructor === Dog);
console.log(Dog.prototype.isPrototypeOf(rover));
console.log(Animal.prototype.isPrototypeOf(rover));

Читать полностью…

JavaScript

CHALLENGE


function Product(name, price) {
this.name = name;
this.price = price;
}

Product.prototype.discount = function(discount) {
this.price -= discount;
};

const product = new Product('Phone', 500);
product.discount(50);

console.log(product.price);

Читать полностью…

JavaScript

❓ CHALLENGE


const promise = new Promise((resolve, reject) => {
setTimeout(() => reject(new Error('Rejected')), 1000);
});

promise
.then(result => console.log(result))
.catch(error => console.error(error.message))
.then(() => console.log('After catch'))
.then(() => console.log('After then'))
.catch(error => console.error(error.message));

Читать полностью…

JavaScript

❓ CHALLENGE


const promise = new Promise((resolve, reject) => {
setTimeout(() => resolve(3), 1000);
});

promise
.then(result => {
console.log(result);
return result * 2;
})
.then(result => {
console.log(result);
return new Promise(resolve => setTimeout(() => resolve(result * 3), 1000));
})
.then(result => {
console.log(result);
});

Читать полностью…

JavaScript

❓ CHALLENGE


const promise = new Promise((resolve, reject) => {
setTimeout(() => reject(new Error('Error')), 1000);
});

promise
.then(result => console.log(result))
.then(result => console.log(result))
.catch(error => console.error(error.message))
.finally(() => console.log('Finally'));

Читать полностью…

JavaScript

❓ CHALLENGE


function Shape() {}
function Circle(radius) {}
Circle.prototype = Object.create(Shape.prototype);
const shape = new Shape();
console.log(shape instanceof Circle);

Читать полностью…

JavaScript

❓ CHALLENGE


function Person(name) {
this.name = name;
}

Person.prototype.sayName = function() {
console.log('My name is ' + this.name);
};

const john = new Person('John');

console.log(john.sayName === Person.prototype.sayName);

Читать полностью…

JavaScript

❓ CHALLENGE


function Animal() {}

function Dog() {}

Dog.prototype = Object.create(Animal.prototype);

const rover = new Dog();

console.log(rover.constructor === Animal);

Читать полностью…

JavaScript

❓ CHALLENGE


function Animal() {
this.type = 'animal';
}

function Dog() {
this.name = 'dog';
}

Dog.prototype = new Animal();

const rover = new Dog();
const spot = new Dog();

console.log(rover instanceof Dog);
console.log(rover instanceof Animal);
console.log(rover instanceof Object);

console.log(rover === spot);
console.log(rover.constructor === Dog);
console.log(rover.constructor === Animal);

Читать полностью…

JavaScript

❓ CHALLENGE


function Car(make) {
this.make = make;
}

function Truck(make) {
this.make = make;
}

const car = new Car('Toyota');
const truck = new Truck('Toyota');

console.log(car.__proto__ === truck.__proto__);
console.log(car.constructor === truck.constructor);
console.log(car instanceof Truck);
console.log(car instanceof Car);
console.log(Truck.prototype.isPrototypeOf(car));
console.log(Car.prototype.isPrototypeOf(truck));

Читать полностью…

JavaScript

❓ CHALLENGE


console.log('Start');

setTimeout(() => console.log('Timeout'), 0);

Promise.resolve().then(() => console.log('Promise'));

console.log('End');

Читать полностью…

JavaScript

❓ CHALLENGE


console.log('Start');

Promise.resolve().then(() => console.log('Promise'));

const foo = n => {
console.log('Function call');
n > 0 && foo(n - 1);
};

setTimeout(() => foo(2), 0);

Читать полностью…

JavaScript

🤟 ehmicky/execa-9-release-d0d5daaa097f">Execa 9.0: The Better child_process Gets Even Better

Less shell-oriented than zx, execa focuses on making executing external commands secure, cross-platform, and easy to debug. v9 lets you make commands iterable so you can process their output on the fly, map/filter both input and output, pipe multiple commands, and more. GitHub repo.

EHMICKEY, SORHUS, ET AL.

Читать полностью…

JavaScript

🏤 Building the most performant web applications with Angular

ArmenVardanyan
Author of
"Modern Angular"
Google DevExpert for Angular

Читать полностью…

JavaScript

😆 ...

Читать полностью…

JavaScript

👸 Dear Subscribers,

We hope you're enjoying the content on our channel! ❤️

To continue delivering more exciting content, features, and exclusive stories, we're kindly asking telegram premium users to help us take things to the next level.

By boosting our channel, you'll directly contribute to enhancing your viewing experience and supporting the growth of our community.

Thank you for being a part of our journey. 🚀

P.S. Each Premium user can boost 4 times.

/channel/javascript?boost

Читать полностью…

JavaScript

👀 Pintora: An Extensible Text-to-Diagram Rendering Library

A similar idea to Mermaid but with a different attitude to extensibility as well as no requirement for a headless browser server-side. The intro docs have both visual and code examples.

HIKERPIG

Читать полностью…

JavaScript

😉 Seamless Drag and Drop Between Applications

A fantastic demonstration of using browser APIs to create more elegant drag and drop experiences that even work across different browser windows or IFRAMEs, with Atlassian’s Pragmatic Drag and Drop library doing the heavy lifting.

ALEX REARDON

Читать полностью…

JavaScript

😱 Development Notes from xkcd's 'Machine'

I bet many of you are fans of xkcd! For this year’s April Fools’ joke, they published ‘Machine’, a giant Rube Goldberg machine of sorts (explained here). With a lot of TypeScript up front and Haskell in the back, here’s how it works at a technical level. (GitHub repo.)

MAX GOODHART

Читать полностью…

JavaScript

🏤 Demystifying the push & pull nature of Angular Signals

Tomas Trajan

Читать полностью…

JavaScript

😉Postgres is all you need for your AI application (EN)

Varik Matevosyan
Software Engineer (Lantern, YC W24)

Читать полностью…

JavaScript

🤟 Five Node Version Managers Compared

In an ideal world, the latest version of Node would slot well into every project, but in reality we often need to switch versions, and a variety of tools are available to make it simple. NVM is perhaps the best known, but maybe N, FNM, Volta, or even pnpm could suit you better?

PAVEL ROMANOV

Читать полностью…

JavaScript

👀 DerbyJS 4.0: The Mature MVC Web Framework

It’s never been the most popular of the frameworks, but Derby has lived through most of Node’s history and remains a viable option for building realtime, collaborative apps in particular. GitHub repo.

NATE SMITH ET AL.

Читать полностью…

JavaScript

😂

Читать полностью…

JavaScript

😯 Virtual x86: x86 Virtualization with JS and WASM

Run Linux, numerous older versions of Windows, BSD, MS-DOS, and other systems right in the browser (and quickly, too). Not a new project, but I’m always impressed how it’s constantly getting updates. GitHub repo.

FABIAN HEMMER

Читать полностью…

JavaScript

🍿 Emoji Mart 5.6

Emoji selection component for the Web.

Читать полностью…

JavaScript

🍊 extension.js: Zero-Config, Cross Browser Extension Dev Starter

The goal is to make it as simple as a npx extension create my-extension to get started with building your own browser extensions. GitHub repo.

CEZAR AUGUSTO

Читать полностью…
Subscribe to a channel