Skip to content

Instantly share code, notes, and snippets.

View manavm1990's full-sized avatar
🏠
Working from home

Manav Misra manavm1990

🏠
Working from home
View GitHub Profile

FormData API

Given this HTML form:

<form id="contact-form">
  <input name="email" type="email" required />
  <input name="phone" type="tel" />
  <textarea name="message" required></textarea>
  <button type="submit">Send</button>
</form>

Ticket #5: Implement findPokemonById Assigned to: Groups 8 & 9
Estimated time: 25 minutes
Difficulty: ⭐⭐⭐ Medium-Hard

What You're Doing Create a new function findPokemonById that finds a Pokemon by its ID number. This ticket focuses on error handling and robust function design.

Tasks

  1. ✍️ Write comprehensive tests FIRST (TDD)

Ticket #4: Add calculateAverageHP

Assigned to: Group 7 (or combine with another group)
Estimated time: 20 minutes
Difficulty: ⭐⭐ Medium

What You're Doing

Create a brand new function calculateAverageHP that calculates the average HP of Pokemon in a list. Use TDD approach.

Tasks

  1. ✍️ Write the tests FIRST

Ticket #2: Fix the Tie Bug

Assigned to: Groups 3 & 4
Estimated time: 20 minutes
Difficulty: ⭐⭐ Medium

What You're Doing

The getStrongestPokemon function has a bug - when multiple Pokemon have the SAME attack stat, it only returns the first one. We need to return ALL tied Pokemon.

Tasks

  1. 🧪 Write a test that DEMONSTRATES the bug

Ticket #1: Complete Filter Tests

Assigned to: Groups 1 & 2
Estimated time: 15-20 minutes
Difficulty: ⭐ Easy

What You're Doing

The filterByType function works perfectly, but it only has ONE test. Add more tests to make sure it handles all cases.

Tasks

  1. ✅ Read the existing test for fire type

Understanding Hoisting in JavaScript

Hoisting is a JavaScript-specific behavior that moves variable and function declarations to the top of their scope during the compile phase. This means that you can use variables and functions before they’re declared in your code. While this might sound convenient, it can also lead to confusion and bugs if you're not careful.

How Hoisting Works

In JavaScript, there are two main types of hoisting:

  1. Variable Hoisting
    Variables declared with var are hoisted to the top of their scope, but only their declarations are hoisted. The initialization (assignment of a value) remains in place. This can lead to unexpected results.
const monsters = {
demons: {
easy: [
{ name: "Imp", health: 60, damage: 20 },
{ name: "Zombie", health: 20, damage: 10 }
],
medium: [
{ name: "Hell Knight", health: 500, damage: 45 },
{ name: "Cacodemon", health: 400, damage: 35 }
],
@manavm1990
manavm1990 / doom-datasets.js
Created March 7, 2025 00:48
For use with the following lesson: http://localhost:3000/functional/array-methods
// Arrays Lesson Data Sets
// Basic numbers array for example
const numbers = [1, 2, 3, 4, 5];
// Players data for multiplayer game examples
const players = [
{ name: 'DoomGuy', frags: 25, deaths: 0 },
{ name: 'Slayer', frags: 25, deaths: 1 },
{ name: 'Marine', frags: 12, deaths: 15 },
@manavm1990
manavm1990 / renovate.json
Created September 21, 2024 12:50
My preferred RenovateBot starter configuration 🔧
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"prHourlyLimit": 3,
"packageRules": [
{
"matchUpdateTypes": ["major"],
"dependencyDashboardApproval": true
@manavm1990
manavm1990 / tsconfig.json
Last active September 19, 2024 17:34
My Strict TS Config
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Base",
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": false,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"skipLibCheck": true,
"strict": true,