Muhammad saifullah

Muhammad saifullah Full Stack Developer||MERN Stack Developer

14/03/2026

*๐Ÿš€ JavaScript Events*

Events make websites interactive. They allow JavaScript to respond to user actions like clicking a button, submitting a form, or typing in an input field.

Example actions:
- Clicking a button
- Submitting a form
- Hovering over an element
- Typing in a textbox

JavaScript listens for these actions and runs code when they happen.

*๐Ÿ”น 1. What is an Event?*
An event is an action that occurs in the browser.

Examples:
- click
- submit
- change
- update

Example:
button.addEventListener("click", function(){
console.log("Button clicked");
});

When the button is clicked โ†’ the function runs.

*๐Ÿ”น 2. Event Listener*
The most common way to handle events.

Syntax:
element.addEventListener("event", function);

Example:
document.getElementById("btn")
.addEventListener("click", () => {
alert("Button clicked!");
});

*๐Ÿ”น 3. Common JavaScript Events*
- click: When user clicks an element
- submit: When form is submitted
- change: When input value changes
- keydown: When a key is pressed
- mouseover: When mouse enters element

Example:
input.addEventListener("change", function(){
console.log("Value changed");
});

*๐Ÿ”น 4. Event Object*
When an event occurs, JavaScript creates an event object containing information about the event.

Example:
button.addEventListener("click", function(event){
console.log(event);
});

The event object contains details like:
- target element
- mouse position
- key pressed

*๐Ÿ”น 5. Event Bubbling*
Events propagate from the child element to the parent element.

Example:
button โ†’ div โ†’ body โ†’ html

If a button inside a div is clicked, the event may trigger on:
- button
- div
- body

This is called event bubbling.

*๐Ÿ”น 6. Event Delegation*
Instead of attaching events to many elements, attach one event to the parent element.

Example:
document.querySelector("ul")
.addEventListener("click", function(event){
console.log(event.target);
});

Benefits:
- Better performance
- Handles dynamically added elements

*โญ Most Important Event Concepts*

Focus on these first:
โœ… click event
โœ… addEventListener()
โœ… event object
โœ… event bubbling
โœ… event delegation

These are used in almost every JavaScript project.

*๐ŸŽฏ Real Example*

HTML:
Click Me

JavaScript:
document.getElementById("btn")
.addEventListener("click", () => {
alert("Hello!");
});

๐Ÿ‘‰ When the user clicks the button โ†’ alert appears.

*Double Tap โ™ฅ๏ธ For More*

13/02/2026

โœ… *JavaScript Basics* ๐ŸŒโœจ

The journey to becoming a front-end or full-stack developer starts with strong JavaScript fundamentals. Here's your starter kit:

*1๏ธโƒฃ Syntax*
โ†’ JavaScript uses `{}` to define code blocks
โ†’ Statements end with `;` (optional but recommended)
```javascript
if (5 > 3) {
console.log("Five is greater than three");
}
```

*2๏ธโƒฃ Variables*
โ†’ `var`, `let`, and `const` used to declare variables
```javascript
let name = "Alice";
const age = 25;
var height = 5.6;
```

*3๏ธโƒฃ Data Types*
โ†’ JavaScript supports:
- *String* โ†’ `"Hello"`
- *Number* โ†’ `100`, `19.99`
- *Boolean* โ†’ `true`, `false`
- *Undefined* โ†’ variable declared but not assigned
- *Null* โ†’ no value
- *Object*, *Array*, *Function*

*4๏ธโƒฃ Type Casting*
โ†’ Implicit and explicit type conversion
```javascript
let x = Number("5"); // string to number
let y = String(100); // number to string
let z = parseFloat("3.14");
```

*5๏ธโƒฃ Input & Output*
โ†’ Browser-based input/output
```javascript
let name = prompt("Enter your name:");
alert("Hello " + name);
console.log("Name entered:", name);
```

*6๏ธโƒฃ Comments*
โ†’ Single-line and multi-line
```javascript
// This is a single-line comment
/* This is
a multi-line comment */
```

*7๏ธโƒฃ Basic Operators*
โ†’ `+`, `-`, `*`, `/`, `%`, `**` for math
โ†’ `==`, `===`, `!=`, `!==`, `>`, `=`, `

13/02/2026

๐Ÿ”ฅ *20 JavaScript Interview Questions*

*1. What are the different data types in JavaScript*
โ€ข String, Number, Boolean, Undefined, Null, Object, Symbol, BigInt
Use `typeof` to check a variableโ€™s type.

*2. What is the difference between == and ===*
โ€ข `==` compares values with type coercion
โ€ข `===` compares both value and type (strict equality)

*3. What is hoisting in JavaScript*
Variables and function declarations are moved to the top of their scope before ex*****on.
Only declarations are hoisted, not initializations.

*4. What is a closure*
A function that remembers variables from its outer scope even after the outer function has finished executing.
Example:
```js
function outer() {
let count = 0;
return function inner() {
count++;
console.log(count);
};
}
const counter = outer();
counter(); // 1
```

*5. What is the difference between var, let, and const*
โ€ข `var`: function-scoped, can be re-declared
โ€ข `let`: block-scoped, can be updated
โ€ข `const`: block-scoped, cannot be re-assigned

*6. What is event delegation*
Using a single event listener on a parent element to handle events from its child elements using `event.target`.

*7. What is the use of promises in JavaScript*
Handle asynchronous operations.
States: pending, fulfilled, rejected
Example:
```js
fetch(url)then(res => res.json())catch(err => console.error(err));
```

*8. What is async/await*
Syntactic sugar over promises for cleaner async code
Example:
```js
async function getData() {
const res = await fetch(url);
const data = await res.json();
console.log(data);
}
```

*9. What is the difference between null and undefined*
โ€ข `null`: intentional absence of value
โ€ข `undefined`: variable declared but not assigned

*10. What is the use of arrow functions*
Shorter syntax, no own `this` binding
Example:
```js
const add = (a, b) => a + b;
```

*11. What is the DOM*
Document Object Model โ€” represents HTML as a tree structure. JavaScript can manipulate it using methods like `getElementById`, `querySelector`, etc.

*12. What is the difference between call, apply, and bind*
โ€ข `call`: invokes function with arguments passed individually
โ€ข `apply`: invokes function with arguments as array
โ€ข `bind`: returns a new function with bound context

*13. What is the use of setTimeout and setInterval*
โ€ข `setTimeout`: runs code once after delay
โ€ข `setInterval`: runs code repeatedly at intervals

*14. What is the difference between stack and heap*
โ€ข Stack: stores primitive values and function calls
โ€ข Heap: stores objects and reference types

*15. What is the use of the spread operator (...)*
Expands arrays/objects or merges them
Example:
```js
const arr = [1, 2];
const newArr = [...arr, 3]; // [1, 2, 3]
```

*16. What is the difference between map and forEach*
โ€ข `map`: returns a new array
โ€ข `forEach`: performs action but returns undefined

*17. What is the use of localStorage and sessionStorage*
โ€ข `localStorage`: persists data even after browser is closed
โ€ข `sessionStorage`: persists data only for session

*18. What is a prototype in JavaScript*
Every object has a prototype โ€” an object it inherits methods and properties from. Enables inheritance.

*19. What is the difference between synchronous and asynchronous code*
โ€ข Synchronous: executes line by line
โ€ข Asynchronous: executes independently, doesnโ€™t block main thread

*20. What are modules in JavaScript*
Used to split code into reusable pieces
Example:
```js
// file.js
export const greet = () => "Hello";

// main.js
import { greet} from './file.js';
```

โค๏ธ *React for more Interview Resources*

24/08/2025

Consistency Beats Motivation:

I waited for motivation to learn new tools.

Sometimes it cameโ€ฆ mostly, it didnโ€™t.

Then I switched to 20 mins daily practice.

Small steps โ†’ Big growth.

Motivation fades.

Consistency builds careers.

Whatโ€™s one skill youโ€™re consistently improving right now?

hashtag hashtag hashtag hashtag hashtag hashtag hashtag hashtag hashtag

๐Ÿš€ ๐—ฆ๐—ผ๐—ณ๐˜ ๐—ฆ๐—ธ๐—ถ๐—น๐—น๐˜€ ๐—˜๐˜ƒ๐—ฒ๐—ฟ๐˜† ๐—ช๐—ฒ๐—ฏ ๐——๐—ฒ๐˜ƒ๐—ฒ๐—น๐—ผ๐—ฝ๐—ฒ๐—ฟ ๐— ๐˜‚๐˜€๐˜ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป:Being a web developer isnโ€™t just about writing clean code or mastering fram...
18/08/2025

๐Ÿš€ ๐—ฆ๐—ผ๐—ณ๐˜ ๐—ฆ๐—ธ๐—ถ๐—น๐—น๐˜€ ๐—˜๐˜ƒ๐—ฒ๐—ฟ๐˜† ๐—ช๐—ฒ๐—ฏ ๐——๐—ฒ๐˜ƒ๐—ฒ๐—น๐—ผ๐—ฝ๐—ฒ๐—ฟ ๐— ๐˜‚๐˜€๐˜ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป:

Being a web developer isnโ€™t just about writing clean code or mastering frameworks. Success in this field also depends heavily on soft skills that make collaboration and growth possible.

Here are some essentials every developer should focus on:

๐Ÿ”น Communication โ€“ Explaining complex ideas in simple terms to clients, teammates, or non-technical stakeholders.

๐Ÿ”น Problem-Solving Mindset โ€“ Debugging isnโ€™t just about code; itโ€™s about finding creative solutions under pressure.

๐Ÿ”น Teamwork โ€“ Great projects are built when developers collaborate effectively, not in isolation.

๐Ÿ”น Adaptability โ€“ Tech changes fast. The ability to learn and adjust quickly is key to staying relevant.

๐Ÿ”น Time Management โ€“ Balancing deadlines, bug fixes, and feature requests requires discipline.

๐Ÿ”น Empathy โ€“ Understanding user needs and client perspectives leads to better, human-centered solutions.

๐Ÿ’ก Mastering these soft skills alongside technical expertise will not only make you a better developer but also a valuable professional in any team.

๐Ÿ‘‰ What soft skill do you think has helped you most as a developer?

17/08/2025

Pro Coders during serious debugging ๐Ÿซข

๐Ÿ’ก ๐—ง๐—ต๐—ฒ ๐—•๐—ฒ๐˜€๐˜ ๐—ช๐—ฎ๐˜† ๐˜๐—ผ ๐—”๐˜€๐—ธ ๐—ณ๐—ผ๐—ฟ ๐—›๐—ฒ๐—น๐—ฝ ๐—ฎ๐˜€ ๐—ฎ ๐——๐—ฒ๐˜ƒ๐—ฒ๐—น๐—ผ๐—ฝ๐—ฒ๐—ฟ:As developers, we all hit roadblocks. The difference between staying stuck...
17/08/2025

๐Ÿ’ก ๐—ง๐—ต๐—ฒ ๐—•๐—ฒ๐˜€๐˜ ๐—ช๐—ฎ๐˜† ๐˜๐—ผ ๐—”๐˜€๐—ธ ๐—ณ๐—ผ๐—ฟ ๐—›๐—ฒ๐—น๐—ฝ ๐—ฎ๐˜€ ๐—ฎ ๐——๐—ฒ๐˜ƒ๐—ฒ๐—น๐—ผ๐—ฝ๐—ฒ๐—ฟ:

As developers, we all hit roadblocks. The difference between staying stuck and moving forward often comes down to how we ask for help.

Hereโ€™s what Iโ€™ve learned works best:

โœ… Be Specific โ€“ Donโ€™t just say โ€œItโ€™s not working.โ€ Share the exact error, code snippet, or unexpected behavior.

โœ… Show Effort โ€“ Mention what you already tried (Google searches, docs, debugging steps). This shows you respect the other personโ€™s time.

โœ… Ask Clear Questions โ€“ Instead of โ€œCan someone fix this?โ€ try โ€œWhy does X happen when I do Y?โ€

โœ… Be Respectful โ€“ A little politeness goes a long way. Everyoneโ€™s busy, so gratitude matters.

When you ask better, you learn faster, and the person helping you feels valued too.

๐Ÿ‘‰ How do you ask for help when youโ€™re stuck on a coding problem?

23/07/2025

*Quick JavaScript Cheatsheet* ๐Ÿš€

*Variables*
- `let x = 5;` (block-scoped)
- `const y = 10;` (constant)
- `var z = 15;` (function-scoped)

*Data Types*
- Number: `let num = 10;`
- String: `let str = "hello";`
- Boolean: `let isTrue = false;`
- Array: `let arr = ;`
- Object: `let obj = { name: "Amit", age: 25 };`

*Functions*
- Regular:
`function greet() { return "Hi!"; }`
- Arrow:
`const add = (a, b) => a + b;`

*Conditionals*
- `if (x > 5) { ... } else { ... }`
- Ternary:
`let result = x > 5 ? "Yes" : "No";`

*Loops*
- For:
`for (let i = 0; i < 5; i++) { ... }`
- While:
`while (x < 10) { ... }`
- ForEach (array):
`arr.forEach(item => console.log(item));`

*DOM Manipulation*
- Get element:
`document.getElementById("myId")`
- Change text:
`element.textContent = "New Text";`
- Add event:
`element.addEventListener("click", myFunc);`

*React โค๏ธ for more*

18/07/2025

โœ… 100 Days JavaScript Roadmap โ€“ 2025 ๐Ÿš€๐ŸŸก
๐Ÿ•’ Daily: 1โ€“2 hours + hands-on coding practice

๐Ÿ“ Days 1โ€“10: JavaScript Basics
โ€“ Set up editor & browser console
โ€“ Variables: var, let, const
โ€“ Data types: string, number, boolean, null, undefined
โ€“ Basic operators & expressions
โ€“ Conditionals: if, else, switch
โ€“ Loops: for, while, do...while

๐Ÿ“ Days 11โ€“20: Functions, Arrays, Objects
โ€“ Function declarations & expressions
โ€“ Parameters, return values
โ€“ Arrays & common methods (push, pop, map, filter)
โ€“ Objects, properties, access & manipulation
โ€“ Scope & hoisting
โ€“ Mini project: Calculator or Guessing Game

๐Ÿ“ Days 21โ€“30: DOM & Events
โ€“ DOM selection & manipulation
โ€“ Adding/removing elements
โ€“ Event listeners, handling clicks & forms
โ€“ Basic form validation
โ€“ Mini project: To-Do List App

๐Ÿ“ Days 31โ€“40: Modern JS & ES6+
โ€“ Arrow functions
โ€“ Template literals
โ€“ Destructuring, spread/rest operators
โ€“ Classes, OOP basics
โ€“ Modules: import/export
โ€“ Mini project: Notes App or Quiz App

๐Ÿ“ Days 41โ€“50: Asynchronous JavaScript
โ€“ Callbacks, Promises
โ€“ Async/await syntax
โ€“ Fetch API & data from web
โ€“ Handling JSON
โ€“ Mini project: Weather App or News App

๐Ÿ“ Days 51โ€“60: Project Building & Storage
โ€“ LocalStorage & sessionStorage
โ€“ Small real-life projects (Expense Tracker, Clock, etc.)
โ€“ Code refactoring & debugging
โ€“ Using DevTools for troubleshooting

๐Ÿ“ Days 61โ€“70: Advanced Concepts
โ€“ Prototypal inheritance
โ€“ 'this', closures
โ€“ Error handling: try/catch
โ€“ Regular expressions
โ€“ Higher-order functions, functional programming basics

๐Ÿ“ Days 71โ€“80: Framework Introduction
โ€“ Basics of React or Node.js
โ€“ Component structure, props, state (for React)
โ€“ Writing a tiny full-stack or frontend app

๐Ÿ“ Days 81โ€“90: APIs & Real-World Data
โ€“ Consuming public APIs
โ€“ Building a personal portfolio project
โ€“ SEO basics, accessibility tips
โ€“ Project: Personal Portfolio, Movie App

๐Ÿ“ Days 91โ€“100: Version Control & Deployment
โ€“ Git & GitHub basics
โ€“ Push projects and portfolio to GitHub
โ€“ Deploy using Netlify, Vercel, or GitHub Pages
โ€“ Review, update, and share your projects

๐Ÿ“š Tap โค for more!
































๐Ÿ”น๏ธ UI/UX - css-tricks.com๐Ÿ”น๏ธ API - restapitutorial.com๐Ÿ”น๏ธ Python - python.org/doc๐Ÿ”น๏ธ Node.js - nodejs.dev.
18/07/2025

๐Ÿ”น๏ธ UI/UX - css-tricks.com
๐Ÿ”น๏ธ API - restapitutorial.com
๐Ÿ”น๏ธ Python - python.org/doc
๐Ÿ”น๏ธ Node.js - nodejs.dev.

The official home of the Python Programming Language

๐Ÿ“ฃ Switch Case Tutorial in JavaScriptLooking to clean up those long if-else chains?The switch statement is a powerful too...
11/07/2025

๐Ÿ“ฃ Switch Case Tutorial in JavaScript
Looking to clean up those long if-else chains?
The switch statement is a powerful tool for writing clearer and more organized code.

๐Ÿ” In this tutorial, youโ€™ll learn:
โœ… When to use switch
โœ… How it compares to if-else
โœ… Real-world examples to boost your logic

Whether you're just starting out or brushing up your skills โ€” this one's for you!

11/07/2025

๐Ÿ’ผ I BUILD HIGH-QUALITY CUSTOM WEB APPS FOR BUSINESSES

Whether you're a startup or an established brand, I help turn your ideas into fast, scalable, and user-friendly web applications โ€” built specifically for your business needs.

โœ… Tailored Solutions
โœ… Clean, Responsive Design
โœ… Scalable Architecture
โœ… Ongoing Support
๐Ÿ’ฌ Free Consultation Available

Letโ€™s connect and take your business online โ€” the right way.

๐Ÿ“ฉ Message now to get started!
Check Pin Post

Address

Lahore
05450

Alerts

Be the first to know and let us send you an email when Muhammad saifullah posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Share

Category