Telegram Web
๐Ÿ‘9๐Ÿคฃ8๐Ÿคฉ5๐Ÿ”ฅ4โค3
๐Ÿค” How to Build a Snake AI Game with Docker and TensorFlow.js

Youโ€™ve probably heard about people โ€˜vibe codingโ€™ games by letting LLMs do the coding work, but what if you want to build a game yourself that has neural network powered elements? TensorFlow.js offers one solution that you could just as easily adapt to non-gaming contexts.

Manvar and Raina (Docker)
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘10โค2๐Ÿ”ฅ2
CHALLENGE

const user = {
profile: {
name: 'Alice',
social: null,
getDetails() {
return { verified: true };
}
}
};

const result = [
user?.profile?.name,
user?.profile?.social?.handle,
user.profile.getDetails?.()?.verified,
user?.nonExistent?.property
];

console.log(result);
๐Ÿ‘7
๐Ÿ‘ Introducing Motion for Vue

Motion is a popular and powerful animation library most commonly associated with React, but now thereโ€™s a new Vue flavor and itโ€™s feature complete, too.

Matt Perry (Motion)
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘6โค5
CHALLENGE

function Vehicle(type) {
this.type = type;
}

Vehicle.prototype.getType = function() {
return this.type;
};

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

Car.prototype = Object.create(Vehicle.prototype);
Car.prototype.constructor = Car;

const myCar = new Car('Tesla');
myCar.type = 'electric';

console.log(myCar.getType(), myCar instanceof Vehicle, myCar.constructor.name);
โค1
๐Ÿ‘6โค4๐Ÿค”3
๐Ÿ˜ญ
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿค”32๐Ÿ‘6โค2
CHALLENGE

const target = { a: 1, b: 2 };
const handler = {
get(obj, prop) {
return prop in obj ? obj[prop] * 2 : 'Not found';
}
};

const proxy = new Proxy(target, handler);

// Add a property to the original target
target.c = 3;

// Attempt to access properties through proxy and Reflect
console.log([
proxy.a,
proxy.z,
Reflect.get(target, 'b'),
Reflect.get(proxy, 'c')
]);
๐Ÿ‘4
๐Ÿ‘8๐Ÿค”7โค3๐Ÿ”ฅ1
CHALLENGE

type User = {
id: number;
name: string;
role?: 'admin' | 'user';
};

function processUser(user: Partial<User>): string {
const defaultUser: User = {
id: 0,
name: 'Guest',
role: 'user'
};

const mergedUser = { ...defaultUser, ...user };

if (mergedUser.role === 'admin') {
return `Admin: ${mergedUser.name}`;
}

return `User: ${mergedUser.name} (ID: ${mergedUser.id})`;
}

console.log(processUser({ name: 'John', role: 'admin' }));
๐Ÿ‘7โค1
๐Ÿ”ฅ6๐Ÿ‘4โค2
๐Ÿ‘12โค4๐Ÿค”4
CHALLENGE

function processConfig(config) {
const cache = config.cache ?? true;
const timeout = config.timeout ?? 1000;
const retries = config.retries ?? 3;

return {
useCache: cache,
timeoutMs: timeout,
maxRetries: retries
};
}

const result = processConfig({ timeout: 0, retries: false });
console.log(result);
๐Ÿ‘3
CHALLENGE

function processInput(userInput) {
const defaultValue = 'default';
const value1 = userInput?.value ?? defaultValue;
const value2 = userInput?.value || defaultValue;

const result = {
a: 0 ?? 'zero',
b: '' ?? 'empty',
c: null ?? 'null',
d: undefined ?? 'undefined',
comparison: value1 === value2
};

console.log(result);
}

processInput({ value: '' });
๐Ÿ‘7
๐Ÿ‘8โค2๐Ÿ”ฅ2๐Ÿคฃ2๐Ÿค”1
CHALLENGE

class ShoppingCart {
constructor() {
if (ShoppingCart.instance) {
return ShoppingCart.instance;
}

this.items = [];
ShoppingCart.instance = this;
}

addItem(item) {
this.items.push(item);
}

getItems() {
return [...this.items];
}
}

const cart1 = new ShoppingCart();
const cart2 = new ShoppingCart();

cart1.addItem('Book');
cart2.addItem('Laptop');

console.log(cart1.getItems());
๐Ÿ‘6
๐Ÿ‘10๐Ÿค”3โค2๐Ÿ”ฅ2๐Ÿคฉ1
2025/07/14 02:08:47
Back to Top
HTML Embed Code: