html and css آموزش
22.7K subscribers
527 photos
256 videos
92 files
324 links
ادمین :
@Maryam3771


تعرفه تبلیغات:
https://t.me/alloadv/822
Download Telegram
Please open Telegram to view this post
VIEW IN TELEGRAM
2🔥2
Please open Telegram to view this post
VIEW IN TELEGRAM
1🔥1
Please open Telegram to view this post
VIEW IN TELEGRAM
1👍1🔥1
Glow Icons 1.0 منتشر شد

یک کتابخانه نماد رایگان و دارای مجوز MIT با 442 نماد SVG تمیز که به طور خاص برای رابط های رابط کاربری طراحی شده است. موجود در 2 سبک، مناسب برای نیازهای طراحی روزمره.


https://www.glowui.com/icons


💎 @Htmlcss_channels | #css #JavaScript #HTML
Please open Telegram to view this post
VIEW IN TELEGRAM
👍2
JavaScript Objects – Interview Questions & Answers


🔹 1. What is an object in JavaScript?
An object is a collection of key-value pairs used to store related data and functionality.
Example:
const user = { name: "Alice", age: 25 };


🔹 2. How do you access object properties?
Using dot or bracket notation:
user.name  // "Alice"  
user["age"] // 25


🔹 3. How can you loop through an object?
Use for...in or Object.keys()/Object.entries():
for (let key in user) { console.log(key, user[key]); }


🔹 4. Difference between Object.freeze() and Object.seal()?
⦁ freeze() prevents any change (no adding, deleting, or modifying properties).
⦁ seal() allows value changes, but not adding/removing keys.

🔹 5. How do you clone an object?
const clone = {...user };  
// or
const copy = Object.assign({}, user);


🔹 6. What is this inside an object?
this refers to the object itself in method context.
const person = {
name: "Bob",
greet() { return `Hi, I’m ${this.name}`; }
};


🔹 7. How do prototypes relate to objects?
Every JS object has a hidden [[Prototype]]. It lets objects inherit properties from others.

🔹 8. What is a constructor function?
A function used to create multiple similar objects:
function User(name) {
this.name = name;
}
const u = new User("Tom");


🔹 9. What's the difference between Object.create() and new keyword?
⦁ Object.create(proto) creates an object with the given prototype.
⦁ new invokes a constructor function to initialize objects.

🔹 10. How do you check if a property exists in an object?
"name" in user // true
user.hasOwnProperty("age") // true

💬 Tap ❤️ for more!


💎 @Htmlcss_channels | #css #JavaScript #HTML #interview
7👍2
JavaScript Practice Questions with Answers 💻

🔍 Q1. How do you check if a number is even or odd?
Answer:
let num = 10;
if (num % 2 === 0) {
console.log("Even");
} else {
console.log("Odd");
}


🔍 Q2. How do you reverse a string?
Answer:
let text = "hello";
let reversedText = text.split("").reverse().join("");
console.log(reversedText); // Output: olleh


🔍 Q3. Write a function to find the factorial of a number.
Answer:
function factorial(n) {
let result = 1;
for (let i = 1; i <= n; i++) {
result *= i;
}
return result;
}

console.log(factorial(5)); // Output: 120


🔍 Q4. How do you remove duplicates from an array?
Answer:
let items = [1, 2, 2, 3, 4, 4];
let uniqueItems = [...new Set(items)];
console.log(uniqueItems);


🔍 Q5. Print numbers from 1 to 10 using a loop.
Answer:
for (let i = 1; i <= 10; i++) {
console.log(i);
}


🔍 Q6. Check if a word is a palindrome.
Answer:
let word = "madam";
let reversed = word.split("").reverse().join("");
if (word === reversed) {
console.log("Palindrome");
} else {
console.log("Not a palindrome");
}


💬 Tap ❤️ for more!


💎 @Htmlcss_channels | #css #JavaScript #HTML #interview
4
JavaScript Practice Questions – Part 2 💻🔥

🔍 Q1. Swap two variables without a third variable.
Answer:
let a = 5, b = 10;
[a, b] = [b, a];
console.log(a, b); // Output: 10 5


🔍 Q2. Find the largest number in an array.
Answer:
let numbers = [3, 7, 2, 9, 5];
let max = Math.max(...numbers);
console.log(max); // Output: 9


🔍 Q3. Check if a number is prime.
Answer:
function isPrime(n) {
if (n <= 1) return false;
for (let i = 2; i <= Math.sqrt(n); i++) {
if (n % i === 0) return false;
}
return true;
}

console.log(isPrime(7)); // Output: true


🔍 Q4. Count vowels in a string.
Answer:
function countVowels(str) {
return str.match(/[aeiou]/gi)?.length || 0;
}

console.log(countVowels("Hello World")); // Output: 3


🔍 Q5. Convert first letter of each word to uppercase.
Answer:
let sentence = "hello world";
let titleCase = sentence.split(" ").map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");

console.log(titleCase); // Output: Hello World


💬 Tap ❤️ for Part 3!


💎 @Htmlcss_channels | #css #JavaScript #HTML #interview
4
🚀 JavaScript Interview Questions with Answers — Part 3

21. What is an array in JavaScript?
An array is a special object used to store multiple values in a single variable.

Example:
const fruits = ["Apple", "Banana", "Mango"];

Access Elements:
console.log(fruits[0]); // Apple

Features:
• Ordered collection
• Zero-based indexing
• Can store mixed data types

Example:
const data = ["Deepak", 25, true];

22. How do you add/remove elements from an array?

Add Elements
push() → Add at end
const arr = [1, 2];
arr.push(3);
console.log(arr);

unshift() → Add at beginning
arr.unshift(0);

Remove Elements
pop() → Remove from end
arr.pop();
shift() → Remove from beginning
arr.shift();

Example:
const numbers = [1, 2, 3];
numbers.push(4);
numbers.pop();
console.log(numbers);

23. What is the difference between push(), pop(), shift(), unshift()?
push() → Add element at end
pop() → Remove element from end
shift() → Remove element from start
unshift() → Add element at start

Example:
const arr = [1, 2];
arr.push(3);
arr.unshift(0);
console.log(arr);
arr.pop();
arr.shift();
console.log(arr);
Output:
[0][1][2][3]

24. What is map(), filter(), and reduce()?
These are important array methods used in functional programming.

map()
Creates a new array by transforming elements.
const nums = [1, 2, 3];
const doubled = nums.map(num => num * 2);
console.log(doubled);

Output:
[2][4][6]

filter()
Returns elements matching a condition.
const nums = [1, 2, 3, 4];
const even = nums.filter(num => num % 2 === 0);
console.log(even);

Output:
[2][4]

reduce()
Reduces array to a single value.
const nums = [1, 2, 3];
const sum = nums.reduce((total, num) => total + num, 0);
console.log(sum);

Output:
6

25. How do you remove duplicates from an array?

Using Set
const nums = [1, 2, 2, 3, 4, 4];
const unique = [...new Set(nums)];
console.log(unique);

Output:
[1][2][3][4]

Why Set?
A Set stores only unique values.

Alternative Using filter()
const arr = [1, 2, 2, 3];
const unique = arr.filter((item, index) =>
arr.indexOf(item) === index
);
console.log(unique);

26. How do you flat / flatten an array?
Flattening means converting nested arrays into a single array.

Using flat()
const arr = [1, [2, 3], [4, 5]];
console.log(arr.flat());

Output:
[1][2][3][4][5]

Deep Flatten:
const arr = [1, [2, [3, 4]]];
console.log(arr.flat(Infinity));

Using reduce()
const arr = [[1, 2], [3, 4]];
const flat = arr.reduce((acc, val) => acc.concat(val), []);
console.log(flat);

27. What is an object in JavaScript?
An object is a collection of key-value pairs.

Example:
const person = {
name: "Deepak",
age: 25,
city: "Oslo"
};

Access Properties:
console.log(person.name);

Objects Can Store:
• Strings
• Numbers
• Arrays
• Functions
• Other objects

28. What is the difference between dot and bracket notation?

Dot Notation
console.log(person.name);

Bracket Notation
console.log(person["name"]);

Dot Notation
• Simple syntax
• Faster to write

Bracket Notation
• Dynamic keys supported
• Useful for spaces/special chars

Example:
const obj = {
"first name": "Deepak"
};
console.log(obj["first name"]);

29. How do you merge two objects?

Using Spread Operator
const obj1 = {a: 1};
const obj2 = {b: 2};
const merged = {...obj1,...obj2};
console.log(merged);

Output:
{a: 1, b: 2}

Using Object.assign()
const merged = Object.assign({}, obj1, obj2);

Important:
If duplicate keys exist, later values overwrite earlier ones.

30. How do you deep clone an object? 
Deep cloning creates a completely independent copy of an object.

Using structuredClone()  
const obj = {  
    name: "Deepak",  
    address: {  
        city: "Oslo"  
    }  
};  
const clone = structuredClone(obj);

Using JSON Method  
const clone = JSON.parse(JSON.stringify(obj));

💌 Double Tap ❤️ For Part-4


💎 @Htmlcss_channels | #css #JavaScript #HTML #interview
6
39. When would you use for vs forEach()?
for Loop vs forEach() 
for - More control, Can use break/continue, Faster in heavy loops 

forEach() - Cleaner syntax, Cannot stop early, Better readability

for Example

for (let i = 0; i < 3; i++) {
    console.log(i);
}


forEach() Example

[1, 2, 3].forEach(num => {
    console.log(num);
});


Interview Tip: 
Use forEach() for readability and for when more control is needed.

40. How do you handle early exits from loops?
Using break

for (let i = 1; i <= 5; i++) {
    if (i === 3) {
        break;
    }
    console.log(i);
}


Using return Inside Functions

function test() {
    for (let i = 1; i <= 5; i++) {
        if (i === 3) {
            return;
        }
        console.log(i);
    }
}

test();


Important:
forEach() does not support break directly.

Use:
• for
• for...of
• some()
• every()

for early exits.

Double Tap ❤️ For Part-5




💎 @Htmlcss_channels | #css #JavaScript #HTML #interview
3
🔰 Some useful CSS shortcuts



💎 @Htmlcss_channels | #css #JavaScript
🔥32
💻 Responsive HTML Video با Orientation Media Query

💻 کد CSS:

* حالت عمودی (موبایل) *
@media screen and (orientation: portrait) {
  video {
    width: 100%;
    height: auto;
  }
}

* حالت افقی (دسکتاپ) *
@media screen and (orientation: landscape) {
  video {
    width: auto;
    height: 100vh;
    max-width: 100%;
  }
}


بهینه‌سازی بیشتر:
* فقط موبایل *
@media screen and (max-width: 768px) and (orientation: portrait) {
  video {
    object-fit: cover;
    aspect-ratio: 9/16;
  }
}

* فقط دسکتاپ *
@media screen and (min-width: 769px) and (orientation: landscape) {
  video {
    object-fit: contain;
    aspect-ratio: 16/9;
  }
}

🎬 مثال عملی:
<video controls poster="poster.jpg">
  <source src="video-mobile.mp4" media="(orientation: portrait)">
  <source src="video-desktop.mp4" media="(orientation: landscape)">
  Your browser does not support the video tag.
</video>



💎 @Htmlcss_channels | #HTML #css #JavaScript
8
مجموعه‌ای از کدهای کوتاه ولی کاربردی CSS
۶ تکه کد که هر برنامه‌نویس وب باید داشته باشه


ارسال کدها در پست بعدی👇


💎 @Htmlcss_channels | #HTML #css #JavaScript
3🔥1
مجموعه‌ای از کدهای کوتاه ولی کاربردی CSS
۶ تکه کد که هر برنامه‌نویس وب باید داشته باشه!

۱️⃣ مرکز کردن آیتم‌ها در گرید
.container {
display: grid;
place-items: center;
}

یه خط ساده که همه چیز رو وسط میاره! هم عمودی، هم افقی.

۲️⃣ پدینگ چپ و راست (با logical properties)
.button {
padding-inline: 1rem;
}

به جای padding-left و padding-right — یه دونه بنویس!

نکته: همین ترفند رو میتونی برای margin و border هم استفاده کنی:
margin-inline / border-inline → چپ و راست
padding-block / margin-block → بالا و پایین

۳️⃣ ستون‌های هم‌عرض در گرید
.container {
display: grid;
grid-auto-flow: column;
grid-auto-columns: 1fr;
}

هر تعداد ستون که داشته باشی، همه هم‌عرض میشن! عالی برای layoutهای داینامیک.

۴️⃣ استایل همزمان hover و focus
button:is(:hover, :focus) {
/* استایل خودت رو اینجا بنویس */
}

یه بار بنویس، برای هر دو حالت کار کنه! هم برای موس، هم برای کیبورد (accessibility).

۵️⃣ دایره کامل
.circle {
width: 2rem;
aspect-ratio: 1 / 1;
border-radius: 50%;
}

هرچیزی رو تبدیل به دایره می‌کنه! با aspect-ratio مطمئن میشی که همیشه square بمونه.

۶️⃣ حذف فاصله اضافی بین آیتم‌های گرید
.container {
gap: 0;
}

یا برای فاصله دلخواه:
.container {
gap: 1rem;
}

💡 چرا اینا کاربردی ان؟
کوتاه و مینیمال — هر کدوم یه خطه
مدرن — از قابلیت‌های جدید CSS استفاده می‌کنن
کاربرد روزمره — توی هر پروژه‌ای بهشون نیاز داری

💎 @Htmlcss_channels | #HTML #css #JavaScript
5
؛CSS Houdini چیست؟
یه API قدرتمند که بهت اجازه می‌ده مستقیماً با CSS نقاشی بکشی! 🎨

توضیحات بیشتر و کدهارو در پست بعدی ببینید👇👇


💎 @Htmlcss_channels | #HTML #css #JavaScript
🔥21
؛CSS Houdini چیست؟
یه API قدرتمند که بهت اجازه می‌ده مستقیماً با CSS نقاشی بکشی! 🎨

۵ مرحله‌ای که تصاویر نشون می‌دن:
۱️⃣ ساخت Paint Worklet
class DotsPainter {
paint(ctx, geom, props) {
ctx.fillStyle = 'pink';
for (let y = 0; y < geom.height; y += 20) {
for (let x = 0; x < geom.width; x += 20) {
ctx.beginPath();
ctx.arc(x, y, 5, 0, 2 * Math.PI);
ctx.fill();
}
}
}
}
registerPaint('dots', DotsPainter)

یه کلاس جاوااسکریپت می‌نویسی که روی canvas رسم می‌کنه.

۲️⃣ ثبت Worklet
CSS.paintWorklet.addModule('paint.js');

فایل جاوااسکریپت رو به مرورگر معرفی می‌کنی.

۳️⃣ استفاده در CSS
.box {
background: paint(dots);
}

حالا می‌تونی مثل background معمولی استفاده کنی!

۴️⃣ شخصی‌سازی با متغیرها
ctx.fillStyle = props.get('--dot-color') || 'pink';



.box {
background: paint(dots);
--dot-color: blue;
}

رنگ رو از CSS تغییر بده!

۵️⃣ نتیجه
بدون عکس
بدون پلاگین
فقط CSS خالص
روی compositor thread اجرا می‌شه (سریع)



💎 @Htmlcss_channels | #HTML #css #JavaScript
4
🖥️ پروژه‌های تمرینی برای توسعه‌دهنده وب (با سورس کد)

۵۰ پروژه در ۵۰ روز

• تکنولوژی: HTML, CSS, JavaScript
• توضیح: ۵۰ پروژه کوچک برای تمرین روزانه
• سطح: مبتدی تا متوسط

فروشگاه اینترنتی با Django

• تکنولوژی: Python (Django)
• توضیح: ساخت فروشگاه کامل با لیست محصولات، سبد خرید و پرداخت
• سطح: متوسط
• ویژگی: یادگیری ادغام بک‌اند و فرانت‌اند

اپلیکیشن کوئیز جاوااسکریپت

• تکنولوژی: JavaScript (React)
• توضیح: اپلیکیشن کوئیز داینامیک با دریافت سوالات از API
• سطح: متوسط
• ویژگی: تقویت React و ادغام API

سیستم احراز هویت PHP

• تکنولوژی: PHP
• توضیح: سیستم احراز هویت و مدیریت کاربران
• سطح: متوسط
• ویژگی: CRUD و امنیت با PHP و MySQL

لیست کارهای (To-Do List)

• تکنولوژی: Ruby on Rails
• توضیح: اپلیکیشن مدیریت وظایف
• سطح: مبتدی تا متوسط
• ویژگی: اضافه، ویرایش و حذف وظایف

🚀 پیشنهاد شروع
1. مبتدی: شروع با ۵۰ پروژه در ۵۰ روز
2. متوسط: ادامه با فروشگاه Django یا کوئیز React
3. پیشرفته: سیستم احراز هویت PHP


💎 @Htmlcss_channels | #HTML #css #JavaScript
1
This media is not supported in your browser
VIEW IN TELEGRAM
#فیگما یک اکستنشن مرورگر کروم معرفی کرده که یک سایت رو باز میکنید
میزنید روی کپی
میرید داخل فیگما Past میکنید
تمام، الان یک سایت قابل ادیت دارید

پ.ن: الان میشه کار مشتری هایی که یک کپی دیجی کالا و اسنپ رو میخوان سریع راه انداخت

پ.ن:‌ نسخه آزمایشیش برای پلن های پرو به بالا کار میکنه نه رایگان

https://chromewebstore.google.com/detail/figma/fkmaohpngenfoccdgceedjkfhkdcohmg


💎 @Htmlcss_channels | #HTML #css #JavaScript
5